logger

package module
v0.0.0-...-da3cc26 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 1 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	Open(map[string]any) (Logger, error)
}

Driver logger driver

type Level

type Level interface {
	Enable(level Level) bool
}

type Logger

type Logger interface {
	// WithLevel returns a new logger with level.
	WithLevel(level Level) Logger
	// WithContext returns a new logger with context.
	WithContext(ctx context.Context) Logger
	// Debug logs a message at debug level.
	Debug(message string)
	// Debugf logs a formatted message at debug level.
	Debugf(format string, args ...any)
	// Info logs a message at info level.
	Info(message string)
	// Infof logs a formatted message at info level.
	Infof(format string, args ...any)
	// Warn logs a message at warn level.
	Warn(message string)
	// Warnf logs a formatted message at warn level.
	Warnf(format string, args ...any)
	// Error logs a message at exception level.
	Error(message string)
	// Errorf logs a formatted message at exception level
	Errorf(format string, args ...any)
	// Panic logs a message at panic level
	Panic(message string)
	// Panicf logs a formatted message at panic level
	Panicf(format string, args ...any)
	// Fatal logs a message at fatal level
	Fatal(message string)
	// Fatalf logs a formatted message at fatal level
	Fatalf(format string, args ...any)
}

Logger logger interface

type LoggerManager

type LoggerManager interface {
	Logger
	// SetDefault sets the default channel name.
	SetDefault(name string)
	// HasChannel returns true if the channel with the given name exists.
	HasChannel(name string) bool
	// SetChannel sets the channel with the given name.
	SetChannel(name string, channel Logger)
	// GetChannel returns the channel with the given name.
	GetChannel(name string) Logger
	// GetChannels returns all channels.
	GetChannels() map[string]Logger
	// RemoveChannel removes the channel with the given name.
	RemoveChannel(name string)
	// GetChannelBundle returns a bundle of channels.
	GetChannelBundle(names ...string) Logger
}

LoggerManager is a logger manager and also a logger itself.

Jump to

Keyboard shortcuts

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