summaryrefslogtreecommitdiff
path: root/src/tbm_emulator_log.h
blob: 4403f1e8820be1b7e80aa027b76742faff83c9ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef _TBM_EMULATOR_LOG_H
#define _TBM_EMULATOR_LOG_H

typedef enum
{
    tbm_emulator_log_level_off = 0,
    tbm_emulator_log_level_error = 1,
    tbm_emulator_log_level_info = 2,
    tbm_emulator_log_level_debug = 3,
} tbm_emulator_log_level;

void tbm_emulator_log_event(tbm_emulator_log_level log_level,
                            const char *func,
                            int line,
                            const char *format, ...);

int tbm_emulator_log_is_debug_enabled();

#define TBM_EMULATOR_LOG_DEBUG(format, ...) \
    do { \
        if (tbm_emulator_log_is_debug_enabled()) { \
            tbm_emulator_log_event(tbm_emulator_log_level_debug, __FUNCTION__, __LINE__, format,##__VA_ARGS__); \
        } \
    } while(0)

#define TBM_EMULATOR_LOG_INFO(format, ...) tbm_emulator_log_event(tbm_emulator_log_level_info, __FUNCTION__, __LINE__, format,##__VA_ARGS__)
#define TBM_EMULATOR_LOG_ERROR(format, ...) tbm_emulator_log_event(tbm_emulator_log_level_error, __FUNCTION__, __LINE__, format,##__VA_ARGS__)

#endif