log

package
v2.0.0-beta9 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, handlers ...Handler) func(conf Config) (zerolog.Logger, error)

New returns a new zerolog.Logger instance. If a provider is provided, it will be used to create the logger. Notice: use context to close the provider and writer.

Types

type Config

type Config struct {
	Output        string        `koanf:"output"`
	Level         string        `koanf:"level"`
	OpenTelemetry OpenTelemetry `koanf:"opentelemetry" mapstructure:",squash"`
	NoGlobal      bool          `koanf:"no_global"`
	NoColor       bool          `koanf:"no_color"`
}

type Handler

type Handler func(opt *option)

func ExtendLocalLogger

func ExtendLocalLogger(fn func(logger zerolog.Logger) zerolog.Logger) Handler

ExtendLocalLogger to extend the local logger instance.

func WithLifecycle

func WithLifecycle(lf lifecycle.Lifecycle) Handler

func WithOtelAttributes

func WithOtelAttributes(attrs ...attribute.KeyValue) Handler

func WithProvider

func WithProvider(provider otellog.LoggerProvider) Handler

WithProvider to force use the given provider.

func WithWriter

func WithWriter(w io.Writer) Handler

WithWriter to force use the given writer.

type OpenTelemetry

type OpenTelemetry struct {
	PackageName string `koanf:"package_name"`
	Endpoint    string `koanf:"endpoint"`
	AuthMethod  string `koanf:"auth_method"`
	AuthToken   string `koanf:"auth_token"`
	AuthHeader  string `koanf:"auth_header"`
	Enabled     bool   `koanf:"enabled"`
}

Jump to

Keyboard shortcuts

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