Added a flag for logging to stdout that if set overrides configuration.
This commit is contained in:
parent
d024138593
commit
53bf25364a
@ -16,6 +16,7 @@ import (
|
||||
)
|
||||
|
||||
var configPath *string = flag.String("conf", "config.yaml", "path to configuration file")
|
||||
var logToStdout *bool = flag.Bool("log-stdout", false, "write logs to stdout")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
@ -42,19 +43,23 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
logErr, err := logging.NewLogger(config.Log.Error)
|
||||
if *logToStdout {
|
||||
config.Log.ToStdout = true
|
||||
}
|
||||
|
||||
logErr, err := logging.NewLogger(config.Log.Error, config.Log.ToStdout)
|
||||
if err != nil {
|
||||
log.Fatalln("failed to open error logger:", err)
|
||||
}
|
||||
defer logErr.Close()
|
||||
|
||||
logUpload, err := logging.NewLogger(config.Log.Upload)
|
||||
logUpload, err := logging.NewLogger(config.Log.Upload, config.Log.ToStdout)
|
||||
if err != nil {
|
||||
log.Fatalln("failed to open upload logger:", err)
|
||||
}
|
||||
defer logUpload.Close()
|
||||
|
||||
logDownload, err := logging.NewLogger(config.Log.Download)
|
||||
logDownload, err := logging.NewLogger(config.Log.Download, config.Log.ToStdout)
|
||||
if err != nil {
|
||||
log.Fatalln("failed to open download logger:", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user