From c118c3cb933454fef4941e5c350f49683a66d1a7 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Fri, 3 Dec 2021 20:39:45 +0000 Subject: [PATCH] Implement Log trace-only mode --- control.cc | 3 +++ log.cc | 5 +++++ log.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/control.cc b/control.cc index 8427fce..47f6e40 100644 --- a/control.cc +++ b/control.cc @@ -408,6 +408,9 @@ void Control::run() inputMan->start(); +// logger->debug(TAG, "Setting log trace only mode"); +// logger->setTraceOnlyMode(true); + messageLoopRun = true; messageLoop(); diff --git a/log.cc b/log.cc index f5d51f7..5687a79 100644 --- a/log.cc +++ b/log.cc @@ -39,3 +39,8 @@ bool LogNT::init(const std::string& tfileName, bool tenabled) return true; } + +void LogNT::setTraceOnlyMode(bool t) +{ + traceOnlyMode = t; +} diff --git a/log.h b/log.h index 10ac378..d477047 100644 --- a/log.h +++ b/log.h @@ -48,6 +48,7 @@ class LogNT static LogNT* getInstance(); bool init(const std::string& fileName, bool enabled); + void setTraceOnlyMode(bool); enum levels { TRACE, DEBUG, INFO, WARN, ERROR, CRIT }; @@ -66,6 +67,7 @@ class LogNT void ilog(const char* TAG, int level, T fmtString, Ts... args) { if (!enabled) return; + if (traceOnlyMode && (level != TRACE)) return; struct timeval tv; struct tm tms; @@ -113,6 +115,7 @@ class LogNT std::ofstream logFile; std::mutex outLock; std::ostream* outstream; + bool traceOnlyMode{}; }; #endif -- 2.39.5