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

commonMain.aws.smithy.kotlin.runtime.telemetry.logging.LoggerProvider.kt Maven / Gradle / Ivy

There is a newer version: 1.3.23
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

package aws.smithy.kotlin.runtime.telemetry.logging

/**
 * Entry point for creating [Logger] instances
 */
public interface LoggerProvider {
    public companion object {
        /**
         * A no-op [LoggerProvider] that does nothing
         */
        public val None: LoggerProvider = object : AbstractLoggerProvider() { }
    }

    /**
     * Get a logger by name
     *
     * @param name the name of the logger to get or create
     */
    public fun getOrCreateLogger(name: String): Logger
}

/**
 * Get the logger for the class [T]
 */
public inline fun  LoggerProvider.getLogger(): Logger =
    getOrCreateLogger(requireNotNull(T::class.qualifiedName) { "getLogger cannot be used on an anonymous object" })




© 2015 - 2024 Weber Informatics LLC | Privacy Policy