DungeonCrawl
Loading...
Searching...
No Matches
logger.h
Go to the documentation of this file.
1
5
6
#ifndef LOGGER_H
7
#define LOGGER_H
8
9
#define DEBUG_STATE 1
//change to 0 to disable debug logging
10
11
#define DEBUG_LOG(modul, format, ...) \
12
if (DEBUG_STATE == 1) { \
13
log_msg(DEBUG, modul, format, ##__VA_ARGS__); \
14
}
15
16
#define RETURN_WHEN_NULL(ptr, ret, modul, format, ...) \
17
if (ptr == NULL) { \
18
log_msg(ERROR, modul, format, ##__VA_ARGS__); \
19
return ret; \
20
}
21
22
#define RETURN_WHEN_TRUE(expr, ret, modul, format, ...) \
23
if (expr) { \
24
log_msg(ERROR, modul, format, ##__VA_ARGS__); \
25
return ret; \
26
}
27
28
typedef
enum
{
29
DEBUG,
30
FINE,
31
INFO,
32
WARNING,
33
ERROR,
34
MAX_LOG_LEVEL
35
} log_level_t;
36
54
void
init_logger
(
void
);
55
76
void
log_msg
(log_level_t level,
const
char
* module,
const
char
* format, ...);
77
95
void
shutdown_logger
(
void
);
96
#endif
//LOGGER_H
log_msg
void log_msg(log_level_t level, const char *module, const char *format,...)
Logs a formatted message with a specified log level and module.
Definition
logger.c:246
shutdown_logger
void shutdown_logger(void)
Shuts down the logging system for the application.
Definition
logger.c:278
init_logger
void init_logger(void)
Initializes the logging system for the application.
Definition
logger.c:232
src
logging
logger.h
Generated by
1.14.0