commonMain.de.halfbit.logger.Logger.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of logger-jvm Show documentation
Show all versions of logger-jvm Show documentation
Minimalistic, fast and configurable Logger for Kotlin Multiplatform
The newest version!
/** Copyright 2024 Halfbit GmbH, Sergej Shafarenka */
package de.halfbit.logger
import de.halfbit.logger.sink.LogPrinter
import de.halfbit.logger.sink.LogSink
import de.halfbit.logger.sink.println.PrintlnSink
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
@PublishedApi
internal var currentLogger: Logger = createInitialLogger()
@PublishedApi
internal data class Logger(
val sinks: List,
val loggableLevel: LoggableLevel,
val getClockNow: () -> Instant,
val initialized: Boolean,
)
internal fun createInitialLogger(): Logger =
Logger(
sinks = listOf(PrintlnSink(LogPrinter.Default)),
loggableLevel = LoggableLevel.Everything,
getClockNow = Clock.System::now,
initialized = false,
)