1
0
mirror of https://github.com/offen/docker-volume-backup.git synced 2025-11-23 21:44:40 +02:00

Print context in log field instead of prepending to message (#260)

* Print context in log field instead of prepending to message

* Log messages on pruning do not need a description anymore

* Remove redundant information from logs and errors
This commit is contained in:
Frederik Ring
2023-08-25 12:44:43 +02:00
committed by GitHub
parent 88a4794083
commit 3d7677f02a
8 changed files with 43 additions and 39 deletions

View File

@@ -126,11 +126,11 @@ func newScript() (*script, error) {
logFunc := func(logType storage.LogLevel, context string, msg string, params ...any) {
switch logType {
case storage.LogLevelWarning:
s.logger.Warn(fmt.Sprintf("["+context+"] "+msg, params...))
s.logger.Warn(fmt.Sprintf(msg, params...), "storage", context)
case storage.LogLevelError:
s.logger.Error(fmt.Sprintf("["+context+"] "+msg, params...))
s.logger.Error(fmt.Sprintf(msg, params...), "storage", context)
default:
s.logger.Info(fmt.Sprintf("["+context+"] "+msg, params...))
s.logger.Info(fmt.Sprintf(msg, params...), "storage", context)
}
}