增加MESA_handle_logger

This commit is contained in:
luwenpeng
2023-02-20 11:16:34 +08:00
parent 6eaad28f9c
commit 82ac815b68
10 changed files with 108 additions and 95 deletions

View File

@@ -7,24 +7,40 @@ extern "C"
#endif
#include <stdio.h>
#include <MESA/MESA_handle_logger.h>
#define LOG_DEBUG(format, ...) \
{ \
fprintf(stdout, "DEBUG " format "\n", ##__VA_ARGS__); \
fflush(stdout); \
}
extern void *g_default_logger;
#define LOG_INFO(format, ...) \
{ \
fprintf(stdout, "INFO " format "\n", ##__VA_ARGS__); \
fflush(stdout); \
}
int LOG_INIT(const char *profile);
void LOG_CLOSE(void);
void LOG_RELOAD(void);
#define LOG_ERROR(format, ...) \
{ \
fprintf(stderr, "ERROR " format "\n", ##__VA_ARGS__); \
fflush(stderr); \
}
#define LOG_DEBUG(format, ...) \
do \
{ \
if (g_default_logger) \
MESA_handle_runtime_log(g_default_logger, RLOG_LV_DEBUG, __FUNCTION__, format, ##__VA_ARGS__); \
else \
fprintf(stdout, "DEBUG " format "\n", ##__VA_ARGS__); \
} while (0)
#define LOG_INFO(format, ...) \
do \
{ \
if (g_default_logger) \
MESA_handle_runtime_log(g_default_logger, RLOG_LV_INFO, __FUNCTION__, format, ##__VA_ARGS__); \
else \
fprintf(stdout, "INFO " format "\n", ##__VA_ARGS__); \
} while (0)
#define LOG_ERROR(format, ...) \
do \
{ \
if (g_default_logger) \
MESA_handle_runtime_log(g_default_logger, RLOG_LV_FATAL, __FUNCTION__, format, ##__VA_ARGS__); \
else \
fprintf(stderr, "ERROR " format "\n", ##__VA_ARGS__); \
} while (0)
#ifdef __cpluscplus
}