Simple interface against a logging system.
More...
#include <buslogstream.h>
|
| BusLogStream (std::source_location location, BusLogSeverity severity) |
| Constructor that is a simple wrapper around an outpout stream.
|
|
static uint64_t | ErrorCount () |
| Returns number of error messages.
|
static void | ResetErrorCount () |
| Resets the error counter.
|
static void | BusConsoleLogFunction (const std::source_location &location, BusLogSeverity severity, const std::string &text) |
| Simple function that sends all logs to the std::cout.
|
static void | BusNoLogFunction (const std::source_location &location, BusLogSeverity severity, const std::string &text) |
| Simple function that doesn't do anything.
|
|
static std::function< void(const std::source_location &location, BusLogSeverity severity, const std::string &text)> | UserLogFunction |
| The end-user should supply a function that redirect the logs.
|
The class defines an API against a text logging system. It doesn't implement the logging system itself. Instead the end-user need to write some adpater code that redirect the messages to their logging system. The 'ihedvall/utillib' GitHub repository implements a logging system.
◆ BusLogStream()
bus::BusLogStream::BusLogStream |
( |
std::source_location | location, |
|
|
BusLogSeverity | severity ) |
The end-user doesn't use this class directly. Instead he/she use the log macros.
- Parameters
-
location | Set by the macros to the current location. |
severity | Sets the severity level (syslog severity levels). |
◆ ErrorCount()
uint64_t bus::BusLogStream::ErrorCount |
( |
| ) |
|
|
inlinestatic |
Returns number of error messages generated. More correctly it counts all severity code large or equal to error. This is typical used in test situations.
- Returns
- Number of severe error logs.
◆ UserLogFunction
std::function<void(const std::source_location& location, BusLogSeverity severity, const std::string& text)> bus::BusLogStream::UserLogFunction |
|
static |
This callback function need to be set by the end-user. If the function is used, all log messages are redirected by this function. If no function is set, no log messages are reocrded.
The documentation for this class was generated from the following file: