All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.de.halfbit.logger.Logger.kt Maven / Gradle / Ivy

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,
    )




© 2015 - 2024 Weber Informatics LLC | Privacy Policy