Remove source info from log messages

slog.HandlerOptions.AddSource is a cool feature, but since we moved the
logger to a separate package it no longer works. It now always shows
source info for the log package, rather than the code that called it.

This change removes it.
This commit is contained in:
Piper Pentagram 2024-11-13 17:02:47 -08:00
parent 1ca6b0b402
commit 9f678b6be7
3 changed files with 2 additions and 6 deletions

View file

@ -3,4 +3,4 @@ log_dir: "log"
log_max_size_mb: 500
log_max_backups: 3
log_max_age_days: 365
log_compression: false
log_compression: false

View file

@ -13,7 +13,6 @@ type AppConfig struct {
LogMaxBackups int `yaml:"log_max_backups"`
LogMaxAgeDays int `yaml:"log_max_age_days"`
LogCompression bool `yaml:"log_compression"`
LogAddSource bool `yaml:"log_add_source"`
}
var config *AppConfig
@ -53,5 +52,4 @@ func setDefaults() {
viper.SetDefault("LogMaxBackups", 3)
viper.SetDefault("LogMaxAgeDays", 365)
viper.SetDefault("LogCompression", false)
viper.SetDefault("LogAddSource", true)
}

View file

@ -29,9 +29,7 @@ func Init() {
logger = Logger{
slog.New(
slog.NewJSONHandler(lj, &slog.HandlerOptions{
AddSource: cfg.LogAddSource,
}),
slog.NewJSONHandler(lj, &slog.HandlerOptions{}),
),
}
}