fs: fix --use-json-log and -vv after config reorganization
This commit is contained in:
parent
04f35fc3ac
commit
b3edc9d360
2 changed files with 27 additions and 0 deletions
|
@ -323,4 +323,25 @@ func TestEnvironmentVariables(t *testing.T) {
|
|||
assert.NotContains(t, out, "fileB1.txt")
|
||||
}
|
||||
|
||||
// Test --use-json-log and -vv combinations
|
||||
jsonLogOK := func() {
|
||||
t.Helper()
|
||||
if assert.NoError(t, err) {
|
||||
assert.Contains(t, out, `{"level":"debug",`)
|
||||
assert.Contains(t, out, `"msg":"Version `)
|
||||
assert.Contains(t, out, `"}`)
|
||||
}
|
||||
}
|
||||
env = "RCLONE_USE_JSON_LOG=1;RCLONE_LOG_LEVEL=DEBUG"
|
||||
out, err = rcloneEnv(env, "version")
|
||||
jsonLogOK()
|
||||
env = "RCLONE_USE_JSON_LOG=1"
|
||||
out, err = rcloneEnv(env, "version", "-vv")
|
||||
jsonLogOK()
|
||||
env = "RCLONE_LOG_LEVEL=DEBUG"
|
||||
out, err = rcloneEnv(env, "version", "--use-json-log")
|
||||
jsonLogOK()
|
||||
env = ""
|
||||
out, err = rcloneEnv(env, "version", "-vv", "--use-json-log")
|
||||
jsonLogOK()
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package configflags
|
|||
|
||||
// Options set by command line flags
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
|
@ -202,6 +203,11 @@ func SetFlags(ci *fs.ConfigInfo) {
|
|||
// Process --multi-thread-streams - set whether multi-thread-streams was set
|
||||
multiThreadStreamsFlag := pflag.Lookup("multi-thread-streams")
|
||||
ci.MultiThreadSet = multiThreadStreamsFlag != nil && multiThreadStreamsFlag.Changed
|
||||
|
||||
// Reload any changes
|
||||
if err := ci.Reload(context.Background()); err != nil {
|
||||
log.Fatalf("Failed to reload config changes: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// parseHeaders converts DSCP names to value
|
||||
|
|
Loading…
Reference in a new issue