Logger

class Logger(source)

Logs things to installed Log implementation(s) at Root.

NOTE: Logs containing no data are ignored by all Log instances.

e.g.

myLogger.wtf(t = null, msg = null)       // Ignored
myLogger.wtf(t = null, msg = "")         // Ignored
myLogger.wtf(msg = "")                   // Ignored
myLogger.wtf { null }                    // Ignored
myLogger.wtf { "" }                      // Ignored
myLogger.wtf(t = null) { null }          // Ignored
myLogger.wtf(t = null) { "" }            // Ignored
myLogger.wtf {
    "This will be logged by all installed Log instances"
    " and then abort (if Log.AbortHandler is installed)."
}

See also

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
@JvmField
val domain: String?

A well-defined domain (e.g. kmp-log:log), or null. Log implementations may use this for filtering purposes.

Link copied to clipboard
@JvmField
val tag: String

A well-defined tag, such as a class name.

Functions

Link copied to clipboard
@JvmName(name = "-d")
inline fun d(lazyMsg: () -> Any?): Int
@JvmName(name = "-d")
inline fun d(t: Throwable?, lazyMsg: () -> Any?): Int

Send a Level.Debug log message to all Log instances installed at Root. If no Log instances are installed, or none will accept it, then nothing is logged and lazyMsg will not be invoked.

inline fun d(msg: String): Int
inline fun d(t: Throwable): Int

Send a Level.Debug log message to all Log instances installed at Root.

inline fun d(t: Throwable?, msg: String?): Int

Send a Level.Debug log message to all Log instances installed at Root. If no Log instances are installed, or none will accept it, then nothing is logged.

Link copied to clipboard
inline fun Log.Logger.d(t: Throwable?, format: String?, arg: Any?): Int

Send a Level.Debug log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg to format.

inline fun Log.Logger.d(t: Throwable?, format: String?, arg1: Any?, arg2: Any?): Int

Send a Level.Debug log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg1 and arg2 to format.

Link copied to clipboard
@JvmName(name = "-e")
inline fun e(lazyMsg: () -> Any?): Int
@JvmName(name = "-e")
inline fun e(t: Throwable?, lazyMsg: () -> Any?): Int

Send a Level.Error log message to all Log instances installed at Root. If no Log instances are installed, or none will accept it, then nothing is logged and lazyMsg will not be invoked.

inline fun e(msg: String): Int
inline fun e(t: Throwable): Int
inline fun e(t: Throwable?, msg: String?): Int

Send a Level.Error log message to all Log instances installed at Root.

Link copied to clipboard
inline fun Log.Logger.e(t: Throwable?, format: String?, arg: Any?): Int

Send a Level.Error log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg to format.

inline fun Log.Logger.e(t: Throwable?, format: String?, arg1: Any?, arg2: Any?): Int

Send a Level.Error log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg1 and arg2 to format.

Link copied to clipboard
@JvmName(name = "-i")
inline fun i(lazyMsg: () -> Any?): Int
@JvmName(name = "-i")
inline fun i(t: Throwable?, lazyMsg: () -> Any?): Int

Send a Level.Info log message to all Log instances installed at Root. If no Log instances are installed, or none will accept it, then nothing is logged and lazyMsg will not be invoked.

inline fun i(msg: String): Int
inline fun i(t: Throwable): Int
inline fun i(t: Throwable?, msg: String?): Int

Send a Level.Info log message to all Log instances installed at Root.

Link copied to clipboard
inline fun Log.Logger.i(t: Throwable?, format: String?, arg: Any?): Int

Send a Level.Info log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg to format.

inline fun Log.Logger.i(t: Throwable?, format: String?, arg1: Any?, arg2: Any?): Int

Send a Level.Info log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg1 and arg2 to format.

Link copied to clipboard
fun isLoggable(level: Log.Level): Boolean

Checks if any Log instances installed at Root will accept a log at the provided Level from this Logger instance.

Link copied to clipboard
@JvmName(name = "-log")
inline fun log(level: Log.Level, lazyMsg: () -> Any?): Int
@JvmName(name = "-log")
inline fun log(level: Log.Level, t: Throwable?, lazyMsg: () -> Any?): Int

Send a log message for specified Level to all Log instances installed at Root. If no Log instances are installed, or none will accept it, then nothing is logged and lazyMsg will not be invoked.

inline fun log(level: Log.Level, msg: String): Int
inline fun log(level: Log.Level, t: Throwable): Int
fun log(level: Log.Level, t: Throwable?, msg: String?): Int

Send a log message for specified Level to all Log instances installed at Root.

Link copied to clipboard
fun Log.Logger.log(level: Log.Level, arguments: Array<out Any?>, t: Throwable?, format: String?): Int

Send a log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arguments to format.

fun Log.Logger.log(level: Log.Level, t: Throwable?, format: String?, arg: Any?): Int

Send a log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg to format.

fun Log.Logger.log(level: Log.Level, t: Throwable?, format: String?, arg1: Any?, arg2: Any?): Int

Send a log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg1 and arg2 to format.

Link copied to clipboard
@JvmName(name = "-v")
inline fun v(lazyMsg: () -> Any?): Int
@JvmName(name = "-v")
inline fun v(t: Throwable?, lazyMsg: () -> Any?): Int

Send a Level.Verbose log message to all Log instances installed at Root. If no Log instances are installed, or none will accept it, then nothing is logged and lazyMsg will not be invoked.

inline fun v(msg: String): Int
inline fun v(t: Throwable): Int
inline fun v(t: Throwable?, msg: String?): Int

Send a Level.Verbose log message to all Log instances installed at Root.

Link copied to clipboard
inline fun Log.Logger.v(t: Throwable?, format: String?, arg: Any?): Int

Send a Level.Verbose log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg to format.

inline fun Log.Logger.v(t: Throwable?, format: String?, arg1: Any?, arg2: Any?): Int

Send a Level.Verbose log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg1 and arg2 to format.

Link copied to clipboard
@JvmName(name = "-w")
inline fun w(lazyMsg: () -> Any?): Int
@JvmName(name = "-w")
inline fun w(t: Throwable?, lazyMsg: () -> Any?): Int

Send a Level.Warn log message to all Log instances installed at Root. If no Log instances are installed, or none will accept it, then nothing is logged and lazyMsg will not be invoked.

inline fun w(msg: String): Int
inline fun w(t: Throwable): Int
inline fun w(t: Throwable?, msg: String?): Int

Send a Level.Warn log message to all Log instances installed at Root.

Link copied to clipboard
inline fun Log.Logger.w(t: Throwable?, format: String?, arg: Any?): Int

Send a Level.Warn log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg to format.

inline fun Log.Logger.w(t: Throwable?, format: String?, arg1: Any?, arg2: Any?): Int

Send a Level.Warn log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg1 and arg2 to format.

Link copied to clipboard
@JvmName(name = "-wtf")
inline fun wtf(lazyMsg: () -> Any?): Int
@JvmName(name = "-wtf")
inline fun wtf(t: Throwable?, lazyMsg: () -> Any?): Int

Send a Level.Fatal log message to all Log instances installed at Root. If no Log instances are installed, or none will accept it, then nothing is logged and lazyMsg will not be invoked.

inline fun wtf(msg: String): Int
inline fun wtf(t: Throwable): Int
inline fun wtf(t: Throwable?, msg: String?): Int

Send a Level.Fatal log message to all Log instances installed at Root.

Link copied to clipboard
inline fun Log.Logger.wtf(t: Throwable?, format: String?, arg: Any?): Int

Send a Level.Fatal log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg to format.

inline fun Log.Logger.wtf(t: Throwable?, format: String?, arg1: Any?, arg2: Any?): Int

Send a Level.Fatal log message to all Log instances installed at Log.Root. If no Log instances are installed, or none will accept it, then nothing is logged and Formatter.format will not be called to apply arg1 and arg2 to format.