A helper class for tracking and logging numerical values across a period of time.
More...
#include <src/logging.h>
|
| void | collect_and_log (const T &value) |
| | Collect a metric sample and write it to the periodic log when due.
|
| |
| void | collect_and_log (std::function< T()> func) |
| | Collect a metric sample and write it to the periodic log when due.
|
| |
| bool | is_enabled () const |
| | Check whether this periodic logger should emit at the configured severity.
|
| |
| | min_max_avg_periodic_logger (boost::log::sources::severity_logger< int > &severity, std::string_view message, std::string_view units, std::chrono::seconds interval_in_seconds=std::chrono::seconds(20)) |
| | Construct a periodic logger that reports min, max, and average samples.
|
| |
|
void | reset () |
| | Reset the object to its initial empty state.
|
| |
template<typename T>
class logging::min_max_avg_periodic_logger< T >
A helper class for tracking and logging numerical values across a period of time.
*Examples**
logger.collect_and_log(1);
logger.collect_and_log(2);
logger.collect_and_log(3);
A helper class for tracking and logging numerical values across a period of time.
Definition logging.h:114
bl::sources::severity_logger< int > debug
Follow what is happening.
Definition logging.cpp:41
◆ min_max_avg_periodic_logger()
template<typename T >
| logging::min_max_avg_periodic_logger< T >::min_max_avg_periodic_logger |
( |
boost::log::sources::severity_logger< int > & | severity, |
|
|
std::string_view | message, |
|
|
std::string_view | units, |
|
|
std::chrono::seconds | interval_in_seconds = std::chrono::seconds(20) ) |
|
inline |
Construct a periodic logger that reports min, max, and average samples.
- Parameters
-
| severity | Severity level associated with the log message. |
| message | Message text to log or report. |
| units | Unit label appended to tracked numeric values. |
| interval_in_seconds | Interval in seconds. |
◆ collect_and_log() [1/2]
Collect a metric sample and write it to the periodic log when due.
- Parameters
-
| value | Numeric sample to include in the next periodic aggregate. |
◆ collect_and_log() [2/2]
Collect a metric sample and write it to the periodic log when due.
- Parameters
-
| func | Callable used to calculate the tracked sample value. |
◆ is_enabled()
Check whether this periodic logger should emit at the configured severity.
- Returns
- True when the logger severity is enabled and sampling should continue.
The documentation for this class was generated from the following file: