Package io.klogging

Base package containing interfaces and classes of the Klogging public API.

Types

BaseLogger
Link copied to clipboard
common
interface BaseLogger
Base interface of Klogger interface for use in coroutines, and NoCoLogger interface when not using coroutines.
Klogger
Link copied to clipboard
common
interface Klogger : BaseLogger
Logger interface for sending log events from suspend functions running in Kotlin coroutines.
Klogging
Link copied to clipboard
common
interface Klogging
Utility interface that supplies a Klogger property called logger.
Level
Link copied to clipboard
common
enum Level : Enum<Level>
Levels of logging severity: higher ordinal values means greater severity.
NoCoLogger
Link copied to clipboard
common
interface NoCoLogger : BaseLogger
Interface for logging from outside coroutines.
NoCoLogging
Link copied to clipboard
common
interface NoCoLogging
Utility interface that supplies a NoCoLogger property called logger.

Functions

classNameOf
Link copied to clipboard
common
fun classNameOf(ownerClass: KClass<*>): String?
Get the name of a class.
fun classNameOf(ownerClass: KClass<*>): String?
fun classNameOf(ownerClass: KClass<*>): String?
fun classNameOf(ownerClass: KClass<*>): String?
Notes:
  1. The companion class can have a different name than "$Companion"

  2. Kotlin reflection is only supported for JVM, not for JS

eventFrom
Link copied to clipboard
common
internal fun BaseLogger.eventFrom(level: Level, throwable: Throwable?, eventObject: Any?, contextItems: Map<String, Any?> = mapOf()): LogEvent
Extension function on BaseLogger that constructs a LogEvent from a range of types.
logger
Link copied to clipboard
common
fun logger(name: String): Klogger
Returns a Klogger with the specified name.
fun logger(ownerClass: KClass<*>): Klogger
Returns a Klogger with the name of the specified class.
loggerFor
Link copied to clipboard
common
internal fun loggerFor(name: String?): Klogger
Returns a Klogger for the specified name: returning an existing one or creating a new one if needed.
messageAndStackTrace
Link copied to clipboard
common
private fun messageAndStackTrace(obj: Any?, throwable: Throwable?): Pair<String, String?>
Extract message and stack trace values from a non-LogEvent object.
noCoLogger
Link copied to clipboard
common
fun noCoLogger(name: String): NoCoLogger
Returns a NoCoLogger with the specified name.
fun noCoLogger(ownerClass: KClass<*>): NoCoLogger
Returns a NoCoLogger with the name of the specified class.
noCoLoggerFor
Link copied to clipboard
common
internal fun noCoLoggerFor(name: String?): NoCoLogger
Returns a NoCoLogger for the specified name: returning an existing one or creating a new one if needed.

Properties

LOGGERS
Link copied to clipboard
common
private val LOGGERS: MutableMap<String, Klogger>
Runtime list of current Klogger instances.
NOCO_LOGGERS
Link copied to clipboard
common
private val NOCO_LOGGERS: MutableMap<String, NoCoLogger>
Runtime list of current NoCoLogger instances.
syslog
Link copied to clipboard
common
val Level.syslog: Int
Map Levels to syslog levels.