Torc  0.1
torcloggingdefs.h
Go to the documentation of this file.
1 #ifndef TORCLOGGINGDEFS_H_
2 #define TORCLOGGINGDEFS_H_
3 
4 #undef VERBOSE_PREAMBLE
5 #undef VERBOSE_POSTAMBLE
6 #undef VERBOSE_MAP
7 
8 #undef LOGLEVEL_PREAMBLE
9 #undef LOGLEVEL_POSTAMBLE
10 #undef LOGLEVEL_MAP
11 
12 #ifdef _IMPLEMENT_VERBOSE
13 
14 // This is used to actually implement the mask in mythlogging.cpp
15 #define VERBOSE_PREAMBLE
16 #define VERBOSE_POSTAMBLE
17 #define VERBOSE_MAP(name,mask,additive,help) \
18  AddVerbose((uint64_t)(mask),QStringLiteral(#name),(bool)(additive),QStringLiteral(help));
19 
20 #define LOGLEVEL_PREAMBLE
21 #define LOGLEVEL_POSTAMBLE
22 #define LOGLEVEL_MAP(name,value,shortname) \
23  AddLogLevel((int)(value),QStringLiteral(#name),(char)(shortname));
24 
25 #else // !defined(_IMPLEMENT_VERBOSE)
26 
27 // This is used to define the enumerated type (used by all files)
28 #define VERBOSE_PREAMBLE \
29  enum VerboseMask {
30 #define VERBOSE_POSTAMBLE \
31  VB_LAST_ITEM \
32  };
33 #define VERBOSE_MAP(name,mask,additive,help) \
34  name = (uint64_t)(mask),
35 
36 #define LOGLEVEL_PREAMBLE \
37  typedef enum {
38 #define LOGLEVEL_POSTAMBLE \
39  } LogLevel;
40 #define LOGLEVEL_MAP(name,value,shortname) \
41  name = (int)(value),
42 
43 #endif
44 
46 VERBOSE_MAP(VB_ALL, ~0ULL, false,
47  "ALL available debug output")
48 VERBOSE_MAP(VB_GENERAL, 0x00000001, true,
49  "General info")
50 VERBOSE_MAP(VB_NETWORK, 0x00000002, true,
51  "Network protocol related messages")
52 VERBOSE_MAP(VB_UPNP, 0x00000004, true,
53  "UPnP debugging messages")
54 VERBOSE_MAP(VB_FLUSH, 0x00000008, true,
55  "")
56 /* Please do not add a description for VB_FLUSH, it
57  should not be passed in via "-v". It is used to
58  flush output to the standard output from console
59  programs that have debugging enabled.
60  */
61 VERBOSE_MAP(VB_STDIO, 0x00000010, true,
62  "")
63 /* Please do not add a description for VB_STDIO, it
64  should not be passed in via "-v". It is used to
65  send output to the standard output from console
66  programs that have debugging enabled.
67  */
68 VERBOSE_MAP(VB_NONE, 0x00000000, false,
69  "NO debug output")
71 
73 LOGLEVEL_MAP(LOG_ANY, -1, ' ')
74 LOGLEVEL_MAP(LOG_EMERG, 0, '!')
75 LOGLEVEL_MAP(LOG_ALERT, 1, 'A')
76 LOGLEVEL_MAP(LOG_CRIT, 2, 'C')
77 LOGLEVEL_MAP(LOG_ERR, 3, 'E')
78 LOGLEVEL_MAP(LOG_WARNING, 4, 'W')
79 LOGLEVEL_MAP(LOG_NOTICE, 5, 'N')
80 LOGLEVEL_MAP(LOG_INFO, 6, 'I')
81 LOGLEVEL_MAP(LOG_DEBUG, 7, 'D')
82 LOGLEVEL_MAP(LOG_UNKNOWN, 8, '-')
84 
85 #endif
#define LOGLEVEL_PREAMBLE
#define LOGLEVEL_POSTAMBLE
#define VERBOSE_PREAMBLE
VERBOSE_PREAMBLE true
#define LOGLEVEL_MAP(name, value, shortname)
#define VERBOSE_POSTAMBLE
#define VERBOSE_MAP(name, mask, additive, help)