Skip to content

Commit 55fc4c2

Browse files
authored
Log to console when in command mode (#2167)
Quick results. Avoid overwriting the log file in use, by the same config most of the time.
1 parent baee50f commit 55fc4c2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dnscrypt-proxy/config.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,10 @@ func ConfigLoad(proxy *Proxy, flags *ConfigFlags) error {
346346
dlog.SetLogLevel(dlog.SeverityInfo)
347347
}
348348
dlog.TruncateLogFile(config.LogFileLatest)
349-
if config.UseSyslog {
349+
proxy.showCerts = *flags.ShowCerts || len(os.Getenv("SHOW_CERTS")) > 0
350+
isCommandMode := *flags.Check || proxy.showCerts || *flags.List || *flags.ListAll
351+
if isCommandMode {
352+
} else if config.UseSyslog {
350353
dlog.UseSyslog(true)
351354
} else if config.LogFile != nil {
352355
dlog.UseLogFile(*config.LogFile)
@@ -697,8 +700,7 @@ func ConfigLoad(proxy *Proxy, flags *ConfigFlags) error {
697700
} else if len(config.BootstrapResolvers) > 0 {
698701
netprobeAddress = config.BootstrapResolvers[0]
699702
}
700-
proxy.showCerts = *flags.ShowCerts || len(os.Getenv("SHOW_CERTS")) > 0
701-
if !*flags.Check && !*flags.ShowCerts && !*flags.List && !*flags.ListAll {
703+
if !isCommandMode {
702704
if err := NetProbe(proxy, netprobeAddress, netprobeTimeout); err != nil {
703705
return err
704706
}

0 commit comments

Comments
 (0)