mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
fs: refactor log statements to use common helper
This commit is contained in:
parent
604d6bcb9c
commit
dfc2c98bbf
16
fs/log.go
16
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
|
// Errorf writes error log output for this Object or Fs. It
|
||||||
// should always be seen by the user.
|
// should always be seen by the user.
|
||||||
func Errorf(o interface{}, text string, args ...interface{}) {
|
func Errorf(o interface{}, text string, args ...interface{}) {
|
||||||
if GetConfig(context.TODO()).LogLevel >= LogLevelError {
|
LogLevelPrintf(LogLevelError, o, text, args...)
|
||||||
LogPrintf(LogLevelError, o, text, args...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logf writes log output for this Object or Fs. This should be
|
// 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
|
// important things the user should see. The user can filter these
|
||||||
// out with the -q flag.
|
// out with the -q flag.
|
||||||
func Logf(o interface{}, text string, args ...interface{}) {
|
func Logf(o interface{}, text string, args ...interface{}) {
|
||||||
if GetConfig(context.TODO()).LogLevel >= LogLevelNotice {
|
LogLevelPrintf(LogLevelNotice, o, text, args...)
|
||||||
LogPrintf(LogLevelNotice, o, text, args...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Infof writes info on transfers for this Object or Fs. Use this
|
// Infof writes info on transfers for this Object or Fs. Use this
|
||||||
// level for logging transfers, deletions and things which should
|
// level for logging transfers, deletions and things which should
|
||||||
// appear with the -v flag.
|
// appear with the -v flag.
|
||||||
func Infof(o interface{}, text string, args ...interface{}) {
|
func Infof(o interface{}, text string, args ...interface{}) {
|
||||||
if GetConfig(context.TODO()).LogLevel >= LogLevelInfo {
|
LogLevelPrintf(LogLevelInfo, o, text, args...)
|
||||||
LogPrintf(LogLevelInfo, o, text, args...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debugf writes debugging output for this Object or Fs. Use this for
|
// Debugf writes debugging output for this Object or Fs. Use this for
|
||||||
// debug only. The user must have to specify -vv to see this.
|
// debug only. The user must have to specify -vv to see this.
|
||||||
func Debugf(o interface{}, text string, args ...interface{}) {
|
func Debugf(o interface{}, text string, args ...interface{}) {
|
||||||
if GetConfig(context.TODO()).LogLevel >= LogLevelDebug {
|
LogLevelPrintf(LogLevelDebug, o, text, args...)
|
||||||
LogPrintf(LogLevelDebug, o, text, args...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogDirName returns an object for the logger, logging a root
|
// LogDirName returns an object for the logger, logging a root
|
||||||
|
|
Loading…
Reference in New Issue
Block a user