diff --git a/cmd/dwelling-upload/main.go b/cmd/dwelling-upload/main.go index be19c88..fdf8f3c 100644 --- a/cmd/dwelling-upload/main.go +++ b/cmd/dwelling-upload/main.go @@ -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) }