Logger

open class Logger(val name: String, val debugTag: String = DEBUG, val infoTag: String = INFO, val errorTag: String = ERROR)

A simple logging utility class that includes its name in the logged messages.

Parameters

name

name of the logger prepended to each logged message.

debugTag

will be passed as the message tag on debug logs.

infoTag

will be passed as the message tag on info logs.

errorTag

will be passed as the message tag on error logs.

Constructors

Link copied to clipboard
constructor(name: String, debugTag: String = DEBUG, infoTag: String = INFO, errorTag: String = ERROR)

Properties

Link copied to clipboard
open val debugTag: String
Link copied to clipboard
open val errorTag: String
Link copied to clipboard
open val infoTag: String
Link copied to clipboard
open val name: String

Functions

Link copied to clipboard
open fun buildMessage(message: String): String

This method is called before passing the message to application logger. It can be overridden to modify the pattern of the logged message. By default, it will prepend the logger name and a dash to the original message.

Link copied to clipboard
inline fun debug(message: () -> String)
inline fun debug(cause: Throwable, message: () -> String)

Logs a message on the debug level.

Link copied to clipboard
inline fun error(message: () -> String)
inline fun error(cause: Throwable, message: () -> String)

Logs a message on the error level.

Link copied to clipboard
inline fun info(message: () -> String)
inline fun info(cause: Throwable, message: () -> String)

Logs a message on the info level.

Link copied to clipboard
inline operator fun invoke(message: () -> String)
inline operator fun invoke(cause: Throwable, message: () -> String)

Logs a message on the info level.