Documentation ¶
Index ¶
- func Debug(ctx context.Context, format string, values ...any)
- func Error(ctx context.Context, format string, values ...any)
- func Fatal(ctx context.Context, format string, values ...any)
- func Info(ctx context.Context, format string, values ...any)
- func Printf(ctx context.Context, format string, values ...any)
- func Tag(ctx context.Context, name string, value any)
- func Trace(ctx context.Context, format string, values ...any)
- func Warn(ctx context.Context, format string, values ...any)
- func WithContext(ctx context.Context, config LoggerConfig) context.Context
- type Config
- type Level
- type Log
- func (self *Log) Debug(format string, values ...any)
- func (self *Log) Error(format string, values ...any)
- func (self *Log) Fatal(format string, values ...any)
- func (self *Log) Info(format string, values ...any)
- func (self *Log) Localize() any
- func (self *Log) Panic(format string, values ...any)
- func (self *Log) Printf(format string, values ...any)
- func (self *Log) Tag(name string, value any)
- func (self *Log) Trace(format string, values ...any)
- func (self *Log) Warn(format string, values ...any)
- type Logger
- type LoggerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithContext ¶
func WithContext(ctx context.Context, config LoggerConfig) context.Context
WithConfig adds a LoggerConfig to the Context which enables new Loggers to be created. This creates a new Logger from the LoggerConfig and adds it as a local Context value.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) WithOutput ¶ added in v0.0.9
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func DebugLogger ¶ added in v0.0.9
func DebugLogger() *Log
DebugLogger returns a new default logger that logs at debug level.
func DefaultLogger ¶ added in v0.0.9
func DefaultLogger() *Log
DefaultLogger returns a new default logger that logs at info level.
func ErrorLogger ¶ added in v0.0.9
func ErrorLogger() *Log
ErrorLogger returns a new default logger that logs at error level.
func NewLog ¶
func NewLog(config LoggerConfig) *Log
func (*Log) Localize ¶
Localize Log to the next Context. Called in context.Localize(). This will copy all log tags on to the localized Log value. If a fresh Logger is desired, use WithContext() to override.
type Logger ¶
type Logger interface { Tag(name string, value any) Printf(format string, values ...any) Trace(format string, values ...any) Debug(format string, values ...any) Info(format string, values ...any) Warn(format string, values ...any) Error(format string, values ...any) Fatal(format string, values ...any) }
Click to show internal directories.
Click to hide internal directories.