From dfc2c98bbfc798a225cf30c6ba9e018309b52960 Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:37:20 +0200 Subject: [PATCH] fs: refactor log statements to use common helper --- fs/log.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/log.go b/fs/log.go index 40ccdbb27..cb30f595b 100644 --- a/fs/log.go +++ b/fs/log.go @@ -157,9 +157,7 @@ func LogLevelPrintf(level LogLevel, o interface{}, text string, args ...interfac // Errorf writes error log output for this Object or Fs. It // should always be seen by the user. func Errorf(o interface{}, text string, args ...interface{}) { - if GetConfig(context.TODO()).LogLevel >= LogLevelError { - LogPrintf(LogLevelError, o, text, args...) - } + LogLevelPrintf(LogLevelError, o, text, args...) } // Logf writes log output for this Object or Fs. This should be @@ -168,26 +166,20 @@ func Errorf(o interface{}, text string, args ...interface{}) { // important things the user should see. The user can filter these // out with the -q flag. func Logf(o interface{}, text string, args ...interface{}) { - if GetConfig(context.TODO()).LogLevel >= LogLevelNotice { - LogPrintf(LogLevelNotice, o, text, args...) - } + LogLevelPrintf(LogLevelNotice, o, text, args...) } // Infof writes info on transfers for this Object or Fs. Use this // level for logging transfers, deletions and things which should // appear with the -v flag. func Infof(o interface{}, text string, args ...interface{}) { - if GetConfig(context.TODO()).LogLevel >= LogLevelInfo { - LogPrintf(LogLevelInfo, o, text, args...) - } + LogLevelPrintf(LogLevelInfo, o, text, args...) } // Debugf writes debugging output for this Object or Fs. Use this for // debug only. The user must have to specify -vv to see this. func Debugf(o interface{}, text string, args ...interface{}) { - if GetConfig(context.TODO()).LogLevel >= LogLevelDebug { - LogPrintf(LogLevelDebug, o, text, args...) - } + LogLevelPrintf(LogLevelDebug, o, text, args...) } // LogDirName returns an object for the logger, logging a root