MLIB
Loading...
Searching...
No Matches
trace.h
Go to the documentation of this file.
1
18#pragma once
19
20#if __has_include("defs.h")
21#include "defs.h"
22#endif
23
24#include "dprintf.h"
25
26#undef TRACE
27#undef TRACE1
28#undef TRACE2
29#undef TRACE3
30#undef TRACE4
31#undef TRACE5
32#undef TRACE6
33#undef TRACE7
34#undef TRACE8
35#undef TRACE9
36
37// MLIB_SYSLOG_TRACE forces MLIB_TRACE
38#if MLIB_SYSLOG_TRACE && !defined(MLIB_TRACE)
39#define MLIB_TRACE MLIB_SYSLOG_TRACE
40#endif
41
42// _TRACE forces MLIB_TRACE
43#if defined(_TRACE) && !defined(MLIB_TRACE)
44#define MLIB_TRACE _TRACE
45#endif
46
47#if defined(MLIB_TRACE_LEVEL)
48// only some traces enabled (up to and including MLIB_TRACE_LEVEL)
49#define __TRL(A) (A > MLIB_TRACE_LEVEL) ? 0 : TRACE
50#define TRACE1 __TRL (1)
51#define TRACE2 __TRL (2)
52#define TRACE3 __TRL (3)
53#define TRACE4 __TRL (4)
54#define TRACE5 __TRL (5)
55#define TRACE6 __TRL (6)
56#define TRACE7 __TRL (7)
57#define TRACE8 __TRL (8)
58#define TRACE9 __TRL (9)
59#else
60// all traces are enabled
61#define TRACE1 TRACE
62#define TRACE2 TRACE
63#define TRACE3 TRACE
64#define TRACE4 TRACE
65#define TRACE5 TRACE
66#define TRACE6 TRACE
67#define TRACE7 TRACE
68#define TRACE8 TRACE
69#define TRACE9 TRACE
70#endif
71
72#ifdef MLIB_TRACE
73#if MLIB_SYSLOG_TRACE
74#include "log.h"
75#define TRACE syslog_debug
76#else
77#define TRACE dprintf
78#endif
79#else
80#define TRACE 1 ? 0 : dprintf
81#endif
Definition of dprintf() function.
syslog related functions.