blob: b1fc2979e2f9e6f51cfadfbef678a6d0de5e4771 (
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
30
31
32
33
34
35
36
37
38
39
40
41
|
#ifndef DBGTRACE_H_
#define DBGTRACE_H_
#include "chprintf.h"
#if !defined(DEBUG_TRACE_PRINT)
#define DEBUG_TRACE_PRINT FALSE
#endif
#if !defined(DEBUG_TRACE_WARNING)
#define DEBUG_TRACE_WARNING FALSE
#endif
#if !defined(DEBUG_TRACE_ERROR)
#define DEBUG_TRACE_ERROR FALSE
#endif
/* user must provide correctly initialized pointer to print channel */
#if DEBUG_TRACE_PRINT || DEBUG_TRACE_WARNING || DEBUG_TRACE_ERROR
extern BaseSequentialStream *GlobalDebugChannel;
#endif
#if DEBUG_TRACE_PRINT
#define dbgprintf(fmt, ...) chprintf(GlobalDebugChannel, fmt, ##__VA_ARGS__)
#else
#define dbgprintf(fmt, ...) do {} while(0)
#endif
#if DEBUG_TRACE_WARNING
#define warnprintf(fmt, ...) chprintf(GlobalDebugChannel, fmt, ##__VA_ARGS__)
#else
#define warnprintf(fmt, ...) do {} while(0)
#endif
#if DEBUG_TRACE_ERROR
#define errprintf(fmt, ...) chprintf(GlobalDebugChannel, fmt, ##__VA_ARGS__)
#else
#define errprintf(fmt, ...) do {} while(0)
#endif
#endif /* DBGTRACE_H_ */
|