Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rename to reorganize DDS Logging and Logging Structure

Logging.hpp

Logging provides an interface to log important messages and error messages. These messages are printed using cerr, stored in a file locally and sent to the LCC for log collection - the user does not need to think about how the log messages are stored and can simply use the .write function. A Logging Singleton is used so that the object must not be passed around between all classes that implement the feature.

...

To uniquely identify the log files, the time of initialization of a log is used as a name for the log file. ID, timestamp and content are stored in this file and sent to the LCC. The cerr output does not include the ID, as it is used to identify the program only. The log file is realized as a csv file, which is easy to write and supported by most spreadsheet programs.

Log Level (WIP)

Logging does not always need to be verbose, and might not be required during demonstrations for performance reasons.

...

You do not need to read the log level. The cpm library does that internally in combination with the Logging feature.

Example

#include "cpm/Logging.hpp"
//Always required if the cpm lib is used
cpm::Logging::Instance().set_id("my_id");
//Log a simple message (you must not use unformated strings, or else you will get a warning)
cpm::Logging::Instance().write(3, "%s", "This is a log message");
//Usage is similar to fprintf
cpm::Logging::Instance().write(2, "The %s is %i, although that should not be the case", "answer", 42);