ContextualLogger

class ContextualLogger(logger: Logger, tag: String, context: Map<String, Any?> = LinkedHashMap()) : Logger

A logger appending contextual data to each message

Parameters

logger

the Logger to log to

tag

the tag to use/append when logging within this context

context

the contextual data to append to each message

Constructors

Link copied to clipboard
constructor(logger: Logger, tag: String, context: Map<String, Any?> = LinkedHashMap())

Functions

Link copied to clipboard
fun Logger.d(message: () -> String)
fun Logger.d(message: String)

Writes log with DEBUG log level and empty tag.

fun Logger.d(throwable: Throwable)

Log exception with DEBUG log level and empty tag.

fun Logger.d(tag: String?, message: () -> String)
fun Logger.d(tag: String?, message: String)
fun Logger.d(tag: String? = null, throwable: Throwable? = null, message: () -> String)

Writes log with DEBUG log level and provided tag.

fun Logger.d(tag: String? = null, throwable: Throwable)

Log exception with DEBUG log level and provided tag.

Link copied to clipboard
fun Logger.debug(message: () -> String)
fun Logger.debug(message: String)

Writes log with DEBUG log level and empty tag.

fun Logger.debug(throwable: Throwable)

Log exception with DEBUG log level and empty tag.

fun Logger.debug(tag: String?, message: () -> String)
fun Logger.debug(tag: String?, message: String)
fun Logger.debug(tag: String? = null, throwable: Throwable? = null, message: () -> String)

Writes log with DEBUG log level and provided tag.

fun Logger.debug(tag: String? = null, throwable: Throwable)

Log exception with DEBUG log level and provided tag.

Link copied to clipboard
fun Logger.e(message: () -> String)
fun Logger.e(message: String)

Writes log with ERROR log level and empty tag.

fun Logger.e(throwable: Throwable)

Log exception with ERROR log level and empty tag.

fun Logger.e(tag: String?, message: () -> String)
fun Logger.e(tag: String?, message: String)
fun Logger.e(tag: String? = null, throwable: Throwable? = null, message: () -> String)

Writes log with ERROR log level and provided tag.

fun Logger.e(tag: String? = null, throwable: Throwable)

Log exception with ERROR log level and provided tag.

Link copied to clipboard
fun Logger.error(message: () -> String)
fun Logger.error(message: String)

Writes log with ERROR log level and empty tag.

fun Logger.error(throwable: Throwable)

Log exception with ERROR log level and empty tag.

fun Logger.error(tag: String?, message: () -> String)
fun Logger.error(tag: String?, message: String)
fun Logger.error(tag: String? = null, throwable: Throwable? = null, message: () -> String)

Writes log with ERROR log level and provided tag.

fun Logger.error(tag: String? = null, throwable: Throwable)

Log exception with ERROR log level and provided tag.

Link copied to clipboard
fun Logger.i(message: () -> String)
fun Logger.i(message: String)

Writes log with INFO log level and empty tag.

fun Logger.i(throwable: Throwable)

Log exception with INFO log level and empty tag.

fun Logger.i(tag: String?, message: () -> String)
fun Logger.i(tag: String?, message: String)
fun Logger.i(tag: String? = null, throwable: Throwable? = null, message: () -> String)

Writes log with INFO log level and provided tag.

fun Logger.i(tag: String? = null, throwable: Throwable)

Log exception with INFO log level and provided tag.

Link copied to clipboard
fun Logger.info(message: () -> String)
fun Logger.info(message: String)

Writes log with INFO log level and empty tag.

fun Logger.info(throwable: Throwable)

Log exception with INFO log level and empty tag.

fun Logger.info(tag: String?, message: () -> String)
fun Logger.info(tag: String?, message: String)
fun Logger.info(tag: String? = null, throwable: Throwable? = null, message: () -> String)

Writes log with INFO log level and provided tag.

fun Logger.info(tag: String? = null, throwable: Throwable)

Log exception with INFO log level and provided tag.

Link copied to clipboard
open override fun log(level: LogLevel, tag: String? = null, throwable: Throwable? = null, message: () -> String? = null)

Writes log with provided level and tag.

Link copied to clipboard
fun Logger.w(message: () -> String)
fun Logger.w(message: String)

Writes log with WARN log level and empty tag.

fun Logger.w(throwable: Throwable)

Log exception with WARN log level and empty tag.

fun Logger.w(tag: String?, message: () -> String)
fun Logger.w(tag: String?, message: String)
fun Logger.w(tag: String? = null, throwable: Throwable? = null, message: () -> String)

Writes log with WARN log level and provided tag.

fun Logger.w(tag: String? = null, throwable: Throwable)

Log exception with WARN log level and provided tag.

Link copied to clipboard
fun Logger.warn(message: () -> String)
fun Logger.warn(message: String)

Writes log with WARN log level and empty tag.

fun Logger.warn(throwable: Throwable)

Log exception with WARN log level and empty tag.

fun Logger.warn(tag: String?, message: () -> String)
fun Logger.warn(tag: String?, message: String)
fun Logger.warn(tag: String? = null, throwable: Throwable? = null, message: () -> String)

Writes log with WARN log level and provided tag.

fun Logger.warn(tag: String? = null, throwable: Throwable)

Log exception with WARN log level and provided tag.

Link copied to clipboard
fun withAppendedContext(keyValue: Pair<String, Any?>, vararg keysAndValues: Pair<String, Any?>): ContextualLogger

Creates a new ContextualLogger that logs the same contextual data with additional contextual data

Link copied to clipboard

Creates a new ContextualLogger that logs the same contextual data with a new tag

Link copied to clipboard

Creates a new ContextualLogger that logs the same contextual data as this logger to a new Logger