global

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2026 License: Apache-2.0, BSD-3-Clause Imports: 2 Imported by: 454

README

Log Global

PkgGoDev

Documentation

Overview

Package global provides access to a global implementation of the OpenTelemetry Logs API.

This package is experimental. It will be deprecated and removed when the log package becomes stable. Its functionality will be migrated to go.opentelemetry.io/otel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLoggerProvider

func GetLoggerProvider() log.LoggerProvider

GetLoggerProvider returns the globally configured log.LoggerProvider.

If a global LoggerProvider has not been configured with SetLoggerProvider, the returned Logger will be a No-Op implementation of a LoggerProvider. When a global LoggerProvider is registered for the first time, the returned LoggerProvider and all of its created Loggers are updated in-place. There is no need to call this function again for an updated instance.

func Logger

func Logger(name string, options ...log.LoggerOption) log.Logger

Logger returns a log.Logger configured with the provided name and options from the globally configured log.LoggerProvider.

If this is called before a global LoggerProvider is configured, the returned Logger will be a No-Op implementation of a Logger. When a global LoggerProvider is registered for the first time, the returned Logger is updated in-place to report to this new LoggerProvider. There is no need to call this function again for an updated instance.

This is a convenience function. It is equivalent to:

GetLoggerProvider().Logger(name, options...)

func SetLoggerProvider

func SetLoggerProvider(provider log.LoggerProvider)

SetLoggerProvider configures provider as the global log.LoggerProvider.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL