config: enable verbose logging by the --verbose argument - #5594

This commit is contained in:
Ivan Andreev 2021-10-02 12:50:11 +03:00
parent 8b8a943dd8
commit ffa1b1a258
1 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"net"
"os"
"strconv"
"strings"
"time"
@ -179,6 +180,11 @@ func NewConfig() *ConfigInfo {
if arg == "--log-level=DEBUG" || (arg == "--log-level" && len(os.Args) > argIndex+1 && os.Args[argIndex+1] == "DEBUG") {
c.LogLevel = LogLevelDebug
}
if strings.HasPrefix(arg, "--verbose=") {
if level, err := strconv.Atoi(arg[10:]); err == nil && level >= 2 {
c.LogLevel = LogLevelDebug
}
}
}
envValue, found := os.LookupEnv("RCLONE_LOG_LEVEL")
if found && envValue == "DEBUG" {