ConsoleLogger

constructor(minLogLevel: Level = Level.VERBOSE, filter: LumberjackFilter = DefaultLumberjackFilter, tagTransformer: (tag: String?) -> String? = { it })

Parameters

minLogLevel

minimum log level this logger outputs. Default: Level.VERBOSE.

filter

Lumberjack filter used to decide which logs are allowed. Default: DefaultLumberjackFilter.

tagTransformer

function called for every log with the runtime tag (may be null) and returning the final tag to use (or null to indicate no tag). The default is the identity function ({ it }) which leaves the runtime tag unchanged.

Notes and recommendations:

  • tagTransformer is invoked on every log call and therefore should be fast and side-effect free.

  • If you want to include a fixed prefix/tag, you can capture it from the surrounding scope: val logger = ConsoleLogger(tagTransformer = { tag -> if (tag != null) "FIXED-$tag" else "FIXED" })

  • The transformer may return null if no tag should be used.

Note: The logger intentionally places className before the "(file:line)" part so IDEs/logcat can make the filename:line clickable.