blob: 71be585d9d43a7d2a0b7a62b8c63c15c05283379 (
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
|
#ifndef GSR_LOG_H
#define GSR_LOG_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
GSR_LOG_LEVEL_DEBUG,
GSR_LOG_LEVEL_INFO,
GSR_LOG_LEVEL_WARNING,
GSR_LOG_LEVEL_ERROR
} gsr_log_level;
/* The handler may be called from any thread. |message| has no prefix, level name or trailing newline */
typedef void (*gsr_log_handler)(gsr_log_level level, const char *message, void *userdata);
void gsr_log(gsr_log_level level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
/* Messages below |level| are discarded */
void gsr_log_set_level(gsr_log_level level);
/* A NULL |handler| restores the default handler which prints "gsr <level>: <message>" to stderr */
void gsr_log_set_handler(gsr_log_handler handler, void *userdata);
#ifdef __cplusplus
}
#endif
#endif /* GSR_LOG_H */
|