MythTV  master
verbosedefs.h
Go to the documentation of this file.
1 #ifndef VERBOSEDEFS_H_
2 #define VERBOSEDEFS_H_
3 
4 #ifdef __cplusplus
5 #include <QMap>
6 #include <QString>
7 #include <QMutex>
8 #include <cstdint>
9 #else
10 #include <stdint.h>
11 #endif
12 
31 
32 #undef VERBOSE_PREAMBLE
33 #undef VERBOSE_POSTAMBLE
34 #undef VERBOSE_MAP
35 
36 #undef LOGLEVEL_PREAMBLE
37 #undef LOGLEVEL_POSTAMBLE
38 #undef LOGLEVEL_MAP
39 
40 // NOLINTBEGIN(cppcoreguidelines-macro-usage)
41 
42 #ifdef MYTH_IMPLEMENT_VERBOSE
43 
44 // This is used to actually implement the mask in mythlogging.cpp
45 #define VERBOSE_PREAMBLE
46 #define VERBOSE_POSTAMBLE
47 #define VERBOSE_MAP(name,mask,additive,help) \
48  verboseAdd(mask,QString(#name),additive,QString(help));
49 
50 #define LOGLEVEL_PREAMBLE
51 #define LOGLEVEL_POSTAMBLE
52 #define LOGLEVEL_MAP(name,value,shortname) \
53  loglevelAdd(value,QString(#name),shortname);
54 
55 #else // !defined(MYTH_IMPLEMENT_VERBOSE)
56 
57 // This is used to define the enumerated type (used by all files)
58 
59 #ifndef _MSC_VER
60  #define VERBOSE_PREAMBLE \
61  enum VerboseMask {
62  #define VERBOSE_POSTAMBLE \
63  VB_LAST_ITEM \
64  };
65  #define VERBOSE_MAP(name,mask,additive,help) \
66  name = (mask),
67 #else
68  // msvc can't have 64bit enums
69  #define VERBOSE_PREAMBLE
70  #define VERBOSE_POSTAMBLE
71  #define VERBOSE_MAP(name,mask,additive,help) \
72  const uint64_t name = mask;
73 #endif
74 
75 #define LOGLEVEL_PREAMBLE \
76  enum LogLevel_t : std::int8_t {
77 #define LOGLEVEL_POSTAMBLE \
78  };
79 #define LOGLEVEL_MAP(name,value,shortname) \
80  name = (value),
81 
82 #endif
83 
84 // NOLINTEND(cppcoreguidelines-macro-usage)
85 
87 VERBOSE_MAP(VB_ALL, ~0ULL, false,
88  "ALL available debug output")
89 VERBOSE_MAP(VB_MOST, 0xffffffff3ffeffffULL, false,
90  "Most debug (nodatabase,notimestamp,noextra)")
91 #if 0
92 VERBOSE_MAP(VB_IMPORTANT, 0x00000001, false,
93  "Errors or other very important messages")
94 #endif
95 VERBOSE_MAP(VB_GENERAL, 0x00000002, true,
96  "General info")
97 VERBOSE_MAP(VB_RECORD, 0x00000004, true,
98  "Recording related messages")
99 VERBOSE_MAP(VB_PLAYBACK, 0x00000008, true,
100  "Playback related messages")
101 VERBOSE_MAP(VB_CHANNEL, 0x00000010, true,
102  "Channel related messages")
103 VERBOSE_MAP(VB_OSD, 0x00000020, true,
104  "On-Screen Display related messages")
105 VERBOSE_MAP(VB_FILE, 0x00000040, true,
106  "File and AutoExpire related messages")
107 VERBOSE_MAP(VB_SCHEDULE, 0x00000080, true,
108  "Scheduling related messages")
109 VERBOSE_MAP(VB_NETWORK, 0x00000100, true,
110  "Network protocol related messages")
111 VERBOSE_MAP(VB_COMMFLAG, 0x00000200, true,
112  "Commercial detection related messages")
113 VERBOSE_MAP(VB_AUDIO, 0x00000400, true,
114  "Audio related messages")
115 VERBOSE_MAP(VB_LIBAV, 0x00000800, true,
116  "Enables libav debugging")
117 VERBOSE_MAP(VB_JOBQUEUE, 0x00001000, true,
118  "JobQueue related messages")
119 VERBOSE_MAP(VB_SIPARSER, 0x00002000, true,
120  "Siparser related messages")
121 VERBOSE_MAP(VB_EIT, 0x00004000, true,
122  "EIT related messages")
123 VERBOSE_MAP(VB_VBI, 0x00008000, true,
124  "VBI related messages")
125 VERBOSE_MAP(VB_DATABASE, 0x00010000, true,
126  "Display all SQL commands executed")
127 VERBOSE_MAP(VB_DSMCC, 0x00020000, true,
128  "DSMCC carousel related messages")
129 VERBOSE_MAP(VB_MHEG, 0x00040000, true,
130  "MHEG debugging messages")
131 VERBOSE_MAP(VB_UPNP, 0x00080000, true,
132  "UPnP debugging messages")
133 VERBOSE_MAP(VB_SOCKET, 0x00100000, true,
134  "socket debugging messages")
135 VERBOSE_MAP(VB_XMLTV, 0x00200000, true,
136  "xmltv output and related messages")
137 VERBOSE_MAP(VB_DVBCAM, 0x00400000, true,
138  "DVB CAM debugging messages")
139 VERBOSE_MAP(VB_MEDIA, 0x00800000, true,
140  "Media Manager debugging messages")
141 VERBOSE_MAP(VB_IDLE, 0x01000000, true,
142  "System idle messages")
143 VERBOSE_MAP(VB_CHANSCAN, 0x02000000, true,
144  "Channel Scanning messages")
145 VERBOSE_MAP(VB_GUI, 0x04000000, true,
146  "GUI related messages")
147 VERBOSE_MAP(VB_SYSTEM, 0x08000000, true,
148  "External executable related messages")
149 #if 0
150 VERBOSE_MAP(VB_EXTRA, 0x40000000, true,
151  "More detailed messages in selected levels")
152 #endif
153 VERBOSE_MAP(VB_TIMESTAMP, 0x80000000, true,
154  "Conditional data driven messages")
155 VERBOSE_MAP(VB_PROCESS, 0x100000000ULL, true,
156  "MPEG2Fix processing messages")
157 VERBOSE_MAP(VB_FRAME, 0x200000000ULL, true,
158  "MPEG2Fix frame messages")
159 VERBOSE_MAP(VB_RPLXQUEUE, 0x400000000ULL, true,
160  "MPEG2Fix Replex Queue messages")
161 VERBOSE_MAP(VB_DECODE, 0x800000000ULL, true,
162  "MPEG2Fix Decode messages")
163 VERBOSE_MAP(VB_FLUSH, 0x1000000000ULL, true,
164  "")
165 /* Please do not add a description for VB_FLUSH, it
166  should not be passed in via "-v". It is used to
167  flush output to the standard output from console
168  programs that have debugging enabled.
169  */
170 VERBOSE_MAP(VB_STDIO, 0x2000000000ULL, true,
171  "")
172 /* Please do not add a description for VB_STDIO, it
173  should not be passed in via "-v". It is used to
174  send output to the standard output from console
175  programs that have debugging enabled.
176  */
177 VERBOSE_MAP(VB_GPU, 0x4000000000ULL, true,
178  "GPU OpenGL driver messages")
179 VERBOSE_MAP(VB_GPUAUDIO, 0x8000000000ULL, true,
180  "GPU Audio Processing messages")
181 VERBOSE_MAP(VB_GPUVIDEO, 0x10000000000ULL, true,
182  "GPU video rendering messages")
183 VERBOSE_MAP(VB_REFCOUNT, 0x20000000000ULL, true,
184  "Reference Count messages")
185 VERBOSE_MAP(VB_HTTP, 0x40000000000ULL, true,
186  "HTTP Server messages")
187 VERBOSE_MAP(VB_NONE, 0x00000000, false,
188  "NO debug output")
190 
191 
193 LOGLEVEL_MAP(LOG_ANY, -1, ' ')
194 LOGLEVEL_MAP(LOG_EMERG, 0, '!')
195 LOGLEVEL_MAP(LOG_ALERT, 1, 'A')
196 LOGLEVEL_MAP(LOG_CRIT, 2, 'C')
197 LOGLEVEL_MAP(LOG_ERR, 3, 'E')
198 LOGLEVEL_MAP(LOG_WARNING, 4, 'W')
199 LOGLEVEL_MAP(LOG_NOTICE, 5, 'N')
200 LOGLEVEL_MAP(LOG_INFO, 6, 'I')
201 LOGLEVEL_MAP(LOG_DEBUG, 7, 'D')
202 LOGLEVEL_MAP(LOG_UNKNOWN, 8, '-')
204 
205 #ifndef MYTH_IMPLEMENT_VERBOSE
206 #ifdef __cplusplus
207 struct VerboseDef {
208  uint64_t mask {0};
209  QString name;
210  bool additive {false};
211  QString helpText;
212 };
213 using VerboseMap = QMap<QString, VerboseDef *>;
214 
215 struct LoglevelDef {
216  int value {LOG_UNKNOWN};
217  QString name;
218  char shortname {'-'};
219 };
220 using LoglevelMap = QMap<int, LoglevelDef *>;
221 using ComponentLogLevelMap = QMap<uint64_t, LogLevel_t>;
222 
223 extern VerboseMap verboseMap;
224 extern QMutex verboseMapMutex;
225 
226 extern LoglevelMap loglevelMap;
227 extern QMutex loglevelMapMutex;
228 #endif
229 #endif
230 
231 #endif
LoglevelMap
QMap< int, LoglevelDef * > LoglevelMap
Definition: verbosedefs.h:220
VERBOSE_PREAMBLE
#define VERBOSE_PREAMBLE
This file gets included in two different ways: 1) from mythlogging.h from nearly every file.
Definition: verbosedefs.h:60
loglevelMap
LoglevelMap loglevelMap
Definition: logging.cpp:91
Channel
Definition: channel.h:36
false
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:89
LOGLEVEL_PREAMBLE
#define LOGLEVEL_PREAMBLE
Definition: verbosedefs.h:75
AutoExpire
Used to expire recordings to make space for new recordings.
Definition: autoexpire.h:60
verboseMapMutex
QMutex verboseMapMutex
Definition: logging.cpp:89
VERBOSE_MAP
#define VERBOSE_MAP(name, mask, additive, help)
Definition: verbosedefs.h:65
true
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:95
verboseMap
VerboseMap verboseMap
Definition: logging.cpp:88
LoglevelDef::shortname
char shortname
Definition: verbosedefs.h:218
debug
VERBOSE_PREAMBLE Most debug(nodatabase, notimestamp, noextra)") VERBOSE_MAP(VB_GENERAL
LOGLEVEL_MAP
#define LOGLEVEL_MAP(name, value, shortname)
Definition: verbosedefs.h:79
LoglevelDef::value
int value
Definition: verbosedefs.h:216
LOGLEVEL_POSTAMBLE
#define LOGLEVEL_POSTAMBLE
Definition: verbosedefs.h:77
Recording
static bool Recording(const RecordingInfo *p)
Definition: scheduler.cpp:221
LoglevelDef::name
QString name
Definition: verbosedefs.h:217
loglevelMapMutex
QMutex loglevelMapMutex
Definition: logging.cpp:92
VERBOSE_POSTAMBLE
#define VERBOSE_POSTAMBLE
Definition: verbosedefs.h:62
ComponentLogLevelMap
QMap< uint64_t, LogLevel_t > ComponentLogLevelMap
Definition: verbosedefs.h:221
JobQueue
Definition: jobqueue.h:128
MHEG
Definition: freemheg.h:54
D
#define D(i, j)
output
#define output
Definition: synaesthesia.cpp:223
LoglevelDef
Definition: verbosedefs.h:215
VerboseMap
QMap< QString, VerboseDef * > VerboseMap
Definition: verbosedefs.h:213