Documentation
¶
Overview ¶
global logger is deprecated
Index ¶
- Constants
- func Debug(msg string, args ...any)
- func DebugContext(ctx context.Context, msg string, args ...any)
- func Debugf(format string, args ...any)deprecated
- func Err(err error) slog.Attr
- func Error(msg string, args ...any)
- func ErrorContext(ctx context.Context, msg string, args ...any)
- func Errorf(format string, args ...any)deprecated
- func Fatal(msg string, args ...any)
- func FatalContext(ctx context.Context, msg string, args ...any)
- func Fatalf(format string, args ...any)deprecated
- func Info(msg string, args ...any)
- func InfoContext(ctx context.Context, msg string, args ...any)
- func Infof(format string, args ...any)deprecated
- func Log(ctx context.Context, level Level, msg string, args ...any)
- func LogAttrs(ctx context.Context, level Level, msg string, attrs ...slog.Attr)
- func Logf(ctx context.Context, level Level, format string, args ...any)deprecated
- func RawJSON(key, text string) slog.Attr
- func RawYAML(key, text string) slog.Attr
- func SetDefault(l *Logger)
- func SetDefaultLevel(l Level)
- func Type(key string, t any) slog.Attr
- func Warn(msg string, args ...any)
- func WarnContext(ctx context.Context, msg string, args ...any)
- func Warnf(format string, args ...any)deprecated
- type AddSourceVar
- type Handler
- type HandlerType
- type Level
- type LogOutput
- type Logger
- func (l *Logger) Debugf(format string, args ...any)deprecated
- func (l *Logger) Error(msg string, args ...any)
- func (l *Logger) Errorf(format string, args ...any)deprecated
- func (l *Logger) Fatal(msg string, args ...any)
- func (l *Logger) Fatalf(format string, args ...any)deprecated
- func (l *Logger) GetLevel() Level
- func (l *Logger) Infof(format string, args ...any)deprecated
- func (l *Logger) Logf(ctx context.Context, level Level, format string, args ...any)deprecated
- func (l *Logger) Named(name string) *Logger
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) Warnf(format string, args ...any)deprecated
- func (l *Logger) With(args ...any) *Logger
- func (l *Logger) WithGroup(name string) *Logger
- type Options
- type Raw
- type Render
- type SlogJsonHandler
- func (h *SlogJsonHandler) Handle(ctx context.Context, r slog.Record) error
- func (h *SlogJsonHandler) Named(name string) slog.Handler
- func (h *SlogJsonHandler) SetOutput(w io.Writer)
- func (h *SlogJsonHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *SlogJsonHandler) WithGroup(name string) slog.Handler
- type SlogTextHandler
- func (h *SlogTextHandler) Handle(ctx context.Context, r slog.Record) error
- func (h *SlogTextHandler) Named(name string) slog.Handler
- func (h *SlogTextHandler) SetOutput(w io.Writer)
- func (h *SlogTextHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *SlogTextHandler) WithGroup(name string) slog.Handler
Constants ¶
View Source
const ( LoggerNameKey = "logger" StacktraceKey = "stacktrace" )
View Source
const KeyComponent = "component"
Variables ¶
This section is empty.
Functions ¶
func SetDefault ¶
func SetDefault(l *Logger)
func SetDefaultLevel ¶
func SetDefaultLevel(l Level)
Types ¶
type AddSourceVar ¶
type AddSourceVar struct {
// contains filtered or unexported fields
}
func (*AddSourceVar) Set ¶
func (v *AddSourceVar) Set(b bool)
func (*AddSourceVar) Source ¶
func (v *AddSourceVar) Source() *bool
func (*AddSourceVar) String ¶
func (v *AddSourceVar) String() string
type HandlerType ¶
type HandlerType int
const ( JSONHandlerType HandlerType = iota TextHandlerType )
type LogOutput ¶
type LogOutput struct { Level string `json:"level"` Name string `json:"logger"` Message string `json:"msg"` Source string `json:"source"` Fields map[string]any `json:"-"` Stacktrace string `json:"stacktrace"` Time string `json:"time"` }
func (*LogOutput) MarshalJSON ¶
type Render ¶
type Render struct {
// contains filtered or unexported fields
}
func (*Render) JSONKeyValue ¶
func (*Render) RawJsonKeyValue ¶
func (*Render) TextKeyValue ¶
func (*Render) TextQuotedKeyValue ¶
type SlogJsonHandler ¶
func NewJSONHandler ¶
func NewJSONHandler(out io.Writer, opts *slog.HandlerOptions, timeFn func(t time.Time) time.Time) *SlogJsonHandler
func NewSlogHandler ¶
func NewSlogHandler(handler slog.Handler) *SlogJsonHandler
func (*SlogJsonHandler) SetOutput ¶
func (h *SlogJsonHandler) SetOutput(w io.Writer)
type SlogTextHandler ¶
func NewSlogTextHandler ¶
func NewSlogTextHandler(handler slog.Handler) *SlogTextHandler
func NewTextHandler ¶
func NewTextHandler(out io.Writer, opts *slog.HandlerOptions, timeFn func(t time.Time) time.Time) *SlogTextHandler
func (*SlogTextHandler) SetOutput ¶
func (h *SlogTextHandler) SetOutput(w io.Writer)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.