Core Library 1.7.0.0 Library containing core utilities and tools for threading, networking, logging, INI and CSV file management etc.

DebugLogging.h
Go to the documentation of this file.
1 // This file is part of CoreLibrary containing useful reusable utility
2 // classes.
3 //
4 // Copyright (C) 2014 to present, Duncan Crutchley
5 // Contact <dac1976github@outlook.com>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published
9 // by the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License and GNU Lesser General Public License
16 // for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // and GNU Lesser General Public License along with this program. If
20 // not, see <http://www.gnu.org/licenses/>.
21
27 #ifndef DEBUGLOGGING
28 #define DEBUGLOGGING
29
30 #include "DebugLogSingleton.h"
31 #include <boost/current_function.hpp>
32
36 static constexpr core_lib::log::eLogMessageLevel LOG_LEVEL_DEBUG{
37 core_lib::log::eLogMessageLevel::debug};
38 static constexpr core_lib::log::eLogMessageLevel LOG_LEVEL_INFO{
39 core_lib::log::eLogMessageLevel::info};
40 static constexpr core_lib::log::eLogMessageLevel LOG_LEVEL_WARNING{
41 core_lib::log::eLogMessageLevel::warning};
42 static constexpr core_lib::log::eLogMessageLevel LOG_LEVEL_ERROR{
43 core_lib::log::eLogMessageLevel::error};
44 static constexpr core_lib::log::eLogMessageLevel LOG_LEVEL_FATAL{
45 core_lib::log::eLogMessageLevel::fatal};
46
53 #define DEBUG_LOG(x, m) \
54 do \
55 { \
56 std::ostringstream os; \
57 os << m; \
58 x.AddLogMessage(os.str()); \
59 } while (false)
60
68 #define DEBUG_LOG_EX(x, m, l) \
69 do \
70 { \
71 std::ostringstream os; \
72 os << m; \
73 x.AddLogMessage(os.str(), std::string(__FILE__), BOOST_CURRENT_FUNCTION, __LINE__, l); \
74 } while (false)
75
82 #define DEBUG_LOG_EX_DEBUG(x, m) DEBUG_LOG_EX(x, m, LOG_LEVEL_DEBUG)
83
90 #define DEBUG_LOG_EX_INFO(x, m) DEBUG_LOG_EX(x, m, LOG_LEVEL_INFO)
91
98 #define DEBUG_LOG_EX_WARNING(x, m) DEBUG_LOG_EX(x, m, LOG_LEVEL_WARNING)
99
106 #define DEBUG_LOG_EX_ERROR(x, m) DEBUG_LOG_EX(x, m, LOG_LEVEL_ERROR)
107
114 #define DEBUG_LOG_EX_FATAL(x, m) DEBUG_LOG_EX(x, m, LOG_LEVEL_FATAL)
115
121 #define DEBUG_LOG_ADD_FILTER(x, l) x.AddLogMsgLevelFilter(l)
122
127 #define DEBUG_LOG_ADD_FILTER_DEBUG(x) DEBUG_LOG_ADD_FILTER(x, LOG_LEVEL_DEBUG)
128
133 #define DEBUG_LOG_ADD_FILTER_INFO(x) DEBUG_LOG_ADD_FILTER(x, LOG_LEVEL_INFO)
134
139 #define DEBUG_LOG_ADD_FILTER_WARNING(x) DEBUG_LOG_ADD_FILTER(x, LOG_LEVEL_WARNING)
140
145 #define DEBUG_LOG_ADD_FILTER_ERROR(x) DEBUG_LOG_ADD_FILTER(x, LOG_LEVEL_ERROR)
146
151 #define DEBUG_LOG_ADD_FILTER_FATAL(x) DEBUG_LOG_ADD_FILTER(x, LOG_LEVEL_FATAL)
152
158 #define DEBUG_LOG_REMOVE_FILTER(x, l) x.RemoveLogMsgLevelFilter(l)
159
164 #define DEBUG_LOG_REMOVE_FILTER_DEBUG(x) DEBUG_LOG_REMOVE_FILTER(x, LOG_LEVEL_DEBUG)
165
170 #define DEBUG_LOG_REMOVE_FILTER_INFO(x) DEBUG_LOG_REMOVE_FILTER(x, LOG_LEVEL_INFO)
171
176 #define DEBUG_LOG_REMOVE_FILTER_WARNING(x) DEBUG_LOG_REMOVE_FILTER(x, LOG_LEVEL_WARNING)
177
182 #define DEBUG_LOG_REMOVE_FILTER_ERROR(x) DEBUG_LOG_REMOVE_FILTER(x, LOG_LEVEL_ERROR)
183
188 #define DEBUG_LOG_REMOVE_FILTER_FATAL(x) DEBUG_LOG_REMOVE_FILTER(x, LOG_LEVEL_FATAL)
189
194 #define DEBUG_LOG_CLEAR_FILTERS(x) x.ClearLogMsgLevelFilters()
195
205 #define DEBUG_MESSAGE_INSTANTIATE(v, p, f) DEBUG_LOG_SINGLETON.Instantiate(v, p, f)
206
217 #define DEBUG_MESSAGE_INSTANTIATE_EX(v, p, f, s) DEBUG_LOG_SINGLETON.Instantiate(v, p, f, s)
218
226 #define DEBUG_MESSAGE_DELETE_SINGLETON() DEBUG_LOG_SINGLETON_DELETER
227
235 #define DEBUG_MESSAGE(m) DEBUG_LOG(DEBUG_LOG_SINGLETON, m)
236
245 #define DEBUG_MESSAGE_EX(m, l) DEBUG_LOG_EX(DEBUG_LOG_SINGLETON, m, l)
246
254 #define DEBUG_MESSAGE_EX_DEBUG(m) DEBUG_LOG_EX_DEBUG(DEBUG_LOG_SINGLETON, m)
255
263 #define DEBUG_MESSAGE_EX_INFO(m) DEBUG_LOG_EX_INFO(DEBUG_LOG_SINGLETON, m)
264
272 #define DEBUG_MESSAGE_EX_WARNING(m) DEBUG_LOG_EX_WARNING(DEBUG_LOG_SINGLETON, m)
273
281 #define DEBUG_MESSAGE_EX_ERROR(m) DEBUG_LOG_EX_ERROR(DEBUG_LOG_SINGLETON, m)
282
290 #define DEBUG_MESSAGE_EX_FATAL(m) DEBUG_LOG_EX_FATAL(DEBUG_LOG_SINGLETON, m)
291
298 #define DEBUG_MESSAGE_ADD_FILTER(l) DEBUG_LOG_ADD_FILTER(DEBUG_LOG_SINGLETON, l)
299
305 #define DEBUG_MESSAGE_ADD_FILTER_DEBUG() DEBUG_LOG_ADD_FILTER_DEBUG(DEBUG_LOG_SINGLETON)
306
312 #define DEBUG_MESSAGE_ADD_FILTER_INFO() DEBUG_LOG_ADD_FILTER_INFO(DEBUG_LOG_SINGLETON)
313
319 #define DEBUG_MESSAGE_ADD_FILTER_WARNING() DEBUG_LOG_ADD_FILTER_WARNING(DEBUG_LOG_SINGLETON)
320
326 #define DEBUG_MESSAGE_ADD_FILTER_ERROR() DEBUG_LOG_ADD_FILTER_ERROR(DEBUG_LOG_SINGLETON)
327
333 #define DEBUG_MESSAGE_ADD_FILTER_FATAL() DEBUG_LOG_ADD_FILTER_FATAL(DEBUG_LOG_SINGLETON)
334
341 #define DEBUG_MESSAGE_REMOVE_FILTER(l) DEBUG_LOG_ADD_FILTER(DEBUG_LOG_SINGLETON, l)
342
348 #define DEBUG_MESSAGE_REMOVE_FILTER_DEBUG() DEBUG_LOG_ADD_FILTER_DEBUG(DEBUG_LOG_SINGLETON)
349
355 #define DEBUG_MESSAGE_REMOVE_FILTER_INFO() DEBUG_LOG_ADD_FILTER_INFO(DEBUG_LOG_SINGLETON)
356
362 #define DEBUG_MESSAGE_REMOVE_FILTER_WARNING() DEBUG_LOG_ADD_FILTER_WARNING(DEBUG_LOG_SINGLETON)
363
369 #define DEBUG_MESSAGE_REMOVE_FILTER_ERROR() DEBUG_LOG_ADD_FILTER_ERROR(DEBUG_LOG_SINGLETON)
370
376 #define DEBUG_MESSAGE_REMOVE_FILTER_FATAL() DEBUG_LOG_ADD_FILTER_FATAL(DEBUG_LOG_SINGLETON)
377
383 #define DEBUG_MESSAGE_CLEAR_FILTERS() DEBUG_LOG_CLEAR_FILTERS(DEBUG_LOG_SINGLETON)
384
385 #endif // DEBUGLOGGING
core_lib::log::eLogMessageLevel::warning
Warning level defined for message.
core_lib::log::eLogMessageLevel::error
Error level defined for message.
DebugLogSingleton.h
File containing declaration of DebugLog Singleton.
core_lib::log::eLogMessageLevel
eLogMessageLevel
Enumeration containing log message level options.
Definition: DebugLog.h:61
core_lib::log::eLogMessageLevel::debug
Debug level defined for message.
core_lib::log::eLogMessageLevel::fatal
Fatal level defined for message.
LOG_LEVEL_DEBUG
static constexpr core_lib::log::eLogMessageLevel LOG_LEVEL_DEBUG
Constants for each log error level.
Definition: DebugLogging.h:36
core_lib::log::eLogMessageLevel::info
Info level defined for message.