Notcurses 3.0.13
a blingful library for TUIs and character graphics
Loading...
Searching...
No Matches
logging.h
Go to the documentation of this file.
1#ifndef NOTCURSES_LOGGING
2#define NOTCURSES_LOGGING
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8// logging
10
11static inline void nclog(const char* fmt, ...)
12__attribute__ ((format (printf, 1, 2)));
13
14static inline void
15nclog(const char* fmt, ...){
16 va_list va;
17 va_start(va, fmt);
18 vfprintf(stderr, fmt, va);
19 va_end(va);
20}
21
22#define logpanic(fmt, ...) do{ \
23 if(loglevel >= NCLOGLEVEL_PANIC){ \
24 nclog("%s:%d:" fmt NL, __func__, __LINE__, ##__VA_ARGS__); } \
25 } while(0);
26
27#define logfatal(fmt, ...) do{ \
28 if(loglevel >= NCLOGLEVEL_FATAL){ \
29 nclog("%s:%d:" fmt NL, __func__, __LINE__, ##__VA_ARGS__); } \
30 } while(0);
31
32#define logerror(fmt, ...) do{ \
33 if(loglevel >= NCLOGLEVEL_ERROR){ \
34 nclog("%s:%d:" fmt NL, __func__, __LINE__, ##__VA_ARGS__); } \
35 } while(0);
36
37#define logwarn(fmt, ...) do{ \
38 if(loglevel >= NCLOGLEVEL_WARNING){ \
39 nclog("%s:%d:" fmt NL, __func__, __LINE__, ##__VA_ARGS__); } \
40 } while(0);
41
42#define loginfo(fmt, ...) do{ \
43 if(loglevel >= NCLOGLEVEL_INFO){ \
44 nclog("%s:%d:" fmt NL, __func__, __LINE__, ##__VA_ARGS__); } \
45 } while(0);
46
47#define logverbose(fmt, ...) do{ \
48 if(loglevel >= NCLOGLEVEL_VERBOSE){ \
49 nclog("%s:%d:" fmt NL, __func__, __LINE__, ##__VA_ARGS__); } \
50 } while(0);
51
52#define logdebug(fmt, ...) do{ \
53 if(loglevel >= NCLOGLEVEL_DEBUG){ \
54 nclog("%s:%d:" fmt NL, __func__, __LINE__, ##__VA_ARGS__); } \
55 } while(0);
56
57#define logtrace(fmt, ...) do{ \
58 if(loglevel >= NCLOGLEVEL_TRACE){ \
59 nclog("%s:%d:" fmt NL, __func__, __LINE__, ##__VA_ARGS__); } \
60 } while(0);
61
62#ifdef __cplusplus
63}
64#endif
65
66#endif
__attribute__((nonnull(1, 2))) static inline int egcpool_stash(egcpool *pool
const char * fmt
Definition fbuf.h:220
va_end(va)
const char va_start(va, fmt)
ncloglevel_e loglevel
Definition debug.c:3
ncloglevel_e
Definition notcurses.h:968