Merge branch 'master' of ssh://repo.or.cz/srv/git/pachi
[pachi/derm.git] / debug.h
blob99a283aff1968398b09e5cd79bcca67d416e19fc
1 #ifndef ZZGO_DEBUG_H
2 #define ZZGO_DEBUG_H
4 #ifdef DEBUG
5 #define DEBUGL_(l, n) (unlikely((l) > (n)))
6 #define DEBUG_MODE (true)
7 #else
8 #define DEBUGL_(l, n) (false)
9 #define DEBUG_MODE (false)
10 #endif
12 extern int debug_level;
14 #define DEBUGL(n) DEBUGL_(debug_level, n)
16 /* The distributed engine can be _very_ verbose so use DEBUGV
17 * to keep only the first N verbose logs. */
18 #ifndef MAX_VERBOSE_LOGS
19 # define MAX_VERBOSE_LOGS 100000
20 #endif
21 extern long verbose_logs;
22 #define DEBUGV(verbose, n) (DEBUGL(n) && (!(verbose) || ++verbose_logs < MAX_VERBOSE_LOGS))
23 #define DEBUGVV(n) DEBUGV(true, (n))
25 #endif