![]() |
ModelSpace
Documentation for ModelSpace models and classes.
|
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. More... | |
| void | logLevel (log_level_e level) |
| Function to set logging level for system. More... | |
| log_level_e | logLevel () |
| Function to get log level for system. More... | |
| int | logMessage (log_level_e level, const std::string &message, log_level_e local_msg=LOG_NONE) |
| Function to write an event message. More... | |
| int | flushLogs () |
| Function to flush the file buffer. More... | |
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 modelspace::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 modelspace::EventLogger::logMessage | ( | log_level_e | level, |
| const std::string & | message, | ||
| log_level_e | local_msg = LOG_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 |