KmModuleLog

class KmModuleLog(val log: KmLog, val isModuleLogging: () -> Boolean)

Wrapper for KmLog that allows library modules to also use KmLogging and be able to enable or disable its logging independently of the application that is also using KmLogging.

Example usage with code implemented in ChartsLogging.kt

object ChartsLogging {
var enabled = true
}

fun moduleLogging(tag: String? = null): KmModuleLog {
// string passed into createTag should be the name of the class that this function is implemented in
// if it is a top level function then the class name is the file name with Kt appended
val t = tag ?: KmLogging.createTag("ChartsLoggingKt").first
return KmModuleLog(logging(t), ChartsLogging::enabled)
}

Constructors

Link copied to clipboard
constructor(log: KmLog, isModuleLogging: () -> Boolean)

Properties

Link copied to clipboard
Link copied to clipboard
val log: KmLog

Functions

Link copied to clipboard
inline fun d(msg: () -> Any?)
inline fun d(tag: String, msg: () -> Any?)
Link copied to clipboard
inline fun e(msg: () -> Any?)
inline fun e(err: Throwable?, tag: String? = null, msg: () -> Any?)
Link copied to clipboard
inline fun i(msg: () -> Any?)
inline fun i(tag: String, msg: () -> Any?)
Link copied to clipboard
inline fun v(msg: () -> Any?)
inline fun v(tag: String, msg: () -> Any?)
Link copied to clipboard
inline fun w(msg: () -> Any?)
inline fun w(err: Throwable?, tag: String? = null, msg: () -> Any?)