![]() |
ModelSpace
|
Class to handle event and debug logging. More...
#include <EventLogger.h>
Public Member Functions | |
EventLogger (FILE *fp=stdout, unsigned int max_size=DEFAULT_MAX_MSG) | |
Simple constructor for event logger. | |
void | logLevel (log_level_e level) |
Function to set logging level for system. | |
log_level_e | logLevel () |
Function to get log level for system. | |
int | logMessage (log_level_e level, const std::string &message, log_level_e local_msg=NONE) |
Function to write an event message. | |
int | flushLogs () |
Function to flush the file buffer. | |
Class to handle event and debug logging.
The event logger is a simple, lightweight, static class for logging events as they occur. To minimize impact, the logger uses c-style file IO techniques and c-strings.
A configurable character limit, for now set to 140 characters, is enforced on logging. If you can't tweet it, you shouldn't be logging it in a simulation or embedded framework.
This logging framework derived (sort of) from the Dr. Dobbs simple logging framework presented here: https:/// drdobbs.com/cpp/logging-in-c/201804215
|
inline |
Simple constructor for event logger.
fp | File pointer to write to – set to stdout by default |
max_size | Max size of message, in characters. Set to 140 by default |
int clockwerk::EventLogger::flushLogs | ( | ) |
Function to flush the file buffer.
|
inline |
Function to get log level for system.
|
inline |
Function to set logging level for system.
level | Level to set logging to |
int clockwerk::EventLogger::logMessage | ( | log_level_e | level, |
const std::string & | message, | ||
log_level_e | local_msg = NONE |
||
) |
Function to write an event message.
level | The log level of the referenced message |
time | The time, written out as a string |
message | The message to be written. Must be <MAX_MESSAGE_SIZE (140 char) |
local_msg | The local level at which the message should be written out. Allows for higher local debugging |