|
HLCC Documentation 2.2.0
|
#include <logTimer.hpp>
Public Member Functions | |
| LogTimer (uint32_t period_s) | |
| std::optional< uint32_t > | check () |
This class allows to check if given period of time specified at class contruction passed and how many times the log message was skipped.
We need LogTimer class for each 'log line' that we want to skip. This class must be created with 'static' keyword or outside of the running loop to ensure the timer is running properly.
Example cpp: static LogTimer logtimer = LogTimer(60); ... auto check = logtimer.check(); if(check){ LOG4CPLUS_DEBUG(GetLogger(), "... (Log was skipped" << check << ") times"); }
Example pybind: self.logtimer = hlcc.utils.logtimer.LogTimer(60) ... check = self.logtimer.check() if check: self.logger.error(f"... (Log was skipped {check} times)")
| LogTimer::LogTimer | ( | uint32_t | period_s | ) |
Constructor
| [in] | period_s | Period of time in seconds between log calls |
| std::optional< uint32_t > LogTimer::check | ( | ) |
Checks if timer expires and log can be logged