-
Notifications
You must be signed in to change notification settings - Fork 0
C API
The cpplogger_handle structure contains a void* pointer that is needed for the C API to work. Do not attempt to call this pointer. The call may terminate with undefined behavior.
Initializes the logger by opening or creating a log file and writing an initialization message.
-
console_enabled: A boolean flag indicating whether logs should also be printed to the console. -
log_file: The path to the log file where logs will be stored.
Logs a general message with a timestamp.
-
msg: The log message. -
handle: A handle to the class whose configuration the method is to be called with.
Logs an informational message with a specified importance level.
-
msg: The log message. -
level: The importance level of the message. -
handle: A handle to the class whose configuration the method is to be called with.
Logs a warning message with a specified importance level.
-
msg: The warning message. -
level: The importance level of the message. -
handle: A handle to the class whose configuration the method is to be called with.
Logs an error message with a specified importance level.
-
msg: The warning message. -
level: The importance level of the message. -
handle: A handle to the class whose configuration the method is to be called with.
-
If
console_enabledis set totrue, logs will be printed tostd::cout. -
All log messages include a timestamp formatted as
[ DD:MM:YY HH:MM:SS ]. -
The log file is opened in append mode (
std::ios::app), ensuring that new logs are added at the end of the file. -
Functions:
cpplogger_log(),cpplogger_info(),cpplogger_warning(),cpplogger_error()can be shortened to:log(),info(),warning(),error()by using the__use_cpplogger_macrosmacro