DungeonCrawl
|
Header file for logging functionality of the game. More...
Go to the source code of this file.
Macros | |
#define | DEBUG_STATE 1 |
#define | DEBUG_LOG(modul, format, ...) |
#define | RETURN_WHEN_NULL(ptr, ret, modul, format, ...) |
#define | RETURN_WHEN_TRUE(expr, ret, modul, format, ...) |
Enumerations | |
enum | log_level_t { DEBUG , FINE , INFO , WARNING , ERROR , MAX_LOG_LEVEL } |
Functions | |
void | init_logger (void) |
Initializes the logging system for the application. | |
void | log_msg (log_level_t level, const char *module, const char *format,...) |
Logs a formatted message with a specified log level and module. | |
void | shutdown_logger (void) |
Shuts down the logging system for the application. |
Header file for logging functionality of the game.
Definition in file logger.h.
#define DEBUG_LOG | ( | modul, | |
format, | |||
... ) |
#define RETURN_WHEN_NULL | ( | ptr, | |
ret, | |||
modul, | |||
format, | |||
... ) |
#define RETURN_WHEN_TRUE | ( | expr, | |
ret, | |||
modul, | |||
format, | |||
... ) |
enum log_level_t |
void init_logger | ( | void | ) |
Initializes the logging system for the application.
This function sets up the logging system to be ready for recording log entries. It creates or opens the log file, initializes the ring buffer used for storing log entries temporarily, and starts the thread that asynchronously writes logs to the file. This ensures logging is operational and ready to use for the application's lifetime.
Notes:
Definition at line 232 of file logger.c.
void log_msg | ( | log_level_t | level, |
const char * | module, | ||
const char * | format, | ||
... ) |
Logs a formatted message with a specified log level and module.
This function generates a log entry that includes a timestamp, log level, module name, and a custom message formatted using a variable argument list. The log message is written to a ring buffer for asynchronous processing.
Notes:
level | The severity level of the log message (e.g., DEBUG, INFO, ERROR). If the provided log level exceeds the maximum defined levels, the INFO level will be used as a fallback. |
module | A string identifying the module or component generating the log message. |
format | A printf-style format string for the message content. |
... | Additional arguments to be formatted into the log message according to the format string. |
Definition at line 246 of file logger.c.
void shutdown_logger | ( | void | ) |
Shuts down the logging system for the application.
This function terminates the logging system, ensuring that no further log entries are recorded. It sets the logger's running state to false, effectively disabling any ongoing or future logging operations.
Use this function to cleanly release logging resources and mark the completion of logging operations at the end of the application's lifecycle or during application shutdown sequences.
Notes:
Definition at line 278 of file logger.c.