diff --git a/CHANGES b/CHANGES index 305e64e..f31c46b 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,11 @@ in the logs if no driver could be found. If you do not specify a type= in the meter config file, then it will default to auto. +Added --logtimestamps=important/never/always to prefix +a logged line in the log file or stderr output with a timestamp. +Important means timestamp warnings and device changes. +Daemon mode defaults to important. + Version 1.2.0: 2021-03-07 IMPORTANT CHANGES THAT MIGHT AFFECT YOU!vvvvvvvvvvvvvvvvvvvvvv diff --git a/src/main.cc b/src/main.cc index 5a84181..eea27af 100644 --- a/src/main.cc +++ b/src/main.cc @@ -363,6 +363,11 @@ bool start(Configuration *config) verboseEnabled(config->verbose); logTelegramsEnabled(config->logtelegrams); debugEnabled(config->debug); + if (config->addtimestamps == AddLogTimestamps::NotSet) + { + // Default to important log timestamps when starting a daemon. + if (config->daemon) config->addtimestamps = AddLogTimestamps::Important; + } setLogTimestamps(config->addtimestamps); internalTestingEnabled(config->internaltesting); traceEnabled(config->trace); diff --git a/src/util.h b/src/util.h index b75fc42..c8e3ccd 100644 --- a/src/util.h +++ b/src/util.h @@ -82,7 +82,7 @@ void traceEnabled(bool b); enum class AddLogTimestamps { - Never, Always, Important + NotSet, Never, Always, Important }; void setLogTimestamps(AddLogTimestamps ts); diff --git a/wmbusmeters.1 b/wmbusmeters.1 index 0440475..4b1af5f 100644 --- a/wmbusmeters.1 +++ b/wmbusmeters.1 @@ -45,7 +45,7 @@ mqtt_publish) sent to a REST API (eg curl) or store it in a database \fB\--listento=\fR, listen to more than one link mode at the same time, assuming the dongle supports it. -\fB\--logtimestamps=\fR add timestamps to log entries: never always important. +\fB\--logtimestamps=\fR add timestamps to log entries: never/always/important. \fB\--c1 --t1 --s1 --s1m --n1a ... --n1f\fR listen to c1,t1,s1,s1m,n1a-n1f telegrams.