Documentation ¶
Overview ¶
Package logger offers an fx module that utilizes slog for logging.
Provides:
- Logger (type: *slog.Logger, name: "logger")
Depends on:
- Output, optional (type: io.Writer, name: "logger_output", default: os.Stdout)
You can configure it using these environment variables:
- LOG_LEVEL
- LOG_FORMAT
The valid log levels:
- debug
- info (default)
- warn
- error
The valid log formats:
- text (default)
- json
Index ¶
Constants ¶
View Source
const ( FormatText = "text" FormatJSON = "json" )
Log formats.
View Source
const ( LevelDebug = "debug" LevelInfo = "info" LevelWarn = "warn" LevelError = "error" )
Log levels.
Variables ¶
View Source
var ( ErrInvalidFormat = errors.New("invalid format") ErrInvalidLevel = errors.New("invalid level") )
Errors.
View Source
var Module = fx.Module( "logger", fx.Provide( New, ), fx.Provide( fx.Private, parseConfig, ), )
Module is the logger module.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.