Save logs to network specific directories.

Fixes #114.
This commit is contained in:
Josh Rickmar 2014-07-30 12:17:19 -05:00
parent 248ea9c08f
commit dd856160aa

View file

@ -313,12 +313,15 @@ func loadConfig() (*config, []string, error) {
} }
} }
// Choose the active network params based on the selected network.
// Multiple networks can't be selected simultaneously. // Multiple networks can't be selected simultaneously.
numNets := 0 numNets := 0
if cfg.MainNet { if cfg.MainNet {
activeNet = &mainNetParams
numNets++ numNets++
} }
if cfg.SimNet { if cfg.SimNet {
activeNet = &simNetParams
numNets++ numNets++
} }
if numNets > 1 { if numNets > 1 {
@ -330,13 +333,10 @@ func loadConfig() (*config, []string, error) {
return nil, nil, err return nil, nil, err
} }
// Choose the active network params based on the selected network. // Append the network type to the log directory so it is "namespaced"
switch { // per network.
case cfg.MainNet: cfg.LogDir = cleanAndExpandPath(cfg.LogDir)
activeNet = &mainNetParams cfg.LogDir = filepath.Join(cfg.LogDir, activeNet.Params.Name)
case cfg.SimNet:
activeNet = &simNetParams
}
// Special show command to list supported subsystems and exit. // Special show command to list supported subsystems and exit.
if cfg.DebugLevel == "show" { if cfg.DebugLevel == "show" {