Skip to content

Commit

Permalink
📅 Add flag to suppress timestamps in log (#22)
Browse files Browse the repository at this point in the history
* 📅 Add flag to suppress timestamps in log

* 📝 Update systemd unit files
  • Loading branch information
database64128 authored Aug 15, 2021
1 parent de8634c commit d21832c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,18 @@ func GetConfig() *Config {

version := flag.Bool("v", false, "version")
confPath := flag.String("conf", "example.json", "config file path")
suppressTimestamps := flag.Bool("suppress-timestamps", false, "do not include timestamps in log")
flag.Parse()

if *version {
fmt.Println(Version)
os.Exit(0)
}

if *suppressTimestamps {
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
}

if config, err = BuildConfig(*confPath); err != nil {
log.Fatalln(err)
}
Expand Down
2 changes: 1 addition & 1 deletion systemd/mmp-go.service
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
Environment="GODEBUG=madvdontneed=1"
ExecStart=/usr/bin/mmp-go -conf /etc/mmp-go/config.json
ExecStart=/usr/bin/mmp-go -conf /etc/mmp-go/config.json -suppress-timestamps
ExecReload=/bin/kill -USR1 $MAINPID

[Install]
Expand Down
2 changes: 1 addition & 1 deletion systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
Environment="GODEBUG=madvdontneed=1"
ExecStart=/usr/bin/mmp-go -conf /etc/mmp-go/%i.json
ExecStart=/usr/bin/mmp-go -conf /etc/mmp-go/%i.json -suppress-timestamps
ExecReload=/bin/kill -USR1 $MAINPID

[Install]
Expand Down

0 comments on commit d21832c

Please sign in to comment.