From 5e93b1664e4a57aa997b77c6e4a8a90b4c90dd98 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Mon, 12 Sep 2016 02:21:37 -0500 Subject: [PATCH] config: Replace log outputs with fmt.Fprintln. This corrects the case where any errors that might have happened when creating the config file were not being displayed due to the logging system not being initialized yet. While here, consistently use fmt.Fprint{f,ln} throughout the loadConfig function even after the logging system is initialized since it will help prevent copy/paste errors such as the one that induced this change to begin with. --- config.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/config.go b/config.go index fe8bab2c..5a04d8c1 100644 --- a/config.go +++ b/config.go @@ -404,7 +404,8 @@ func loadConfig() (*config, []string, error) { if _, err := os.Stat(preCfg.ConfigFile); os.IsNotExist(err) { err := createDefaultConfigFile(preCfg.ConfigFile) if err != nil { - btcdLog.Warnf("Error creating a default config file: %v", err) + fmt.Fprintf(os.Stderr, "Error creating a "+ + "default config file: %v\n", err) } } @@ -833,8 +834,8 @@ func loadConfig() (*config, []string, error) { if cfg.TorIsolation && (cfg.ProxyUser != "" || cfg.ProxyPass != "") { - btcdLog.Warn("Tor isolation set -- overriding " + - "specified proxy user credentials") + fmt.Fprintln(os.Stderr, "Tor isolation set -- "+ + "overriding specified proxy user credentials") } proxy := &socks.Proxy{ @@ -871,8 +872,9 @@ func loadConfig() (*config, []string, error) { if cfg.TorIsolation && (cfg.OnionProxyUser != "" || cfg.OnionProxyPass != "") { - btcdLog.Warn("Tor isolation set -- overriding " + - "specified onionproxy user credentials ") + fmt.Fprintln(os.Stderr, "Tor isolation set -- "+ + "overriding specified onionproxy user "+ + "credentials ") } cfg.oniondial = func(a, b string) (net.Conn, error) {