Documentation
¶
Overview ¶
Package logging provides a unified logging interface using zap
Package logging provides a unified logging interface using zap ¶
Package logging provides a unified logging interface
Index ¶
- Constants
- func FromAppConfig(appName, logLevel string, debug bool) *config.Config
- type Config
- type Factory
- type FxEventLogger
- type LogField
- func Any(key string, value any) LogField
- func AnyField(key string, value any) LogField
- func Bool(key string, value bool) LogField
- func BoolField(key string, value bool) LogField
- func Duration(key string, value time.Duration) LogField
- func DurationField(key string, value time.Duration) LogField
- func Error(err error) LogField
- func ErrorField(key string, err error) LogField
- func Int(key string, value int) LogField
- func Int64(key string, value int64) LogField
- func IntField(key string, value int) LogField
- func String(key, value string) LogField
- func StringField(key, value string) LogField
- func Uint(key string, value uint) LogField
- func UintField(key string, value uint) LogField
- type Logger
- type ZapLogger
- func (l *ZapLogger) Debug(msg string, fields ...any)
- func (l *ZapLogger) Error(msg string, fields ...any)
- func (l *ZapLogger) Fatal(msg string, fields ...any)
- func (l *ZapLogger) GetZapLogger() *zap.Logger
- func (l *ZapLogger) Info(msg string, fields ...any)
- func (l *ZapLogger) Warn(msg string, fields ...any)
- func (l *ZapLogger) With(fields ...any) Logger
Constants ¶
const ( // LogEncodingConsole represents console encoding for logs LogEncodingConsole = "console" // LogEncodingJSON represents JSON encoding for logs LogEncodingJSON = "json" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory creates loggers based on configuration
func (*Factory) AuthLogger ¶
AuthLogger returns the shared logger for auth middleware
func (*Factory) CookieAuthLogger ¶
CookieAuthLogger returns the shared logger for cookie auth middleware
func (*Factory) CreateFromConfig ¶
CreateFromConfig creates a logger based on the provided configuration
func (*Factory) CreateLogger ¶
CreateLogger creates a logger with default configuration
func (*Factory) CreateTestLogger ¶
CreateTestLogger creates a logger for testing
type FxEventLogger ¶
type FxEventLogger struct {
Logger Logger
}
FxEventLogger implements fxevent.Logger interface using our Logger
func (*FxEventLogger) LogEvent ¶
func (l *FxEventLogger) LogEvent(event fxevent.Event)
LogEvent logs fx lifecycle events
type LogField ¶
LogField represents a field in a log entry
func DurationField ¶
DurationField creates a duration field
type Logger ¶
Logger extends the common.Logger interface with additional functionality
func NewNoopLogger ¶
func NewNoopLogger() Logger
func NewTestLogger ¶
func NewZapLogger ¶
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
ZapLogger implements the Logger interface using zap
func (*ZapLogger) GetZapLogger ¶
GetZapLogger returns the underlying zap logger