summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-01-05 17:25:33 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2023-01-05 18:04:48 +0100
commit5ffd0a395f7ef61b75b6ef4b625e78da7900e249 (patch)
treea85cf3842d7fdf860b9b6f3e5ca04730635a5141 /internal
parent4e4879042a0737463cd3ca00e95d621d410921e4 (diff)
Logger: Do not interpret error string as format specifier argument
Diffstat (limited to 'internal')
-rw-r--r--internal/log/log.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/log/log.go b/internal/log/log.go
index 8b559fb..2fb2444 100644
--- a/internal/log/log.go
+++ b/internal/log/log.go
@@ -113,20 +113,20 @@ func (logger *FileLogger) Init(lvl Level, dir string) error {
// Inheritf logs an error with a message and params using the error level verbosity of the error.
// The message is always prefixed with the error.
-func (logger *FileLogger) Inheritf(err error, msg string, params ...interface{}) {
+func (logger *FileLogger) Inherit(err error, msg string) {
if err == nil {
return
}
- s := err.Error() + msg
+ s := "%s %s"
switch GetErrorLevel(err) {
case ErrInfo:
- logger.Infof(s, params...)
+ logger.Infof(s, err.Error(), msg)
case ErrWarning:
- logger.Warningf(s, params...)
+ logger.Warningf(s, err.Error(), msg)
case ErrOther:
- logger.Errorf(s, params...)
+ logger.Errorf(s, err.Error(), msg)
case ErrFatal:
- logger.Fatalf(s, params...)
+ logger.Fatalf(s, err.Error(), msg)
}
}