ProxyLogger

class ProxyLogger(initialLoggers: Iterable<Logger> = emptyList()) : Logger

Logger implementation which calls all registered Loggers when this instance log method is called.

Parameters

initialLoggers

Initial Iterable of loggers to be used by the ProxyLogger.

Constructors

Link copied to clipboard
constructor(vararg loggers: Logger)

Creates an instance of ProxyLogger using supplied loggers.

constructor(initialLoggers: Iterable<Logger> = emptyList())

Properties

Link copied to clipboard

Returns count of currently registered Loggers.

Link copied to clipboard

Returns unmodifiable copy of registered Loggers.

Functions

Link copied to clipboard
fun add(logger: Logger)

Add a new logger.

fun add(vararg loggers: Logger)

Add new loggers.

Link copied to clipboard
fun addAll(loggers: Iterable<Logger>)

Add new loggers.

Link copied to clipboard
fun clear()

Remove all loggers.

Link copied to clipboard
fun Logger.debug(message: String, throwable: Throwable? = null)

Calls Logger.log message with Debug level.

Link copied to clipboard
inline fun <T> Logger.duration(body: () -> T): T

Measures the duration it takes to invoke the body. Logs with Verbose level message Started before the invocation and Finished took XYZms after completion.

Link copied to clipboard
fun Logger.error(message: String, throwable: Throwable? = null)

Calls Logger.log message with Error level.

Link copied to clipboard
fun Logger.info(message: String, throwable: Throwable? = null)

Calls Logger.log message with Info level.

Link copied to clipboard
open override fun log(level: Level, message: String, throwable: Throwable?)

Uses level to determine whether it should be passed to the underlying implementation. Implementations are free to use whichever level they like.

Link copied to clipboard
fun remove(logger: Logger)

Remove given logger.

Link copied to clipboard
fun Logger.verbose(message: String, throwable: Throwable? = null)

Calls Logger.log message with Verbose level.

Link copied to clipboard
fun Logger.warning(message: String, throwable: Throwable? = null)

Calls Logger.log message with Warning level.