Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(msg string, args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(msg string, args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(msg string, args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Info(msg string, args ...interface{})
- func Infof(template string, args ...interface{})
- func InitLogger(c *LoggerConfig) error
- func LogSkip(ctx context.Context, logger *slog.Logger, level slog.Level, skip int, ...)
- func Panic(msg string, args ...interface{})
- func Panicf(template string, args ...interface{})
- func ParseLogLevel(level string) (slog.Level, error)
- func Printf(template string, args ...interface{})
- func Println(msg string)
- func ReplaceAttrTrimSource(groups []string, a slog.Attr) slog.Attr
- func TrimSource(source string, parts int) string
- func Warn(msg string, args ...interface{})
- func Warnf(template string, args ...interface{})
- type LoggerConfig
- type Wrapper
Constants ¶
View Source
const ( EncodingText = "text" EncodingJSON = "json" )
Variables ¶
View Source
var ( // Sane default logger setup Logger = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{ AddSource: false, Level: slog.LevelInfo, })) ErrUnknownLogLevel = errors.New("unknown log level") ErrUnknownLogEncoding = errors.New("unknown log encoding") )
Defaults
Functions ¶
func InitLogger ¶
func InitLogger(c *LoggerConfig) error
InitLogger loads a global logger based on a configuration
func ParseLogLevel ¶
ParseLogLevel is used to parse configuration options into a log level.
func ReplaceAttrTrimSource ¶ added in v1.0.4
func TrimSource ¶
Types ¶
type LoggerConfig ¶
Click to show internal directories.
Click to hide internal directories.