Documentation
¶
Index ¶
- Constants
- func AWSReplaceAttr(groups []string, a slog.Attr) slog.Attr
- func Critical(ctx context.Context, msg string, args ...any)
- func Debug(ctx context.Context, msg string, args ...any)
- func Error(ctx context.Context, msg string, args ...any)
- func Fatal(ctx context.Context, msg string, args ...any)
- func GCPReplaceAttr(groups []string, a slog.Attr) slog.Attr
- func Info(ctx context.Context, msg string, args ...any)
- func ReplaceAttr(groups []string, a slog.Attr) slog.Attr
- func SetOutput(out io.Writer)
- func Warn(ctx context.Context, msg string, args ...any)
- func WithValue(parent context.Context, key string, val any) context.Context
- type Handler
- type HandlerOptions
- type LogFormat
- type Logger
- func (l *Logger) Critical(ctx context.Context, msg string, args ...any)
- func (l *Logger) Debug(ctx context.Context, msg string, args ...any)
- func (l *Logger) Error(ctx context.Context, msg string, args ...any)
- func (l *Logger) Fatal(ctx context.Context, msg string, args ...any)
- func (l *Logger) GetHandler() slog.Handler
- func (l *Logger) Info(ctx context.Context, msg string, args ...any)
- func (l *Logger) LogAttrs(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr)
- func (l *Logger) Warn(ctx context.Context, msg string, args ...any)
Constants ¶
View Source
const (
LevelCritical slog.Level = 16
)
View Source
const LevelFatal slog.Level = 16
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HandlerOptions ¶ added in v0.0.3
type HandlerOptions struct {
AddSource bool // add calling file and line to logs
Level slog.Level // log level, default is Info
ReplaceAttr func(groups []string, a slog.Attr) slog.Attr // function to replace attributes
TimeFormat string // time format, default is RFC3339
Format LogFormat // log format, default is Text for readability
EnableAWS bool // enable AWS specific logging
EnableGCP bool // enable GCP specific logging
}
type Logger ¶ added in v0.1.0
type Logger struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts *HandlerOptions) *Logger
func NewWithHandler ¶ added in v0.0.3
func (*Logger) GetHandler ¶ added in v0.1.0
Click to show internal directories.
Click to hide internal directories.