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.
This commit is contained in:
Marco Peereboom 2016-09-12 02:21:37 -05:00 committed by Dave Collins
parent 2ef82e7db3
commit 5e93b1664e

View file

@ -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) {