Package-level declarations

Types

Link copied to clipboard
sealed class Level : Comparable<Level>

Logging level.

Link copied to clipboard
interface Logger

Abstraction over logging implementation. The implementation is agnostic but should be pluggable to almost any framework out there.

Link copied to clipboard

A Logger instance that prevents all logging.

Link copied to clipboard
interface LoggerScope : Logger

Wrapper for Logger which prepends each logged message with the scope.

Link copied to clipboard
class ProxyLogger(initialLoggers: Iterable<Logger> = emptyList()) : Logger

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

Functions

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
inline fun <T> LoggerScope.scope(name: String, body: LoggerScope.() -> T): T

Creates temporary sub-scope of current LoggerScope with custom name post-fixed to the new scope. The sub-scope is discarded once the body invocation is finished.

Link copied to clipboard
inline fun <T> LoggerScope.timedScope(name: String, body: () -> T): T

Measures the duration of a scope.

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.