Logging: structured slog messages throughout, and WithLogger options so callers choose the logger
Log messages are lower-case event names with their details as key/value
attributes ("error" for errors), in place of formatted strings.
Loggable package take a WithLogger option as part of their "New*" call,
defaulting to slog.Default(). Each tags its lines with its `component`.
Some debug loggers print directly rather than using slog when in
terminal logging mode.
This commit is contained in:
1 parent
0b5fde9563
commit
043e307663
49 files changed
+598
-248
No files matched your search
@@ -70,11 +70,11 @@ func LoadFromViper(conf *JobSearchConfig) {
|
||||
}
|
||||
value, ok := viperValue(key, keyType)
|
||||
if !ok {
|
||||
slog.Error(fmt.Sprintf("unknown key type: %s", keyType))
|
||||
slog.Error("unknown config key type", "key", key, "kind", keyType.String())
|
||||
continue
|
||||
}
|
||||
if err := conf.SetValue(key, value); err != nil {
|
||||
slog.Warn("ignoring invalid config value", "key", key, "err", err)
|
||||
slog.Warn("ignoring invalid config value", "key", key, "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user