aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.h
blob: 2fe6e8490420c679190eb1ac575c77384f369263 (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 WM_UTIL_H
#define WM_UTIL_H

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __GNUC__
#define ATTR_FORMAT(stringindex, firsttocheck) __attribute__((format(printf, stringindex, firsttocheck)))
#else
#define ATTR_FORMAT(stringindex, firsttocheck)
#endif

void lognotice(char const *fmt, ...) ATTR_FORMAT(1,2);
void logerror(char const *fmt, ...) ATTR_FORMAT(1,2);
void fatal(char const *fmt, ...) ATTR_FORMAT(1,2);

#ifdef DEBUG_OUTPUT
void logdebug(char const *fmt, ...) ATTR_FORMAT(1,2);
#else
static inline void logdebug(char const * fmt, ...) ATTR_FORMAT(1,2);
static inline void logdebug(char const * fmt, ...) {}
#endif

#ifdef __cplusplus
}
#endif

#endif // !WM_UTIL_H