Documentation
¶
Index ¶
- Variables
- type HandlerOptions
- type Level
- type Logger
- func (l *Logger) Debugf(format string, args ...any)
- func (l *Logger) Debugln(msg string, args ...any)
- func (l *Logger) Errorf(format string, args ...any)
- func (l *Logger) Errorln(msg string, args ...any)
- func (l *Logger) Fatalf(format string, args ...any)
- func (l *Logger) Fatalln(msg string, args ...any)
- func (l *Logger) Infof(format string, args ...any)
- func (l *Logger) Infoln(msg string, args ...any)
- func (l *Logger) Printf(format string, args ...any)
- func (l *Logger) Println(msg string, args ...any)
- func (l *Logger) Warnf(format string, args ...any)
- func (l *Logger) Warnln(msg string, args ...any)
- func (l *Logger) With(args ...any) *Logger
- func (l *Logger) WithGroup(name string) *Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var AllLevels = []Level{LevelDebug, LevelInfo, LevelWarn, LevelError, LevelFatal}
Functions ¶
This section is empty.
Types ¶
type HandlerOptions ¶
type HandlerOptions struct { // AddSource causes the handler to compute the source code position // of the log statement and add a SourceKey attribute to the output. AddSource bool // Level reports the minimum record level that will be logged. // The handler discards records with lower levels. // If Level is nil, the handler assumes LevelInfo. // The handler calls Level.Level for each record processed; // to adjust the minimum level dynamically, use a LevelVar. Level Level }
HandlerOptions are options for a [TextHandler] or [JSONHandler]. A zero HandlerOptions consists entirely of default values.
type Level ¶
type Level int
A Level is the importance or severity of a log event. The higher the level, the more important or severe the event.
type Logger ¶
type Logger struct { slog.HandlerOptions // contains filtered or unexported fields }
func NewJSONHandler ¶
func NewJSONHandler(w io.Writer, opts HandlerOptions) *Logger
func NewTextHandler ¶
func NewTextHandler(w io.Writer, opts HandlerOptions) *Logger
Click to show internal directories.
Click to hide internal directories.