Documentation
¶
Index ¶
- func Close()
- func ContextWithLogger(ctx context.Context, l *zap.Logger) context.Context
- func Debug(msg string, args ...any)
- func Error(msg string, args ...any)
- func Fatal(msg string, args ...any)
- func FromContext(ctx context.Context) *zap.Logger
- func GetGlobalLogger() *zap.Logger
- func Info(msg string, args ...any)
- func Init(cfg Config)
- func L(ctx context.Context) *zap.Logger
- func NewLogger(cfg Config) (*zap.Logger, error)
- func NopContext() context.Context
- func Sugar(ctx context.Context) *zap.SugaredLogger
- func Sync() error
- func TestContext() (context.Context, *observer.ObservedLogs)
- func TestLogger() (*zap.Logger, *observer.ObservedLogs)
- func Warn(msg string, args ...any)
- func With(ctx context.Context, fields ...zap.Field) context.Context
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithLogger ¶
ContextWithLogger attaches a logger to the context
func FromContext ¶
FromContext retrieves the logger from context Falls back to global logger during migration period
func GetGlobalLogger ¶
GetGlobalLogger returns the global logger instance Useful for services that need to store a logger reference
func NopContext ¶
NopContext creates a context with a no-op logger (for benchmarks or when logs are not needed)
func Sugar ¶
func Sugar(ctx context.Context) *zap.SugaredLogger
Sugar returns a sugared logger from context
func TestContext ¶
func TestContext() (context.Context, *observer.ObservedLogs)
TestContext creates a context with a test logger Returns both the context and the observed logs for assertions
func TestLogger ¶
func TestLogger() (*zap.Logger, *observer.ObservedLogs)
TestLogger creates a logger that captures logs for assertions The returned ObservedLogs can be used to verify log messages in tests
Types ¶
Click to show internal directories.
Click to hide internal directories.