Commit 90227ab7 authored by Sebastian Stark's avatar Sebastian Stark

Add option to disable logging of date and time

  - If output is redirected to syslog through e. g. supervisord
    it is only redundant information
parent a92dd8f1
......@@ -46,6 +46,7 @@ type Config struct {
MaxKeep int
NoPurge bool
NoWait bool
NoLogDate bool
}
// WriteCache writes the global configuration to disk as a json file.
......@@ -138,6 +139,9 @@ func LoadConfig() *Config {
flags.BoolVar(&(config.NoWait),
"noWait", false,
"if set, skip the initial waiting time before the first snapshot")
flags.BoolVar(&(config.NoLogDate),
"noLogDate", false,
"if set, does not print date and time in the log output. Useful if output is redirected to syslog")
flags.Parse(os.Args[2:])
if _, ok := schedules[config.Schedule]; ok == false {
log.Fatalln("no such schedule:", config.Schedule)
......
......@@ -190,6 +190,10 @@ func main() {
if config == nil {
log.Fatal("no config, don't know what to do!")
}
if config.NoLogDate {
log.SetFlags(logger.Flags() - log.Ldate - log.Ltime)
logger.SetFlags(logger.Flags() - log.Ldate - log.Ltime)
}
switch subcmd {
case "run":
log.Printf("%s started with pid %d\n", myName, os.Getpid())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment