添加日志携带位置信息

This commit is contained in:
2025-05-15 10:03:17 +08:00
parent 8e512563e4
commit 6ff484fef8
7 changed files with 110 additions and 82 deletions

View File

@@ -12,6 +12,17 @@
extern "C" {
#endif
#define Log_fatal(format, ...) \
log_fatal(__FILE__, __LINE__, format, ##__VA_ARGS__)
#define Log_error(format, ...) \
log_error(__FILE__, __LINE__, format, ##__VA_ARGS__)
#define Log_warning(format, ...) \
log_warning(__FILE__, __LINE__, format, ##__VA_ARGS__)
#define Log_info(format, ...) \
log_info(__FILE__, __LINE__, format, ##__VA_ARGS__)
#define Log_debug(format, ...) \
log_debug(__FILE__, __LINE__, format, ##__VA_ARGS__)
typedef struct Logger {
log_level level;
log_Handler *handler;
@@ -21,11 +32,11 @@ typedef struct Logger {
bool (*addFilter)(log_filter *filter);
} Logger;
void log_fatal(const char *format, ...);
void log_error(const char *format, ...);
void log_warning(const char *format, ...);
void log_info(const char *format, ...);
void log_debug(const char *format, ...);
void log_fatal(const char *file, int line, const char *format, ...);
void log_error(const char *file, int line, const char *format, ...);
void log_warning(const char *file, int line, const char *format, ...);
void log_info(const char *file, int line, const char *format, ...);
void log_debug(const char *file, int line, const char *format, ...);
/**
* @brief