HLCC Documentation 2.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
LogTimer Class Reference

#include <logTimer.hpp>

Public Member Functions

 LogTimer (uint32_t period_s)
 
std::optional< uint32_t > check ()
 

Detailed Description

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)")

Constructor & Destructor Documentation

◆ LogTimer()

LogTimer::LogTimer ( uint32_t period_s)

Constructor

Parameters
[in]period_sPeriod of time in seconds between log calls

Member Function Documentation

◆ check()

std::optional< uint32_t > LogTimer::check ( )

Checks if timer expires and log can be logged

Returns
true if log can be logged

The documentation for this class was generated from the following files: