Documentation
¶
Overview ¶
Package log provides structured logging for Core applications.
The package works standalone or integrated with the Core framework:
// Standalone usage
log.SetLevel(log.LevelDebug)
log.Info("server started", "port", 8080)
log.Error("failed to connect", "err", err)
// With Core framework
core.New(
framework.WithName("log", log.NewService(log.Options{Level: log.LevelInfo})),
)
Index ¶
- func Debug(msg string, keyvals ...any)
- func Error(msg string, keyvals ...any)
- func Info(msg string, keyvals ...any)
- func NewService(opts Options) func(*framework.Core) (any, error)
- func SetDefault(l *Logger)
- func SetLevel(level Level)
- func Warn(msg string, keyvals ...any)
- type Level
- type Logger
- func (l *Logger) Debug(msg string, keyvals ...any)
- func (l *Logger) Error(msg string, keyvals ...any)
- func (l *Logger) Info(msg string, keyvals ...any)
- func (l *Logger) Level() Level
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) Warn(msg string, keyvals ...any)
- type Options
- type QueryLevel
- type Service
- type TaskSetLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
NewService creates a log service factory for Core.
Types ¶
type Logger ¶
type Logger struct {
// Style functions for formatting (can be overridden)
StyleTimestamp func(string) string
StyleDebug func(string) string
StyleInfo func(string) string
StyleWarn func(string) string
StyleError func(string) string
// contains filtered or unexported fields
}
Logger provides structured logging.
Click to show internal directories.
Click to hide internal directories.