From d4207c1f33b521f82609a8218766fa0586623f9e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 16 Sep 2023 14:18:38 -0400 Subject: [PATCH] nestlog: bugfix: suppress timestamp when disabled --- include/nestlog/log_state.hpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/include/nestlog/log_state.hpp b/include/nestlog/log_state.hpp index b878724b..4b894a92 100644 --- a/include/nestlog/log_state.hpp +++ b/include/nestlog/log_state.hpp @@ -42,16 +42,18 @@ namespace xo { using xo::time::hms_msec; using xo::time::hms_usec; - if (log_config::time_local_flag) { - if (log_config::time_usec_flag) - this->ss_ << hms_usec::local(now_tm) << " "; - else - this->ss_ << hms_msec::local(now_tm) << " "; - } else { - if (log_config::time_usec_flag) - this->ss_ << hms_usec::utc(now_tm) << " "; - else - this->ss_ << hms_msec::utc(now_tm) << " "; + if (log_config::time_enabled) { + if (log_config::time_local_flag) { + if (log_config::time_usec_flag) + this->ss_ << hms_usec::local(now_tm) << " "; + else + this->ss_ << hms_msec::local(now_tm) << " "; + } else { + if (log_config::time_usec_flag) + this->ss_ << hms_usec::utc(now_tm) << " "; + else + this->ss_ << hms_msec::utc(now_tm) << " "; + } } } /*check_print_time*/