add quiet flag

This commit is contained in:
shoopea 2023-06-29 23:46:53 +02:00
parent f94f9b9f71
commit 89ae6ea612
2 changed files with 8 additions and 4 deletions

View File

@ -13,6 +13,7 @@ var (
cfgFile = flag.String("config", "config.json", "config file") cfgFile = flag.String("config", "config.json", "config file")
isDaemon = flag.Bool("daemon", false, "run as daemon") isDaemon = flag.Bool("daemon", false, "run as daemon")
debug = flag.Bool("debug", false, "log debug messages") debug = flag.Bool("debug", false, "log debug messages")
quiet = flag.Bool("quiet", false, "remove most log messages")
logFile = flag.String("logfile", "", "log file") logFile = flag.String("logfile", "", "log file")
cfg Config cfg Config
email *Email email *Email
@ -26,6 +27,9 @@ func main() {
if *debug { if *debug {
log.SetLevel(log.DebugLevel) log.SetLevel(log.DebugLevel)
} }
if *quiet {
log.SetLevel(log.WarnLevel)
}
if *logFile != "" { if *logFile != "" {
if f, err := os.OpenFile(*logFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644); err != nil { if f, err := os.OpenFile(*logFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644); err != nil {
log.Printf("Cannot open logfile (%s)", err) log.Printf("Cannot open logfile (%s)", err)

View File

@ -1,7 +1,7 @@
// Code generated by version.sh (@generated) DO NOT EDIT. // Code generated by version.sh (@generated) DO NOT EDIT.
package main package main
var githash = "0e0e5db" var githash = "f94f9b9"
var branch = "v2" var branch = "v2"
var buildstamp = "2023-06-29_21:36:34" var buildstamp = "2023-06-29_21:46:39"
var commits = "59" var commits = "60"
var version = "0e0e5db-b59 - 2023-06-29_21:36:34" var version = "f94f9b9-b60 - 2023-06-29_21:46:39"