mirror of
https://github.com/nikdoof/hapz2m.git
synced 2026-01-30 12:48:21 +00:00
Omit log timestamps when running under systemd
The journal will already have timestamps for each logged message.
This commit is contained in:
@@ -66,6 +66,11 @@ func parseConfig(fname string) (cfg *config, err error) {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
// check if we are running under systemd, and if so, dont output timestamps
|
||||
if a, b := os.Getenv("INVOCATION_ID"), os.Getenv("JOURNAL_STREAM"); a != "" && b != "" {
|
||||
log.SetFlags(0)
|
||||
}
|
||||
|
||||
cfg, err := parseConfig(*configFile)
|
||||
if err != nil {
|
||||
log.Fatalf("config file error: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user