Skip to content

May we add a conditional log? #605

Closed

Description

@urmichm

May we have a conditional logging on top of the logger level?

Example:

logger.infoIf(condition) { "Log message" }

That would be a simple wrapper method around ordinary, in this case, info method...

fun infoIf(condition: Boolean, message: () -> Any?): Unit {
    if (condition) {
        this.info(message)
    }
}

Activity

  1. github-actions commented on Aug 7, 2026

    @github-actions

    Thank you for reporting an issue. See the wiki for documentation and slack for questions.

  2. oshai commented on Aug 9, 2026

    @oshai
    Owner

    It feels like to me it will more clutter the api then provide actual value. Especially that it's easy to do it in extension function outside of the lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions