17#ifndef EASYLOGGINGPP_H
18#define EASYLOGGINGPP_H
21#if __cplusplus >= 201103L
24#if (defined(__GNUC__))
25# define ELPP_COMPILER_GCC 1
27# define ELPP_COMPILER_GCC 0
30# define ELPP_GCC_VERSION (__GNUC__ * 10000 \
31+ __GNUC_MINOR__ * 100 \
33# if defined(__GXX_EXPERIMENTAL_CXX0X__)
39# define ELPP_COMPILER_MSVC 1
41# define ELPP_COMPILER_MSVC 0
43#define ELPP_CRT_DBG_WARNINGS ELPP_COMPILER_MSVC
45# if (_MSC_VER == 1600)
47# elif(_MSC_VER >= 1700)
52#if (defined(__clang__) && (__clang__ == 1))
53# define ELPP_COMPILER_CLANG 1
55# define ELPP_COMPILER_CLANG 0
57#if ELPP_COMPILER_CLANG
58# if __has_include(<thread>)
60# if !defined(__GLIBCXX__) || __GLIBCXX__ >= 20150426
61# define ELPP_CLANG_SUPPORTS_THREAD
65#if (defined(__MINGW32__) || defined(__MINGW64__))
70#if (defined(__CYGWIN__) && (__CYGWIN__ == 1))
75#if (defined(__INTEL_COMPILER))
76# define ELPP_COMPILER_INTEL 1
78# define ELPP_COMPILER_INTEL 0
82#if (defined(_WIN32) || defined(_WIN64))
83# define ELPP_OS_WINDOWS 1
85# define ELPP_OS_WINDOWS 0
88#if (defined(__linux) || defined(__linux__))
89# define ELPP_OS_LINUX 1
91# define ELPP_OS_LINUX 0
93#if (defined(__APPLE__))
98#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
99# define ELPP_OS_FREEBSD 1
101# define ELPP_OS_FREEBSD 0
103#if (defined(__OpenBSD__))
104# define ELPP_OS_OPENBSD 1
106# define ELPP_OS_OPENBSD 0
108#if (defined(__NetBSD__))
109# define ELPP_OS_NETBSD 1
111# define ELPP_OS_NETBSD 0
114# define ELPP_OS_SOLARIS 1
116# define ELPP_OS_SOLARIS 0
119# define ELPP_OS_AIX 1
121# define ELPP_OS_AIX 0
123#if (defined(__NetBSD__))
124# define ELPP_OS_NETBSD 1
126# define ELPP_OS_NETBSD 0
128#if defined(__EMSCRIPTEN__)
129# define ELPP_OS_EMSCRIPTEN 1
131# define ELPP_OS_EMSCRIPTEN 0
133#if (defined(__DragonFly__))
134# define ELPP_OS_DRAGONFLY 1
136# define ELPP_OS_DRAGONFLY 0
139#if ((ELPP_OS_LINUX || ELPP_OS_MAC || ELPP_OS_FREEBSD || ELPP_OS_NETBSD || ELPP_OS_SOLARIS || ELPP_OS_AIX || ELPP_OS_EMSCRIPTEN || ELPP_OS_DRAGONFLY || ELPP_OS_OPENBSD) && (!ELPP_OS_WINDOWS))
140# define ELPP_OS_UNIX 1
142# define ELPP_OS_UNIX 0
144#if (defined(__ANDROID__))
145# define ELPP_OS_ANDROID 1
147# define ELPP_OS_ANDROID 0
150#if !ELPP_OS_UNIX && !ELPP_OS_WINDOWS && ELPP_CYGWIN
153# define ELPP_OS_UNIX 1
154# define ELPP_OS_LINUX 1
156#if !defined(ELPP_INTERNAL_DEBUGGING_OUT_INFO)
157# define ELPP_INTERNAL_DEBUGGING_OUT_INFO std::cout
159#if !defined(ELPP_INTERNAL_DEBUGGING_OUT_ERROR)
160# define ELPP_INTERNAL_DEBUGGING_OUT_ERROR std::cerr
162#if !defined(ELPP_INTERNAL_DEBUGGING_ENDL)
163# define ELPP_INTERNAL_DEBUGGING_ENDL std::endl
165#if !defined(ELPP_INTERNAL_DEBUGGING_MSG)
166# define ELPP_INTERNAL_DEBUGGING_MSG(msg) msg
169#if !defined(ELPP_DISABLE_ASSERT)
170# if (defined(ELPP_DEBUG_ASSERT_FAILURE))
171# define ELPP_ASSERT(expr, msg) if (!(expr)) { \
172std::stringstream internalInfoStream; internalInfoStream << msg; \
173ELPP_INTERNAL_DEBUGGING_OUT_ERROR \
174<< "EASYLOGGING++ ASSERTION FAILED (LINE: " << __LINE__ << ") [" #expr << "] WITH MESSAGE \"" \
175<< ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << "\"" << ELPP_INTERNAL_DEBUGGING_ENDL; base::utils::abort(1, \
176"ELPP Assertion failure, please define ELPP_DEBUG_ASSERT_FAILURE"); }
178# define ELPP_ASSERT(expr, msg) if (!(expr)) { \
179std::stringstream internalInfoStream; internalInfoStream << msg; \
180ELPP_INTERNAL_DEBUGGING_OUT_ERROR\
181<< "ASSERTION FAILURE FROM EASYLOGGING++ (LINE: " \
182<< __LINE__ << ") [" #expr << "] WITH MESSAGE \"" << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << "\"" \
183<< ELPP_INTERNAL_DEBUGGING_ENDL; }
186# define ELPP_ASSERT(x, y)
188#if ELPP_COMPILER_MSVC
189# define ELPP_INTERNAL_DEBUGGING_WRITE_PERROR \
190{ char buff[256]; strerror_s(buff, 256, errno); \
191ELPP_INTERNAL_DEBUGGING_OUT_ERROR << ": " << buff << " [" << errno << "]";} (void)0
193# define ELPP_INTERNAL_DEBUGGING_WRITE_PERROR \
194ELPP_INTERNAL_DEBUGGING_OUT_ERROR << ": " << strerror(errno) << " [" << errno << "]"; (void)0
196#if defined(ELPP_DEBUG_ERRORS)
197# if !defined(ELPP_INTERNAL_ERROR)
198# define ELPP_INTERNAL_ERROR(msg, pe) { \
199std::stringstream internalInfoStream; internalInfoStream << "<ERROR> " << msg; \
200ELPP_INTERNAL_DEBUGGING_OUT_ERROR \
201<< "ERROR FROM EASYLOGGING++ (LINE: " << __LINE__ << ") " \
202<< ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << ELPP_INTERNAL_DEBUGGING_ENDL; \
203if (pe) { ELPP_INTERNAL_DEBUGGING_OUT_ERROR << " "; ELPP_INTERNAL_DEBUGGING_WRITE_PERROR; }} (void)0
206# undef ELPP_INTERNAL_INFO
207# define ELPP_INTERNAL_ERROR(msg, pe)
209#if (defined(ELPP_DEBUG_INFO))
210# if !(defined(ELPP_INTERNAL_INFO_LEVEL))
211# define ELPP_INTERNAL_INFO_LEVEL 9
213# if !defined(ELPP_INTERNAL_INFO)
214# define ELPP_INTERNAL_INFO(lvl, msg) { if (lvl <= ELPP_INTERNAL_INFO_LEVEL) { \
215std::stringstream internalInfoStream; internalInfoStream << "<INFO> " << msg; \
216ELPP_INTERNAL_DEBUGGING_OUT_INFO << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) \
217<< ELPP_INTERNAL_DEBUGGING_ENDL; }}
220# undef ELPP_INTERNAL_INFO
221# define ELPP_INTERNAL_INFO(lvl, msg)
223#if (defined(ELPP_FEATURE_ALL)) || (defined(ELPP_FEATURE_CRASH_LOG))
224# if (ELPP_COMPILER_GCC && !ELPP_MINGW && !ELPP_OS_OPENBSD && !ELPP_OS_NETBSD && !ELPP_OS_ANDROID && !ELPP_OS_EMSCRIPTEN)
225# define ELPP_STACKTRACE 1
227# define ELPP_STACKTRACE 0
228# ifdef EASYLOGGING_CC
229# if ELPP_COMPILER_MSVC
230# pragma message("Stack trace not available for this compiler")
232# warning "Stack trace not available for this compiler";
237# define ELPP_STACKTRACE 0
240#define ELPP_UNUSED(x) (void)x
243# define ELPP_LOG_PERMS S_IRUSR | S_IWUSR | S_IXUSR | S_IWGRP | S_IRGRP | S_IXGRP | S_IWOTH | S_IXOTH
245#if defined(ELPP_AS_DLL) && ELPP_COMPILER_MSVC
246# if defined(ELPP_EXPORT_SYMBOLS)
247# define ELPP_EXPORT __declspec(dllexport)
249# define ELPP_EXPORT __declspec(dllimport)
259#if ELPP_CRT_DBG_WARNINGS
260# define STRTOK(a, b, c) strtok_s(a, b, c)
261# define STRERROR(a, b, c) strerror_s(a, b, c)
262# define STRCAT(a, b, len) strcat_s(a, len, b)
263# define STRCPY(a, b, len) strcpy_s(a, len, b)
265# define STRTOK(a, b, c) strtok(a, b)
266# define STRERROR(a, b, c) strerror(c)
267# define STRCAT(a, b, len) strcat(a, b)
268# define STRCPY(a, b, len) strcpy(a, b)
271#if (ELPP_MINGW && !defined(ELPP_FORCE_USE_STD_THREAD))
272# define ELPP_USE_STD_THREADING 0
274# if ((ELPP_COMPILER_CLANG && defined(ELPP_CLANG_SUPPORTS_THREAD)) || \
275 (!ELPP_COMPILER_CLANG && defined(ELPP_CXX11)) || \
276 defined(ELPP_FORCE_USE_STD_THREAD))
277# define ELPP_USE_STD_THREADING 1
279# define ELPP_USE_STD_THREADING 0
283#if ELPP_COMPILER_INTEL || (ELPP_GCC_VERSION < 40702)
286# define ELPP_FINAL final
288#if defined(ELPP_EXPERIMENTAL_ASYNC)
289# define ELPP_ASYNC_LOGGING 1
291# define ELPP_ASYNC_LOGGING 0
293#if defined(ELPP_THREAD_SAFE) || ELPP_ASYNC_LOGGING
294# define ELPP_THREADING_ENABLED 1
296# define ELPP_THREADING_ENABLED 0
300#if ELPP_COMPILER_MSVC
301# define ELPP_FUNC __FUNCSIG__
302#elif ELPP_COMPILER_GCC
303# define ELPP_FUNC __PRETTY_FUNCTION__
304#elif ELPP_COMPILER_INTEL
305# define ELPP_FUNC __PRETTY_FUNCTION__
306#elif ELPP_COMPILER_CLANG
307# define ELPP_FUNC __PRETTY_FUNCTION__
309# if defined(__func__)
310# define ELPP_FUNC __func__
315#undef ELPP_VARIADIC_TEMPLATES_SUPPORTED
317#define ELPP_VARIADIC_TEMPLATES_SUPPORTED \
318(ELPP_COMPILER_GCC || ELPP_COMPILER_CLANG || ELPP_COMPILER_INTEL || (ELPP_COMPILER_MSVC && _MSC_VER >= 1800))
320#ifdef ELPP_DISABLE_LOGS
321# define ELPP_LOGGING_ENABLED 0
323# define ELPP_LOGGING_ENABLED 1
325#if (!defined(ELPP_DISABLE_DEBUG_LOGS) && (ELPP_LOGGING_ENABLED))
326# define ELPP_DEBUG_LOG 1
328# define ELPP_DEBUG_LOG 0
330#if (!defined(ELPP_DISABLE_INFO_LOGS) && (ELPP_LOGGING_ENABLED))
331# define ELPP_INFO_LOG 1
333# define ELPP_INFO_LOG 0
335#if (!defined(ELPP_DISABLE_WARNING_LOGS) && (ELPP_LOGGING_ENABLED))
336# define ELPP_WARNING_LOG 1
338# define ELPP_WARNING_LOG 0
340#if (!defined(ELPP_DISABLE_ERROR_LOGS) && (ELPP_LOGGING_ENABLED))
341# define ELPP_ERROR_LOG 1
343# define ELPP_ERROR_LOG 0
345#if (!defined(ELPP_DISABLE_FATAL_LOGS) && (ELPP_LOGGING_ENABLED))
346# define ELPP_FATAL_LOG 1
348# define ELPP_FATAL_LOG 0
350#if (!defined(ELPP_DISABLE_TRACE_LOGS) && (ELPP_LOGGING_ENABLED))
351# define ELPP_TRACE_LOG 1
353# define ELPP_TRACE_LOG 0
355#if (!defined(ELPP_DISABLE_VERBOSE_LOGS) && (ELPP_LOGGING_ENABLED))
356# define ELPP_VERBOSE_LOG 1
358# define ELPP_VERBOSE_LOG 0
360#if (!(ELPP_CXX0X || ELPP_CXX11))
361# error "C++0x (or higher) support not detected! (Is `-std=c++11' missing?)"
364#if defined(ELPP_SYSLOG)
376#if defined(ELPP_UNICODE)
384# include <execinfo.h>
387# include <sys/system_properties.h>
390# include <sys/stat.h>
391# include <sys/time.h>
395# if defined(WIN32_LEAN_AND_MEAN)
396# if defined(ELPP_WINSOCK2)
397# include <winsock2.h>
406#include <unordered_map>
414#include <type_traits>
415#if ELPP_THREADING_ENABLED
416# if ELPP_USE_STD_THREADING
425#if ELPP_ASYNC_LOGGING
426# if defined(ELPP_NO_SLEEP_FOR)
431# include <condition_variable>
433#if defined(ELPP_STL_LOGGING)
441# if defined(ELPP_LOG_STD_ARRAY)
444# if defined(ELPP_LOG_UNORDERED_SET)
445# include <unordered_set>
448#if defined(ELPP_QT_LOGGING)
451# include <QByteArray>
458# include <QLinkedList>
460# include <QMultiHash>
463#if defined(ELPP_BOOST_LOGGING)
465# include <boost/container/vector.hpp>
466# include <boost/container/stable_vector.hpp>
467# include <boost/container/list.hpp>
468# include <boost/container/deque.hpp>
469# include <boost/container/map.hpp>
470# include <boost/container/flat_map.hpp>
471# include <boost/container/set.hpp>
472# include <boost/container/flat_set.hpp>
474#if defined(ELPP_WXWIDGETS_LOGGING)
476# include <wx/vector.h>
478#if defined(ELPP_UTC_DATETIME)
479# define elpptime_r gmtime_r
480# define elpptime_s gmtime_s
481# define elpptime gmtime
483# define elpptime_r localtime_r
484# define elpptime_s localtime_s
485# define elpptime localtime
491class PerformanceTrackingData;
494template <
typename T>
class Callback;
495class LogDispatchCallback;
496class PerformanceTrackingCallback;
497class LoggerRegistrationCallback;
498class LogDispatchData;
501class RegisteredLoggers;
502class PerformanceTracker;
507class DefaultLogBuilder;
508class DefaultLogDispatchCallback;
509#if ELPP_ASYNC_LOGGING
510class AsyncLogDispatchCallback;
511class AsyncDispatchWorker;
513class DefaultPerformanceTrackingCallback;
525#if defined(ELPP_UNICODE)
526# define ELPP_LITERAL(txt) L##txt
527# define ELPP_STRLEN wcslen
528# if defined ELPP_CUSTOM_COUT
529# define ELPP_COUT ELPP_CUSTOM_COUT
531# define ELPP_COUT std::wcout
539# define ELPP_LITERAL(txt) txt
540# define ELPP_STRLEN strlen
541# if defined ELPP_CUSTOM_COUT
542# define ELPP_COUT ELPP_CUSTOM_COUT
544# define ELPP_COUT std::cout
552#if defined(ELPP_CUSTOM_COUT_LINE)
553# define ELPP_COUT_LINE(logLine) ELPP_CUSTOM_COUT_LINE(logLine)
555# define ELPP_COUT_LINE(logLine) logLine << std::flush
622template<>
struct hash<
el::Level> {
643 return static_cast<Level>(l);
769#ifdef ELPP_DEFAULT_LOGGER
775#if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING)
776#ifdef ELPP_DEFAULT_PERFORMANCE_LOGGER
777static const char* kPerformanceLoggerId = ELPP_DEFAULT_PERFORMANCE_LOGGER;
779static const char* kPerformanceLoggerId =
"performance";
783#if defined(ELPP_SYSLOG)
784static const char* kSysLogLoggerId =
"syslog";
816 SIGABRT,
"SIGABRT",
"Abnormal termination",
817 "Program was abnormally terminated."
820 SIGFPE,
"SIGFPE",
"Erroneous arithmetic operation",
821 "Arithemetic operation issue such as division by zero or operation resulting in overflow."
824 SIGILL,
"SIGILL",
"Illegal instruction",
825 "Generally due to a corruption in the code or to an attempt to execute data."
828 SIGSEGV,
"SIGSEGV",
"Invalid access to memory",
829 "Program is trying to read an invalid (unallocated, deleted or corrupted) or inaccessible memory."
832 SIGINT,
"SIGINT",
"Interactive attention signal",
833 "Interruption generated (generally) by user or operating system."
879 void init(
int width);
888typename std::enable_if<std::is_pointer<T*>::value,
void>::type
898template <
typename Enum>
902template <
typename Enum>
906template <
typename Enum>
911template <
typename Enum>
913 *flag = base::utils::bitwise::Or<Enum>(e, *flag);
915template <
typename Enum>
917 *flag = base::utils::bitwise::Not<Enum>(e, *flag);
919template <
typename Enum>
921 return base::utils::bitwise::And<Enum>(e, flag) > 0x0;
925#if ELPP_THREADING_ENABLED
926# if !ELPP_USE_STD_THREADING
933 pthread_mutexattr_t attr;
934 pthread_mutexattr_init(&attr);
935 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
936 pthread_mutex_init(&m_underlyingMutex, &attr);
937 pthread_mutexattr_destroy(&attr);
938# elif ELPP_OS_WINDOWS
939 InitializeCriticalSection(&m_underlyingMutex);
943 virtual ~Mutex(
void) {
945 pthread_mutex_destroy(&m_underlyingMutex);
946# elif ELPP_OS_WINDOWS
947 DeleteCriticalSection(&m_underlyingMutex);
951 inline void lock(
void) {
953 pthread_mutex_lock(&m_underlyingMutex);
954# elif ELPP_OS_WINDOWS
955 EnterCriticalSection(&m_underlyingMutex);
959 inline bool try_lock(
void) {
961 return (pthread_mutex_trylock(&m_underlyingMutex) == 0);
962# elif ELPP_OS_WINDOWS
963 return TryEnterCriticalSection(&m_underlyingMutex);
967 inline void unlock(
void) {
969 pthread_mutex_unlock(&m_underlyingMutex);
970# elif ELPP_OS_WINDOWS
971 LeaveCriticalSection(&m_underlyingMutex);
977 pthread_mutex_t m_underlyingMutex;
978# elif ELPP_OS_WINDOWS
979 CRITICAL_SECTION m_underlyingMutex;
991 virtual ~ScopedLock(
void) {
999typedef base::threading::internal::Mutex
Mutex;
1000typedef base::threading::internal::ScopedLock<base::threading::Mutex>
ScopedLock;
1002typedef std::recursive_mutex
Mutex;
1003typedef std::lock_guard<base::threading::Mutex>
ScopedLock;
1018template <
typename Mutex>
1045#if ELPP_THREADING_ENABLED
1046# if !ELPP_USE_STD_THREADING
1049 std::stringstream ss;
1050# if (ELPP_OS_WINDOWS)
1051 ss << GetCurrentThreadId();
1057static std::string getCurrentThreadId(
void) {
1058 std::stringstream ss;
1059 char prev_fill = ss.fill(
' ');
1060 auto prev_flags = ss.flags(std::ios::hex);
1062 auto prev_width = ss.width(16);
1063 ss << std::this_thread::get_id();
1065 ss.flags(prev_flags);
1066 ss.width(prev_width);
1072 return std::string();
1087 static bool pathExists(
const char* path,
bool considerFile =
false);
1091 static bool createPath(
const std::string& path);
1093 static std::string extractPathFromFilename(
const std::string& fullPath,
1094 const char* seperator = base::consts::kFilePathSeperator);
1096 static void buildStrippedFilename(
const char* filename,
char buff[],
const std::string &commonPrefix = NULL,
1097 std::size_t limit = base::consts::kSourceFilenameMaxLength);
1099 static void buildBaseFilename(
const std::string& fullPath,
char buff[],
1100 std::size_t limit = base::consts::kSourceFilenameMaxLength,
1101 const char* seperator = base::consts::kFilePathSeperator);
1108 return c >=
'0' && c <=
'9';
1112 static bool wildCardMatch(
const char*
str,
const char* pattern);
1114 static std::string& ltrim(std::string&
str);
1115 static std::string& rtrim(std::string&
str);
1116 static std::string& trim(std::string&
str);
1122 static bool startsWith(
const std::string&
str,
const std::string&
start);
1128 static bool endsWith(
const std::string&
str,
const std::string& end);
1135 static std::string& replaceAll(std::string&
str,
char replaceWhat,
char replaceWith);
1142 static std::string& replaceAll(std::string&
str,
const std::string& replaceWhat,
1143 const std::string& replaceWith);
1147#if defined(ELPP_UNICODE)
1149 const std::string& replaceWith);
1154 static std::string& toUpper(std::string& str);
1157 static bool cStringEq(
const char* s1,
const char* s2);
1161 static bool cStringCaseEq(
const char* s1,
const char* s2);
1164 static bool contains(
const char*
str,
char c);
1166 static char* convertAndAddToBuff(std::size_t n,
int len,
char*
buf,
const char* bufLim,
bool zeroPadded =
true);
1167 static char* addToBuff(
const char*
str,
char*
buf,
const char* bufLim);
1168 static char* clearBuff(
char buff[], std::size_t lim);
1172 static char* wcharPtrToCharPtr(
const wchar_t* line);
1182 static const char* getWindowsEnvironmentVariable(
const char* varname);
1186 static std::string getProperty(
const char* prop);
1189 static std::string getDeviceName(
void);
1197 static const std::string getBashOutput(
const char* command);
1204 static std::string getEnvironmentVariable(
const char* variableName,
const char* defaultVal,
1205 const char* alternativeBashCommand =
nullptr);
1207 static std::string currentUser(
void);
1212 static std::string currentHost(
void);
1214 static bool termSupportsColor(
void);
1223 static void gettimeofday(
struct timeval* tv);
1232 static std::string timevalToString(
struct timeval tval,
const char* format,
1239 static unsigned long long getTimeDifference(
const struct timeval& endTime,
const struct timeval& startTime,
1243 static struct ::tm* buildTimeInfo(
struct timeval* currTime, struct ::tm* timeInfo);
1245 static char* parseFormat(
char*
buf, std::size_t bufSz,
const char* format,
const struct tm* tInfo,
1252 setArgs(0,
static_cast<char**
>(
nullptr));
1255 setArgs(argc, argv);
1258 setArgs(argc, argv);
1262 inline void setArgs(
int argc,
const char** argv) {
1263 setArgs(argc,
const_cast<char**
>(argv));
1266 void setArgs(
int argc,
char** argv);
1268 bool hasParamWithValue(
const char* paramKey)
const;
1271 const char* getParamValue(
const char* paramKey)
const;
1273 bool hasParam(
const char* paramKey)
const;
1275 bool empty(
void)
const;
1277 std::size_t size(
void)
const;
1292template <
typename T_Ptr,
typename Container>
1307 m_list = std::move(sr.m_list);
1311 if (size() != other.
size()) {
1314 for (std::size_t i = 0; i < m_list.size(); ++i) {
1315 if (m_list.at(i) != other.
m_list.at(i)) {
1323 if (size() != other.
size()) {
1326 for (std::size_t i = 0; i < m_list.size(); ++i) {
1327 if (m_list.at(i) != other.
m_list.at(i)) {
1340 m_list = std::move(sr.m_list);
1349 return m_list.begin();
1354 return m_list.end();
1360 return m_list.cbegin();
1365 return m_list.cend();
1370 return m_list.empty();
1375 return m_list.size();
1407template <
typename T_Ptr,
typename T_Key = const
char*>
1420 this->reinitDeepCopy(sr);
1430 this->reinitDeepCopy(sr);
1440 if (!this->empty()) {
1441 for (
auto&& curr : this->list()) {
1442 base::utils::safeDelete(curr.second);
1444 this->list().clear();
1450 unregister(uniqKey);
1451 this->list().insert(std::make_pair(uniqKey, ptr));
1456 T_Ptr* existing = get(uniqKey);
1457 if (existing !=
nullptr) {
1458 this->list().erase(uniqKey);
1459 base::utils::safeDelete(existing);
1464 T_Ptr*
get(
const T_Key& uniqKey) {
1465 iterator it = this->list().find(uniqKey);
1466 return it == this->list().end()
1474 registerNew(it->first,
new T_Ptr(*it->second));
1483template <
typename T_Ptr,
typename Pred>
1501 this->reinitDeepCopy(sr);
1511 this->reinitDeepCopy(sr);
1524 if (!this->empty()) {
1525 for (
auto&& curr : this->list()) {
1526 base::utils::safeDelete(curr);
1528 this->list().clear();
1535 for (; iter != this->end(); ++iter) {
1540 if (iter != this->end() && *iter !=
nullptr) {
1541 this->list().erase(iter);
1542 base::utils::safeDelete(*iter);
1548 this->list().push_back(ptr);
1553 template <
typename T,
typename T2>
1554 T_Ptr*
get(
const T& arg1,
const T2 arg2) {
1555 iterator iter = std::find_if(this->list().begin(), this->list().end(), Pred(arg1, arg2));
1556 if (iter != this->list().end() && *iter !=
nullptr) {
1564 for (
const_iterator it = sr.list().begin(); it != sr.list().end(); ++it) {
1565 registerNew(
new T_Ptr(**it));
1571 template <
typename T,
typename TPtr>
1572 static bool installCallback(
const std::string&
id, std::unordered_map<std::string, TPtr>* mapT) {
1573 if (mapT->find(
id) == mapT->end()) {
1574 mapT->insert(std::make_pair(
id, TPtr(
new T())));
1580 template <
typename T,
typename TPtr>
1582 if (mapT->find(
id) != mapT->end()) {
1587 template <
typename T,
typename TPtr>
1588 static T*
callback(
const std::string&
id, std::unordered_map<std::string, TPtr>* mapT) {
1589 typename std::unordered_map<std::string, TPtr>::iterator iter = mapT->find(
id);
1590 if (iter != mapT->end()) {
1591 return static_cast<T*
>(iter->second.get());
1632 return m_userFormat;
1640 return m_dateTimeFormat;
1648 return base::utils::hasFlag(flag, m_flags);
1662 virtual void updateFormatSpec(
void)
ELPP_FINAL;
1665 base::utils::addFlag(flag, &m_flags);
1687 m_formatSpecifier(formatSpecifier), m_resolver(resolver) {}
1689 return m_formatSpecifier;
1695 return strcmp(m_formatSpecifier, formatSpecifier) == 0;
1729 return m_configurationType;
1733 inline const std::string&
value(
void)
const {
1778 Configurations(
const std::string& configurationFile,
bool useDefaultsForRemaining =
true,
1790 bool parseFromFile(
const std::string& configurationFile,
Configurations*
base =
nullptr);
1800 bool parseFromText(
const std::string& configurationsString,
Configurations*
base =
nullptr);
1837 return RegistryWithPred<Configuration, Configuration::Predicate>::get(level, configurationType);
1845 setGlobally(configurationType,
value,
false);
1858 return m_configurationFile;
1862 void setToDefault(
void);
1871 void setRemainingToDefault(
void);
1886 static bool parseFromFile(
const std::string& configurationFile,
Configurations* sender,
1899 static bool parseFromText(
const std::string& configurationsString,
Configurations* sender,
1904 static void ignoreComments(std::string* line);
1905 static bool isLevel(
const std::string& line);
1906 static bool isComment(
const std::string& line);
1907 static inline bool isConfig(
const std::string& line);
1908 static bool parseLine(std::string* line, std::string* currConfigStr, std::string* currLevelStr,
Level* currLevel,
1925 void setGlobally(
ConfigurationType configurationType,
const std::string&
value,
bool includeGlobalLevel);
1929 void unsafeSetGlobally(
ConfigurationType configurationType,
const std::string&
value,
bool includeGlobalLevel);
1954 return m_configurations;
1957 bool enabled(
Level level);
1958 bool toFile(
Level level);
1959 const std::string& filename(
Level level);
1960 bool toStandardOutput(
Level level);
1964 bool performanceTracking(
Level level = Level::Global);
1966 std::size_t maxLogFileSize(
Level level);
1967 std::size_t logFlushThreshold(
Level level);
1989 template <
typename Conf_T>
1990 inline Conf_T
getConfigByVal(
Level level,
const std::unordered_map<Level, Conf_T>* confMap,
const char* confName) {
1992 return unsafeGetConfigByVal(level, confMap, confName);
1995 template <
typename Conf_T>
1996 inline Conf_T&
getConfigByRef(
Level level, std::unordered_map<Level, Conf_T>* confMap,
const char* confName) {
1998 return unsafeGetConfigByRef(level, confMap, confName);
2001 template <
typename Conf_T>
2004 typename std::unordered_map<Level, Conf_T>::const_iterator it = confMap->find(level);
2005 if (it == confMap->end()) {
2007 return confMap->at(Level::Global);
2010 << LevelHelper::convertToString(level) <<
"]"
2011 << std::endl <<
"Please ensure you have properly configured logger.",
false);
2018 template <
typename Conf_T>
2021 typename std::unordered_map<Level, Conf_T>::iterator it = confMap->find(level);
2022 if (it == confMap->end()) {
2024 return confMap->at(Level::Global);
2027 << LevelHelper::convertToString(level) <<
"]"
2028 << std::endl <<
"Please ensure you have properly configured logger.",
false);
2035 template <
typename Conf_T>
2037 bool includeGlobalLevel =
true) {
2039 if (confMap->empty() && includeGlobalLevel) {
2040 confMap->insert(std::make_pair(Level::Global,
value));
2044 typename std::unordered_map<Level, Conf_T>::iterator it = confMap->find(Level::Global);
2045 if (it != confMap->end() && it->second ==
value) {
2049 it = confMap->find(level);
2050 if (it == confMap->end()) {
2052 confMap->insert(std::make_pair(level,
value));
2055 confMap->at(level) =
value;
2060 unsigned long getULong(std::string confVal);
2061 std::string resolveFilename(
const std::string& filename);
2062 void insertFile(
Level level,
const std::string& fullFilename);
2067 return unsafeValidateFileRolling(level, preRollOutCallback);
2080 m_filename(filename),
2081 m_lineNumber(lineNumber),
2086 m_filename(hitCounter.m_filename),
2087 m_lineNumber(hitCounter.m_lineNumber),
2088 m_hitCounts(hitCounter.m_hitCounts) {
2092 if (&hitCounter !=
this) {
2105 m_filename = filename;
2106 m_lineNumber = lineNumber;
2111 if (m_hitCounts >= base::consts::kMaxLogPerCounter) {
2112 m_hitCounts = (n >= 1 ? base::consts::kMaxLogPerCounter % n : 0);
2122 return m_lineNumber;
2136 : m_filename(filename),
2137 m_lineNumber(lineNumber) {
2140 return ((counter !=
nullptr) &&
2141 (strcmp(counter->
m_filename, m_filename) == 0) &&
2173 return get(filename, lineNumber);
2181template <
typename T>
2190 m_enabled = enabled;
2201 return m_logMessage;
2204 return m_dispatchAction;
2207 m_logMessage = logMessage;
2210 m_dispatchAction = dispatchAction;
2224 std::unordered_map<std::string, std::unique_ptr<base::threading::Mutex>>
m_fileLocks;
2229 friend class base::PerformanceTracker;
2243 void setColor(
Color color,
bool bright);
2260 base::utils::safeDelete(m_typedConfigurations);
2271 void reconfigure(
void);
2273 inline const std::string&
id(
void)
const {
2278 return m_parentApplicationName;
2282 m_parentApplicationName = parentApplicationName;
2286 return &m_configurations;
2290 return m_typedConfigurations;
2293 static bool isValidId(
const std::string&
id);
2301 return ++m_unflushedCount.find(level)->second >= m_typedConfigurations->logFlushThreshold(level);
2305 return m_logBuilder.get();
2309 m_logBuilder = logBuilder;
2313 return m_typedConfigurations->enabled(level);
2316#if ELPP_VARIADIC_TEMPLATES_SUPPORTED
2317# define LOGGER_LEVEL_WRITERS_SIGNATURES(FUNCTION_NAME)\
2318template <typename T, typename... Args>\
2319inline void FUNCTION_NAME(const char*, const T&, const Args&...);\
2320template <typename T>\
2321inline void FUNCTION_NAME(const T&);
2323 template <
typename T,
typename... Args>
2324 inline void verbose(
int,
const char*,
const T&,
const Args&...);
2326 template <
typename T>
2327 inline void verbose(
int,
const T&);
2329 LOGGER_LEVEL_WRITERS_SIGNATURES(
info)
2330 LOGGER_LEVEL_WRITERS_SIGNATURES(debug)
2331 LOGGER_LEVEL_WRITERS_SIGNATURES(warn)
2332 LOGGER_LEVEL_WRITERS_SIGNATURES(error)
2333 LOGGER_LEVEL_WRITERS_SIGNATURES(fatal)
2334 LOGGER_LEVEL_WRITERS_SIGNATURES(trace)
2335# undef LOGGER_LEVEL_WRITERS_SIGNATURES
2357 friend class el::base::PerformanceTracker;
2362#if ELPP_VARIADIC_TEMPLATES_SUPPORTED
2363 template <
typename T,
typename... Args>
2364 void log_(
Level,
int,
const char*,
const T&,
const Args&...);
2366 template <
typename T>
2367 inline void log_(
Level,
int,
const T&);
2369 template <
typename T,
typename... Args>
2370 void log(
Level,
const char*,
const T&,
const Args&...);
2372 template <
typename T>
2376 void initUnflushedCount(
void);
2382 void resolveLoggerFormatSpec(
void)
const;
2396 m_defaultConfigurations.setFromBase(
const_cast<Configurations*
>(&configurations));
2400 return &m_defaultConfigurations;
2403 Logger* get(
const std::string&
id,
bool forceCreation =
true);
2405 template <
typename T>
2407 return base::utils::Utils::installCallback<T, base::type::LoggerRegistrationCallbackPtr>(
id,
2408 &m_loggerRegistrationCallbacks);
2411 template <
typename T>
2413 base::utils::Utils::uninstallCallback<T, base::type::LoggerRegistrationCallbackPtr>(
id, &m_loggerRegistrationCallbacks);
2416 template <
typename T>
2418 return base::utils::Utils::callback<T, base::type::LoggerRegistrationCallbackPtr>(
id, &m_loggerRegistrationCallbacks);
2421 bool remove(
const std::string&
id);
2423 inline bool has(
const std::string&
id) {
2424 return get(
id,
false) !=
nullptr;
2433 return &m_logStreamsReference;
2443 m_defaultLogBuilder = logBuilderPtr;
2453 void unsafeFlushAll(
void);
2467 void clearCategories(
void);
2474 void setCategories(
const char* categories,
bool clear =
true);
2476 std::string getCategories();
2478 void setModules(
const char* modules);
2480 bool priority_allowed(
int priority,
const std::string &category);
2481 bool allowed(
Level level,
const std::string &category);
2485 inline const std::unordered_map<std::string, base::type::VerboseLevel>&
modules(
void)
const {
2493 return !base::utils::hasFlag(LoggingFlag::DisableVModules, *m_pFlags);
2497 m_filenameCommonPrefix = prefix;
2501 return m_filenameCommonPrefix;
2507 std::unordered_map<std::string, base::type::VerboseLevel>
m_modules;
2518 m_level(level), m_color(color), m_file(file), m_line(line), m_func(func),
2519 m_verboseLevel(verboseLevel), m_logger(logger), m_message(msg ? *msg : logger->stream().
str()) {
2527 inline const std::string&
file(
void)
const {
2533 inline const std::string&
func(
void)
const {
2537 return m_verboseLevel;
2556#if ELPP_ASYNC_LOGGING
2560 : m_logMessage(logMessage), m_dispatchData(
data), m_logLine(logLine) {}
2561 virtual ~AsyncLogItem() {}
2563 return &m_logMessage;
2566 return &m_dispatchData;
2576class AsyncLogQueue :
public base::threading::ThreadSafe {
2578 virtual ~AsyncLogQueue() {
2582 inline AsyncLogItem
next(
void) {
2583 base::threading::ScopedLock scopedLock(lock());
2584 AsyncLogItem
result = m_queue.front();
2589 inline void push(
const AsyncLogItem& item) {
2590 base::threading::ScopedLock scopedLock(lock());
2593 inline void pop(
void) {
2594 base::threading::ScopedLock scopedLock(lock());
2597 inline AsyncLogItem front(
void) {
2598 base::threading::ScopedLock scopedLock(lock());
2599 return m_queue.front();
2601 inline bool empty(
void) {
2602 base::threading::ScopedLock scopedLock(lock());
2603 return m_queue.empty();
2606 std::queue<AsyncLogItem> m_queue;
2610 virtual ~IWorker() {}
2611 virtual void start() = 0;
2615class Storage : base::NoCopy, public base::threading::ThreadSafe {
2617#if ELPP_ASYNC_LOGGING
2626 return hitCounters()->validateEveryN(filename, lineNumber, occasion);
2630 return hitCounters()->validateAfterN(filename, lineNumber, n);
2634 return hitCounters()->validateNTimes(filename, lineNumber, n);
2638 return m_registeredHitCounters;
2642 return m_registeredLoggers;
2649#if ELPP_ASYNC_LOGGING
2650 inline base::AsyncLogQueue* asyncLogQueue(
void)
const {
2651 return m_asyncLogQueue;
2656 return &m_commandLineArgs;
2660 base::utils::addFlag(flag, &m_flags);
2664 base::utils::removeFlag(flag, &m_flags);
2668 return base::utils::hasFlag(flag, m_flags);
2680 m_preRollOutCallback = callback;
2684 m_preRollOutCallback = base::defaultPreRollOutCallback;
2688 return m_preRollOutCallback;
2691 bool hasCustomFormatSpecifier(
const char* formatSpecifier);
2693 bool uninstallCustomFormatSpecifier(
const char* formatSpecifier);
2696 return &m_customFormatSpecifiers;
2700 return m_customFormatSpecifiersLock;
2704 m_loggingLevel = level;
2707 template <
typename T>
2709 return base::utils::Utils::installCallback<T, base::type::LogDispatchCallbackPtr>(
id, &m_logDispatchCallbacks);
2712 template <
typename T>
2714 base::utils::Utils::uninstallCallback<T, base::type::LogDispatchCallbackPtr>(
id, &m_logDispatchCallbacks);
2716 template <
typename T>
2718 return base::utils::Utils::callback<T, base::type::LogDispatchCallbackPtr>(
id, &m_logDispatchCallbacks);
2721#if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING)
2722 template <
typename T>
2723 inline bool installPerformanceTrackingCallback(
const std::string&
id) {
2724 return base::utils::Utils::installCallback<T, base::type::PerformanceTrackingCallbackPtr>(
id,
2725 &m_performanceTrackingCallbacks);
2728 template <
typename T>
2729 inline void uninstallPerformanceTrackingCallback(
const std::string&
id) {
2730 base::utils::Utils::uninstallCallback<T, base::type::PerformanceTrackingCallbackPtr>(
id,
2731 &m_performanceTrackingCallbacks);
2734 template <
typename T>
2735 inline T* performanceTrackingCallback(
const std::string&
id) {
2736 return base::utils::Utils::callback<T, base::type::PerformanceTrackingCallbackPtr>(
id, &m_performanceTrackingCallbacks);
2742 if (
name.empty())
return;
2744 m_threadNames[base::threading::getCurrentThreadId()] =
name;
2749 std::unordered_map<std::string, std::string>::const_iterator it = m_threadNames.find(threadId);
2750 if (it == m_threadNames.end()) {
2763#if ELPP_ASYNC_LOGGING
2764 base::AsyncLogQueue* m_asyncLogQueue;
2765 base::IWorker* m_asyncDispatchWorker;
2782 friend class el::base::PerformanceTracker;
2785 void setApplicationArguments(
int argc,
char** argv);
2788 setApplicationArguments(argc,
const_cast<char**
>(argv));
2792#define ELPP el::base::Storage::getELPP()
2800#if ELPP_ASYNC_LOGGING
2807 AsyncDispatchWorker();
2808 virtual ~AsyncDispatchWorker();
2811 void emptyQueue(
void);
2812 virtual void start(
void);
2813 void handle(AsyncLogItem* logItem);
2816 void setContinueRunning(
bool value) {
2818 m_continueRunning =
value;
2821 bool continueRunning(
void)
const {
2822 return m_continueRunning;
2825 std::condition_variable cv;
2826 bool m_continueRunning;
2827 base::threading::Mutex m_continueRunningLock;
2841 m_logMessage(logMessage),
2842 m_dispatchAction(
std::move(dispatchAction)) {
2845 void dispatch(
void);
2852#if defined(ELPP_STL_LOGGING)
2859namespace workarounds {
2861template <
typename T,
typename Container>
2862class IterableContainer {
2864 typedef typename Container::iterator iterator;
2865 typedef typename Container::const_iterator const_iterator;
2866 IterableContainer(
void) {}
2867 virtual ~IterableContainer(
void) {}
2868 iterator begin(
void) {
2869 return getContainer().begin();
2871 iterator end(
void) {
2872 return getContainer().end();
2875 virtual Container& getContainer(
void) = 0;
2878template<
typename T,
typename Container = std::vector<T>,
typename Comparator = std::less<
typename Container::value_type>>
2879class IterablePriorityQueue :
public IterableContainer<T, Container>,
2880 public std::priority_queue<T, Container, Comparator> {
2882 IterablePriorityQueue(std::priority_queue<T, Container, Comparator> queue_) {
2884 while (++
count_ < base::consts::kMaxLogPerContainer && !queue_.empty()) {
2885 this->push(queue_.top());
2890 inline Container& getContainer(
void) {
2895template<
typename T,
typename Container = std::deque<T>>
2896class IterableQueue :
public IterableContainer<T, Container>,
public std::queue<T, Container> {
2898 IterableQueue(std::queue<T, Container> queue_) {
2900 while (++
count_ < base::consts::kMaxLogPerContainer && !queue_.empty()) {
2901 this->push(queue_.front());
2906 inline Container& getContainer(
void) {
2911template<
typename T,
typename Container = std::deque<T>>
2912class IterableStack :
public IterableContainer<T, Container>,
public std::stack<T, Container> {
2914 IterableStack(std::stack<T, Container> stack_) {
2916 while (++
count_ < base::consts::kMaxLogPerContainer && !stack_.empty()) {
2917 this->push(stack_.top());
2922 inline Container& getContainer(
void) {
2932 void initialize(
Logger* logger);
2934# define ELPP_SIMPLE_LOG(LOG_TYPE)\
2935MessageBuilder& operator<<(LOG_TYPE msg) {\
2936m_logger->stream() << msg;\
2937if (ELPP->hasFlag(LoggingFlag::AutoSpacing)) {\
2938m_logger->stream() << " ";\
2966 m_logger->stream() << OStreamMani;
2969#define ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(temp) \
2970template <typename T> \
2971inline MessageBuilder& operator<<(const temp<T>& template_inst) { \
2972return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \
2974#define ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(temp) \
2975template <typename T1, typename T2> \
2976inline MessageBuilder& operator<<(const temp<T1, T2>& template_inst) { \
2977return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \
2979#define ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(temp) \
2980template <typename T1, typename T2, typename T3> \
2981inline MessageBuilder& operator<<(const temp<T1, T2, T3>& template_inst) { \
2982return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \
2984#define ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(temp) \
2985template <typename T1, typename T2, typename T3, typename T4> \
2986inline MessageBuilder& operator<<(const temp<T1, T2, T3, T4>& template_inst) { \
2987return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \
2989#define ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(temp) \
2990template <typename T1, typename T2, typename T3, typename T4, typename T5> \
2991inline MessageBuilder& operator<<(const temp<T1, T2, T3, T4, T5>& template_inst) { \
2992return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \
2995#if defined(ELPP_STL_LOGGING)
3003 template <
class T,
class Container>
3004 inline MessageBuilder&
operator<<(
const std::queue<T, Container>& queue_) {
3005 base::workarounds::IterableQueue<T, Container> iterableQueue_ =
3006 static_cast<base::workarounds::IterableQueue<T, Container>
>(queue_);
3007 return writeIterator(iterableQueue_.begin(), iterableQueue_.end(), iterableQueue_.size());
3009 template <
class T,
class Container>
3010 inline MessageBuilder&
operator<<(
const std::stack<T, Container>& stack_) {
3011 base::workarounds::IterableStack<T, Container> iterableStack_ =
3012 static_cast<base::workarounds::IterableStack<T, Container>
>(stack_);
3013 return writeIterator(iterableStack_.begin(), iterableStack_.end(), iterableStack_.size());
3015 template <
class T,
class Container,
class Comparator>
3016 inline MessageBuilder&
operator<<(
const std::priority_queue<T, Container, Comparator>& priorityQueue_) {
3017 base::workarounds::IterablePriorityQueue<T, Container, Comparator> iterablePriorityQueue_ =
3018 static_cast<base::workarounds::IterablePriorityQueue<T, Container, Comparator>
>(priorityQueue_);
3019 return writeIterator(iterablePriorityQueue_.begin(), iterablePriorityQueue_.end(), iterablePriorityQueue_.size());
3021 template <
class First,
class Second>
3022 MessageBuilder&
operator<<(
const std::pair<First, Second>& pair_) {
3024 operator << (static_cast<First>(pair_.first));
3026 operator << (static_cast<Second>(pair_.second));
3030 template <std::
size_t Size>
3031 MessageBuilder&
operator<<(
const std::bitset<Size>& bitset_) {
3037# if defined(ELPP_LOG_STD_ARRAY)
3038 template <
class T, std::
size_t Size>
3039 inline MessageBuilder&
operator<<(
const std::array<T, Size>& array) {
3040 return writeIterator(array.begin(), array.end(), array.size());
3043# if defined(ELPP_LOG_UNORDERED_MAP)
3047# if defined(ELPP_LOG_UNORDERED_SET)
3052#if defined(ELPP_QT_LOGGING)
3053 inline MessageBuilder&
operator<<(
const QString& msg) {
3054# if defined(ELPP_UNICODE)
3055 m_logger->stream() << msg.toStdWString();
3057 m_logger->stream() << msg.toStdString();
3061 inline MessageBuilder&
operator<<(
const QByteArray& msg) {
3064 inline MessageBuilder&
operator<<(
const QStringRef& msg) {
3067 inline MessageBuilder&
operator<<(qint64 msg) {
3068# if defined(ELPP_UNICODE)
3069 m_logger->stream() << QString::number(msg).toStdWString();
3071 m_logger->stream() << QString::number(msg).toStdString();
3075 inline MessageBuilder&
operator<<(quint64 msg) {
3076# if defined(ELPP_UNICODE)
3077 m_logger->stream() << QString::number(msg).toStdWString();
3079 m_logger->stream() << QString::number(msg).toStdString();
3083 inline MessageBuilder&
operator<<(QChar msg) {
3084 m_logger->stream() << msg.toLatin1();
3087 inline MessageBuilder&
operator<<(
const QLatin1String& msg) {
3088 m_logger->stream() << msg.latin1();
3097 template <
typename First,
typename Second>
3098 MessageBuilder&
operator<<(
const QPair<First, Second>& pair_) {
3100 operator << (static_cast<First>(pair_.first));
3102 operator << (static_cast<Second>(pair_.second));
3106 template <
typename K,
typename V>
3109 QList<K> keys =
map_.keys();
3110 typename QList<K>::const_iterator begin = keys.
begin();
3111 typename QList<K>::const_iterator end = keys.end();
3112 int max_ =
static_cast<int>(base::consts::kMaxLogPerContainer);
3113 for (
int index_ = 0; begin != end && index_ <
max_; ++index_, ++begin) {
3115 operator << (static_cast<K>(*begin));
3117 operator << (static_cast<V>(
map_.value(*begin)));
3119 m_logger->stream() << ((index_ < keys.size() -1) ? m_containerLogSeperator :
ELPP_LITERAL(
""));
3127 template <
typename K,
typename V>
3132 template <
typename K,
typename V>
3133 MessageBuilder&
operator<<(
const QHash<K, V>& hash_) {
3135 QList<K> keys = hash_.keys();
3136 typename QList<K>::const_iterator begin = keys.begin();
3137 typename QList<K>::const_iterator end = keys.end();
3138 int max_ =
static_cast<int>(base::consts::kMaxLogPerContainer);
3139 for (
int index_ = 0; begin != end && index_ <
max_; ++index_, ++begin) {
3141 operator << (static_cast<K>(*begin));
3143 operator << (static_cast<V>(hash_.value(*begin)));
3145 m_logger->stream() << ((index_ < keys.size() -1) ? m_containerLogSeperator :
ELPP_LITERAL(
""));
3153 template <
typename K,
typename V>
3154 inline MessageBuilder&
operator<<(
const QMultiHash<K, V>& multiHash_) {
3155 operator << (
static_cast<QHash<K, V>
>(multiHash_));
3159#if defined(ELPP_BOOST_LOGGING)
3178#define MAKE_CONTAINERELPP_FRIENDLY(ContainerType, SizeMethod, ElementInstance) \
3179el::base::type::ostream_t& operator<<(el::base::type::ostream_t& ss, const ContainerType& container) {\
3180const el::base::type::char_t* sep = ELPP->hasFlag(el::LoggingFlag::NewLineForContainer) ? \
3181ELPP_LITERAL("\n ") : ELPP_LITERAL(", ");\
3182ContainerType::const_iterator elem = container.begin();\
3183ContainerType::const_iterator endElem = container.end();\
3184std::size_t size_ = container.SizeMethod; \
3185ss << ELPP_LITERAL("[");\
3186for (std::size_t i = 0; elem != endElem && i < el::base::consts::kMaxLogPerContainer; ++i, ++elem) { \
3187ss << ElementInstance;\
3188ss << ((i < size_ - 1) ? sep : ELPP_LITERAL(""));\
3190if (elem != endElem) {\
3191ss << ELPP_LITERAL("...");\
3193ss << ELPP_LITERAL("]");\
3196#if defined(ELPP_WXWIDGETS_LOGGING)
3198# define ELPP_WX_PTR_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), *(*elem))
3199# define ELPP_WX_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), (*elem))
3200# define ELPP_WX_HASH_MAP_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), \
3201ELPP_LITERAL("(") << elem->first << ELPP_LITERAL(", ") << elem->second << ELPP_LITERAL(")")
3203# define ELPP_WX_PTR_ENABLED(ContainerType)
3204# define ELPP_WX_ENABLED(ContainerType)
3205# define ELPP_WX_HASH_MAP_ENABLED(ContainerType)
3208 template <
class Class>
3210#undef ELPP_SIMPLE_LOG
3211#undef ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG
3212#undef ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG
3213#undef ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG
3214#undef ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG
3215#undef ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG
3220 template<
class Iterator>
3223 for (std::size_t i = 0; begin_ != end_ && i < base::consts::kMaxLogPerContainer; ++i, ++begin_) {
3225 m_logger->
stream() << ((i < size_ - 1) ? m_containerLogSeperator :
ELPP_LITERAL(
""));
3227 if (begin_ != end_) {
3231 if (
ELPP->hasFlag(LoggingFlag::AutoSpacing)) {
3232 m_logger->
stream() <<
" ";
3247 template <
typename T>
3262 m_msg(nullptr), m_level(level), m_color(color), m_file(file), m_line(line), m_func(func), m_verboseLevel(verboseLevel),
3263 m_logger(nullptr), m_proceed(
false), m_dispatchAction(dispatchAction) {
3267 m_msg(msg), m_level(msg != nullptr ? msg->level() :
Level::
Unknown),
3268 m_line(0), m_logger(nullptr), m_proceed(
false), m_dispatchAction(dispatchAction) {
3275 template <
typename T>
3276 inline typename std::enable_if<std::is_integral<T>::value,
Writer&>::type
3278#if ELPP_LOGGING_ENABLED
3280 m_messageBuilder <<
log;
3286 template <
typename T>
3287 inline typename std::enable_if<!std::is_integral<T>::value,
Writer&>::type
3289#if ELPP_LOGGING_ENABLED
3291 m_messageBuilder <<
log;
3298#if ELPP_LOGGING_ENABLED
3300 m_messageBuilder <<
log;
3310 Writer& construct(
Logger* logger,
bool needLock =
true);
3311 Writer& construct(
int count,
const char* loggerIds, ...);
3312 Writer& construct(
const char *loggerId);
3328 void initializeLogger(
const std::string& loggerId,
bool lookup =
true,
bool needLock =
true);
3329 void initializeLogger(
Logger *logger,
bool needLock =
true);
3330 void processDispatch();
3331 void triggerDispatch(
void);
3338 base::
Writer(level, color, file, line, func, dispatchAction, verboseLevel) {
3345#if ELPP_VARIADIC_TEMPLATES_SUPPORTED
3346template <
typename T,
typename... Args>
3347void Logger::log_(Level level,
int vlevel,
const char*
s,
const T&
value,
const Args&... args) {
3348 base::MessageBuilder
b;
3351 if (*
s == base::consts::kFormatSpecifierChar) {
3352 if (*(
s + 1) == base::consts::kFormatSpecifierChar) {
3355 if (*(
s + 1) == base::consts::kFormatSpecifierCharValue) {
3358 log_(level, vlevel, ++
s,
args...);
3365 ELPP_INTERNAL_ERROR(
"Too many arguments provided. Unable to handle. Please provide more format specifiers",
false);
3367template <
typename T>
3368void Logger::log_(Level level,
int vlevel,
const T&
log) {
3369 if (level == Level::Verbose) {
3370 if (
ELPP->vRegistry()->allowed(vlevel, __FILE__)) {
3371 base::Writer(Level::Verbose, Color::Default,
"FILE", 0,
"FUNCTION",
3372 base::DispatchAction::NormalLog, vlevel).construct(
this,
false) <<
log;
3378 base::Writer(level, Color::Default,
"FILE", 0,
"FUNCTION").construct(
this,
false) <<
log;
3381template <
typename T,
typename...
Args>
3382inline void Logger::log(Level level,
const char*
s,
const T&
value,
const Args&... args) {
3386template <
typename T>
3387inline void Logger::log(Level level,
const T&
log) {
3389 log_(level, 0,
log);
3391# if ELPP_VERBOSE_LOG
3392template <
typename T,
typename...
Args>
3393inline void Logger::verbose(
int vlevel,
const char*
s,
const T&
value,
const Args&... args) {
3397template <
typename T>
3398inline void Logger::verbose(
int vlevel,
const T&
log) {
3403template <
typename T,
typename...
Args>
3404inline void Logger::verbose(
int,
const char*,
const T&,
const Args&...) {
3407template <
typename T>
3408inline void Logger::verbose(
int,
const T&) {
3412# define LOGGER_LEVEL_WRITERS(FUNCTION_NAME, LOG_LEVEL)\
3413template <typename T, typename... Args>\
3414inline void Logger::FUNCTION_NAME(const char* s, const T& value, const Args&... args) {\
3415log(LOG_LEVEL, s, value, args...);\
3417template <typename T>\
3418inline void Logger::FUNCTION_NAME(const T& value) {\
3419log(LOG_LEVEL, value);\
3421# define LOGGER_LEVEL_WRITERS_DISABLED(FUNCTION_NAME, LOG_LEVEL)\
3422template <typename T, typename... Args>\
3423inline void Logger::FUNCTION_NAME(const char*, const T&, const Args&...) {\
3426template <typename T>\
3427inline void Logger::FUNCTION_NAME(const T&) {\
3432LOGGER_LEVEL_WRITERS(
info, Level::Info)
3434LOGGER_LEVEL_WRITERS_DISABLED(
info, Level::Info)
3437LOGGER_LEVEL_WRITERS(debug, Level::Debug)
3439LOGGER_LEVEL_WRITERS_DISABLED(debug, Level::Debug)
3441# if ELPP_WARNING_LOG
3442LOGGER_LEVEL_WRITERS(warn, Level::Warning)
3444LOGGER_LEVEL_WRITERS_DISABLED(warn, Level::Warning)
3447LOGGER_LEVEL_WRITERS(error, Level::Error)
3449LOGGER_LEVEL_WRITERS_DISABLED(error, Level::Error)
3452LOGGER_LEVEL_WRITERS(fatal, Level::Fatal)
3454LOGGER_LEVEL_WRITERS_DISABLED(fatal, Level::Fatal)
3457LOGGER_LEVEL_WRITERS(trace, Level::Trace)
3459LOGGER_LEVEL_WRITERS_DISABLED(trace, Level::Trace)
3461# undef LOGGER_LEVEL_WRITERS
3462# undef LOGGER_LEVEL_WRITERS_DISABLED
3464#if ELPP_COMPILER_MSVC
3465# define ELPP_VARIADIC_FUNC_MSVC(variadicFunction, variadicArgs) variadicFunction variadicArgs
3466# define ELPP_VARIADIC_FUNC_MSVC_RUN(variadicFunction, ...) ELPP_VARIADIC_FUNC_MSVC(variadicFunction, (__VA_ARGS__))
3467# define el_getVALength(...) ELPP_VARIADIC_FUNC_MSVC_RUN(el_resolveVALength, 0, ## __VA_ARGS__,\
346810, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
3470# if ELPP_COMPILER_CLANG
3471# define el_getVALength(...) el_resolveVALength(0, __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
3473# define el_getVALength(...) el_resolveVALength(0, ## __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
3476#define el_resolveVALength(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
3477#define ELPP_WRITE_LOG(writer, level, dispatchAction, ...) \
3478writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__)
3479#define ELPP_WRITE_LOG_IF(writer, condition, level, dispatchAction, ...) if (condition) \
3480writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__)
3481#define ELPP_WRITE_LOG_EVERY_N(writer, occasion, level, dispatchAction, ...) \
3482ELPP->validateEveryNCounter(__FILE__, __LINE__, occasion) && \
3483writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__)
3484#define ELPP_WRITE_LOG_AFTER_N(writer, n, level, dispatchAction, ...) \
3485ELPP->validateAfterNCounter(__FILE__, __LINE__, n) && \
3486writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__)
3487#define ELPP_WRITE_LOG_N_TIMES(writer, n, level, dispatchAction, ...) \
3488ELPP->validateNTimesCounter(__FILE__, __LINE__, n) && \
3489writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__)
3490#if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING)
3491class PerformanceTrackingData {
3493 enum class DataType : base::type::EnumType {
3494 Checkpoint = 1, Complete = 2
3497 explicit PerformanceTrackingData(DataType dataType) : m_performanceTracker(
nullptr),
3498 m_dataType(dataType), m_firstCheckpoint(
false), m_file(
""), m_line(0), m_func(
"") {}
3499 inline const std::string* blockName(
void)
const;
3500 inline const struct timeval* startTime(
void)
const;
3501 inline const struct timeval* endTime(
void)
const;
3502 inline const struct timeval* lastCheckpointTime(
void)
const;
3503 inline const base::PerformanceTracker* performanceTracker(
void)
const {
3504 return m_performanceTracker;
3506 inline PerformanceTrackingData::DataType dataType(
void)
const {
3509 inline bool firstCheckpoint(
void)
const {
3510 return m_firstCheckpoint;
3512 inline std::string checkpointId(
void)
const {
3513 return m_checkpointId;
3515 inline const char* file(
void)
const {
3518 inline base::type::LineNumber line(
void)
const {
3521 inline const char* func(
void)
const {
3524 inline const base::type::string_t* formattedTimeTaken()
const {
3525 return &m_formattedTimeTaken;
3527 inline const std::string& loggerId(
void)
const;
3529 base::PerformanceTracker* m_performanceTracker;
3530 base::type::string_t m_formattedTimeTaken;
3531 PerformanceTrackingData::DataType m_dataType;
3532 bool m_firstCheckpoint;
3533 std::string m_checkpointId;
3535 base::type::LineNumber m_line;
3537 inline void init(base::PerformanceTracker* performanceTracker,
bool firstCheckpoint =
false) {
3538 m_performanceTracker = performanceTracker;
3539 m_firstCheckpoint = firstCheckpoint;
3542 friend class el::base::PerformanceTracker;
3547class PerformanceTracker :
public base::threading::ThreadSafe,
public Loggable {
3549 PerformanceTracker(
const std::string& blockName,
3550 base::TimestampUnit timestampUnit = base::TimestampUnit::Millisecond,
3551 const std::string& loggerId = std::string(el::base::consts::kPerformanceLoggerId),
3552 bool scopedLog =
true, Level level = base::consts::kPerformanceTrackerDefaultLevel);
3554 PerformanceTracker(
const PerformanceTracker& t) :
3555 m_blockName(
t.m_blockName), m_timestampUnit(
t.m_timestampUnit), m_loggerId(
t.m_loggerId), m_scopedLog(
t.m_scopedLog),
3556 m_level(
t.m_level), m_hasChecked(
t.m_hasChecked), m_lastCheckpointId(
t.m_lastCheckpointId), m_enabled(
t.m_enabled),
3557 m_startTime(
t.m_startTime), m_endTime(
t.m_endTime), m_lastCheckpointTime(
t.m_lastCheckpointTime) {
3559 virtual ~PerformanceTracker(
void);
3561 void checkpoint(
const std::string&
id = std::string(),
const char* file = __FILE__,
3562 base::type::LineNumber line = __LINE__,
3563 const char* func =
"");
3564 inline Level level(
void)
const {
3568 std::string m_blockName;
3569 base::TimestampUnit m_timestampUnit;
3570 std::string m_loggerId;
3574 std::string m_lastCheckpointId;
3576 struct timeval m_startTime, m_endTime, m_lastCheckpointTime;
3578 PerformanceTracker(
void);
3580 friend class el::PerformanceTrackingData;
3581 friend class base::DefaultPerformanceTrackingCallback;
3583 const inline base::type::string_t getFormattedTimeTaken()
const {
3584 return getFormattedTimeTaken(m_startTime);
3587 const base::type::string_t getFormattedTimeTaken(
struct timeval startTime)
const;
3590 os << getFormattedTimeTaken();
3593class DefaultPerformanceTrackingCallback :
public PerformanceTrackingCallback {
3595 void handle(
const PerformanceTrackingData*
data) {
3597 base::type::stringstream_t ss;
3598 if (
m_data->dataType() == PerformanceTrackingData::DataType::Complete) {
3603 if (!
m_data->checkpointId().empty()) {
3607 *
m_data->performanceTracker();
3608 if (!
ELPP->hasFlag(LoggingFlag::DisablePerformanceTrackingCheckpointComparison)
3609 &&
m_data->performanceTracker()->m_hasChecked) {
3611 if (
m_data->performanceTracker()->m_lastCheckpointId.empty()) {
3622 m_data->loggerId().c_str()) << ss.str();
3625 const PerformanceTrackingData*
m_data;
3628inline const std::string* PerformanceTrackingData::blockName()
const {
3629 return const_cast<const std::string*
>(&m_performanceTracker->m_blockName);
3631inline const struct timeval* PerformanceTrackingData::startTime()
const {
3632 return const_cast<const struct timeval*
>(&m_performanceTracker->m_startTime);
3634inline const struct timeval* PerformanceTrackingData::endTime()
const {
3635 return const_cast<const struct timeval*
>(&m_performanceTracker->m_endTime);
3637inline const struct timeval* PerformanceTrackingData::lastCheckpointTime()
const {
3638 return const_cast<const struct timeval*
>(&m_performanceTracker->m_lastCheckpointTime);
3640inline const std::string& PerformanceTrackingData::loggerId(
void)
const {
3641 return m_performanceTracker->m_loggerId;
3647#if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_CRASH_LOG)
3648class StackTrace : base::NoCopy {
3650 static const unsigned int kMaxStack = 64;
3651 static const unsigned int kStackStart = 2;
3652 class StackTraceEntry {
3654 StackTraceEntry(std::size_t index,
const std::string& loc,
const std::string& demang,
const std::string&
hex,
3655 const std::string& addr);
3656 StackTraceEntry(std::size_t index,
const std::string& loc) :
3660 std::size_t m_index;
3661 std::string m_location;
3662 std::string m_demangled;
3665 friend std::ostream&
operator<<(std::ostream& ss,
const StackTraceEntry&
si);
3668 StackTraceEntry(
void);
3675 virtual ~StackTrace(
void) {
3678 inline std::vector<StackTraceEntry>& getLatestStack(
void) {
3682 friend std::ostream&
operator<<(std::ostream& os,
const StackTrace& st);
3685 std::vector<StackTraceEntry> m_stack;
3687 void generateNew(
void);
3690class CrashHandler : base::NoCopy {
3694 explicit CrashHandler(
bool useDefault);
3695 explicit CrashHandler(
const Handler& cHandler) {
3696 setHandler(cHandler);
3698 void setHandler(
const Handler& cHandler);
3711extern base::debug::CrashHandler elCrashHandler;
3712#define MAKE_LOGGABLE(ClassType, ClassInstance, OutputStreamInstance) \
3713el::base::type::ostream_t& operator<<(el::base::type::ostream_t& OutputStreamInstance, const ClassType& ClassInstance)
3718#if defined(ELPP_SYSLOG)
3719 openlog(processIdent, options, facility);
3727#if defined(ELPP_SYSLOG)
3732#define ELPP_INITIALIZE_SYSLOG(id, opt, fac) el::SysLogInitializer elSyslogInit(id, opt, fac)
3745 static inline void setArgs(
int argc,
char** argv) {
3746 ELPP->setApplicationArguments(argc, argv);
3749 static inline void setArgs(
int argc,
const char** argv) {
3750 ELPP->setApplicationArguments(argc,
const_cast<char**
>(argv));
3757 return ELPP->getThreadName(base::threading::getCurrentThreadId());
3759#if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_CRASH_LOG)
3763 static inline void setCrashHandler(
const el::base::debug::CrashHandler::Handler& crashHandler) {
3768 static void crashAbort(
int sig,
const char* sourceFile =
"",
unsigned int long line = 0);
3774 static void logCrashReason(
int sig,
bool stackTraceIfAvailable =
false,
3775 Level level = Level::Fatal,
const char* logger = base::consts::kDefaultLoggerId);
3779 static inline void installPreRollOutCallback(const PreRollOutCallback& callback) {
3780 ELPP->setPreRollOutCallback(callback);
3784 ELPP->unsetPreRollOutCallback();
3787 template <
typename T>
3789 return ELPP->installLogDispatchCallback<
T>(
id);
3792 template <
typename T>
3794 ELPP->uninstallLogDispatchCallback<
T>(
id);
3796 template <
typename T>
3798 return ELPP->logDispatchCallback<
T>(
id);
3800#if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING)
3802 template <
typename T>
3803 static inline bool installPerformanceTrackingCallback(
const std::string&
id) {
3804 return ELPP->installPerformanceTrackingCallback<
T>(
id);
3807 template <
typename T>
3808 static inline void uninstallPerformanceTrackingCallback(
const std::string&
id) {
3809 ELPP->uninstallPerformanceTrackingCallback<
T>(
id);
3811 template <
typename T>
3812 static inline T* performanceTrackingCallback(
const std::string&
id) {
3813 return ELPP->performanceTrackingCallback<
T>(
id);
3817 template <typename T>
3821 if (logger ==
nullptr) {
3822 return std::string();
3825 b.initialize(logger);
3828#if defined(ELPP_UNICODE)
3829 std::string
s = std::string(logger->
stream().str().begin(), logger->
stream().str().end());
3831 std::string
s = logger->
stream().str();
3839 return ELPP->commandLineArgs();
3844 ELPP->m_customFormatSpecifiers.reserve(size);
3848 ELPP->installCustomFormatSpecifier(customFormatSpecifier);
3852 return ELPP->uninstallCustomFormatSpecifier(formatSpecifier);
3856 return ELPP->hasCustomFormatSpecifier(formatSpecifier);
3859 if (
ELPP ==
nullptr || logger ==
nullptr)
return;
3867 static bool allowed(
Level leve,
const char* cat);
3869 static Logger* getLogger(
const std::string& identity,
bool registerIfNotAvailable =
true);
3873 template <
typename T>
3875 return ELPP->registeredLoggers()->installLoggerRegistrationCallback<
T>(
id);
3878 template <
typename T>
3880 ELPP->registeredLoggers()->uninstallLoggerRegistrationCallback<
T>(
id);
3882 template <
typename T>
3884 return ELPP->registeredLoggers()->loggerRegistrationCallback<
T>(
id);
3888 static bool unregisterLogger(
const std::string& identity);
3890 static bool hasLogger(
const std::string& identity);
3894 static Logger* reconfigureLogger(
const std::string& identity,
const Configurations& configurations);
3897 const std::string&
value);
3899 static void reconfigureAllLoggers(
const Configurations& configurations);
3902 reconfigureAllLoggers(Level::Global, configurationType,
value);
3906 const std::string&
value);
3908 static void setDefaultConfigurations(
const Configurations& configurations,
3909 bool reconfigureExistingLoggers =
false);
3918 static std::vector<std::string>* populateAllLoggerIds(std::vector<std::string>* targetList);
3920 static void configureFromGlobal(
const char* globalConfigurationFilePath);
3925 static bool configureFromArg(
const char* argKey);
3927 static void flushAll(
void);
3930 ELPP->addFlag(flag);
3934 ELPP->removeFlag(flag);
3938 return ELPP->hasFlag(flag);
3944 Loggers::addFlag(m_flag);
3947 Loggers::removeFlag(m_flag);
3956 Loggers::removeFlag(m_flag);
3959 Loggers::addFlag(m_flag);
3966 ELPP->setLoggingLevel(level);
3973 static void setVModules(
const char* modules);
3975 static void setCategories(
const char* categories,
bool clear =
true);
3977 static std::string getCategories();
3979 static void clearVModules(
void);
3981 static void clearCategories(
void);
3983 static void setFilenameCommonPrefix(
const std::string &prefix);
3985 static const std::string &getFilenameCommonPrefix();
3990 static const std::string
version(
void);
3993 static const std::string releaseDate(
void);
3998#define VLOG_IS_ON(verboseLevel) (ELPP->vRegistry()->allowed(verboseLevel, __FILE__))
4001#undef TIMED_SCOPE_IF
4005#if defined(ELPP_PERFORMANCE_MICROSECONDS)
4006# define ELPP_MIN_UNIT el::base::TimestampUnit::Microsecond
4008# define ELPP_MIN_UNIT el::base::TimestampUnit::Millisecond
4017#define TIMED_SCOPE_IF(obj, blockname, condition) el::base::type::PerformanceTrackerPtr obj( condition ? \
4018 new el::base::PerformanceTracker(blockname, ELPP_MIN_UNIT) : nullptr )
4019#define TIMED_SCOPE(obj, blockname) TIMED_SCOPE_IF(obj, blockname, true)
4020#define TIMED_BLOCK(obj, blockName) for (struct { int i; el::base::type::PerformanceTrackerPtr timer; } obj = { 0, \
4021 el::base::type::PerformanceTrackerPtr(new el::base::PerformanceTracker(blockName, ELPP_MIN_UNIT)) }; obj.i < 1; ++obj.i)
4028#define TIMED_FUNC_IF(obj,condition) TIMED_SCOPE_IF(obj, ELPP_FUNC, condition)
4029#define TIMED_FUNC(obj) TIMED_SCOPE(obj, ELPP_FUNC)
4030#undef PERFORMANCE_CHECKPOINT
4031#undef PERFORMANCE_CHECKPOINT_WITH_ID
4032#define PERFORMANCE_CHECKPOINT(obj) obj->checkpoint(std::string(), __FILE__, __LINE__, ELPP_FUNC)
4033#define PERFORMANCE_CHECKPOINT_WITH_ID(obj, id) obj->checkpoint(id, __FILE__, __LINE__, ELPP_FUNC)
4035#undef ELPP_COUNTER_POS
4037#define ELPP_COUNTER (ELPP->hitCounters()->getCounter(__FILE__, __LINE__))
4039#define ELPP_COUNTER_POS (ELPP_COUNTER == nullptr ? -1 : ELPP_COUNTER->hitCounts())
4064#undef CWARNING_EVERY_N
4065#undef CDEBUG_EVERY_N
4066#undef CERROR_EVERY_N
4067#undef CFATAL_EVERY_N
4068#undef CTRACE_EVERY_N
4069#undef CVERBOSE_EVERY_N
4071#undef CWARNING_AFTER_N
4072#undef CDEBUG_AFTER_N
4073#undef CERROR_AFTER_N
4074#undef CFATAL_AFTER_N
4075#undef CTRACE_AFTER_N
4076#undef CVERBOSE_AFTER_N
4078#undef CWARNING_N_TIMES
4079#undef CDEBUG_N_TIMES
4080#undef CERROR_N_TIMES
4081#undef CFATAL_N_TIMES
4082#undef CTRACE_N_TIMES
4083#undef CVERBOSE_N_TIMES
4086# define CINFO(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Info, dispatchAction, __VA_ARGS__)
4088# define CINFO(writer, dispatchAction, ...) el::base::NullWriter()
4091# define CWARNING(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Warning, dispatchAction, __VA_ARGS__)
4093# define CWARNING(writer, dispatchAction, ...) el::base::NullWriter()
4096# define CDEBUG(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Debug, dispatchAction, __VA_ARGS__)
4098# define CDEBUG(writer, dispatchAction, ...) el::base::NullWriter()
4101# define CERROR(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Error, dispatchAction, __VA_ARGS__)
4103# define CERROR(writer, dispatchAction, ...) el::base::NullWriter()
4106# define CFATAL(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Fatal, dispatchAction, __VA_ARGS__)
4108# define CFATAL(writer, dispatchAction, ...) el::base::NullWriter()
4111# define CTRACE(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Trace, dispatchAction, __VA_ARGS__)
4113# define CTRACE(writer, dispatchAction, ...) el::base::NullWriter()
4116# define CVERBOSE(writer, vlevel, dispatchAction, ...) if (VLOG_IS_ON(vlevel)) writer(\
4117el::Level::Verbose, __FILE__, __LINE__, ELPP_FUNC, dispatchAction, vlevel).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__)
4119# define CVERBOSE(writer, vlevel, dispatchAction, ...) el::base::NullWriter()
4123# define CINFO_IF(writer, condition_, dispatchAction, ...) \
4124ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Info, dispatchAction, __VA_ARGS__)
4126# define CINFO_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter()
4129# define CWARNING_IF(writer, condition_, dispatchAction, ...)\
4130ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Warning, dispatchAction, __VA_ARGS__)
4132# define CWARNING_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter()
4135# define CDEBUG_IF(writer, condition_, dispatchAction, ...)\
4136ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Debug, dispatchAction, __VA_ARGS__)
4138# define CDEBUG_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter()
4141# define CERROR_IF(writer, condition_, dispatchAction, ...)\
4142ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Error, dispatchAction, __VA_ARGS__)
4144# define CERROR_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter()
4147# define CFATAL_IF(writer, condition_, dispatchAction, ...)\
4148ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Fatal, dispatchAction, __VA_ARGS__)
4150# define CFATAL_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter()
4153# define CTRACE_IF(writer, condition_, dispatchAction, ...)\
4154ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Trace, dispatchAction, __VA_ARGS__)
4156# define CTRACE_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter()
4159# define CVERBOSE_IF(writer, condition_, vlevel, dispatchAction, ...) if (VLOG_IS_ON(vlevel) && (condition_)) writer( \
4160el::Level::Verbose, __FILE__, __LINE__, ELPP_FUNC, dispatchAction, vlevel).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__)
4162# define CVERBOSE_IF(writer, condition_, vlevel, dispatchAction, ...) el::base::NullWriter()
4166# define CINFO_EVERY_N(writer, occasion, dispatchAction, ...)\
4167ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Info, dispatchAction, __VA_ARGS__)
4169# define CINFO_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter()
4172# define CWARNING_EVERY_N(writer, occasion, dispatchAction, ...)\
4173ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Warning, dispatchAction, __VA_ARGS__)
4175# define CWARNING_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter()
4178# define CDEBUG_EVERY_N(writer, occasion, dispatchAction, ...)\
4179ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Debug, dispatchAction, __VA_ARGS__)
4181# define CDEBUG_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter()
4184# define CERROR_EVERY_N(writer, occasion, dispatchAction, ...)\
4185ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Error, dispatchAction, __VA_ARGS__)
4187# define CERROR_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter()
4190# define CFATAL_EVERY_N(writer, occasion, dispatchAction, ...)\
4191ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Fatal, dispatchAction, __VA_ARGS__)
4193# define CFATAL_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter()
4196# define CTRACE_EVERY_N(writer, occasion, dispatchAction, ...)\
4197ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Trace, dispatchAction, __VA_ARGS__)
4199# define CTRACE_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter()
4202# define CVERBOSE_EVERY_N(writer, occasion, vlevel, dispatchAction, ...)\
4203CVERBOSE_IF(writer, ELPP->validateEveryNCounter(__FILE__, __LINE__, occasion), vlevel, dispatchAction, __VA_ARGS__)
4205# define CVERBOSE_EVERY_N(writer, occasion, vlevel, dispatchAction, ...) el::base::NullWriter()
4209# define CINFO_AFTER_N(writer, n, dispatchAction, ...)\
4210ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Info, dispatchAction, __VA_ARGS__)
4212# define CINFO_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter()
4215# define CWARNING_AFTER_N(writer, n, dispatchAction, ...)\
4216ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Warning, dispatchAction, __VA_ARGS__)
4218# define CWARNING_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter()
4221# define CDEBUG_AFTER_N(writer, n, dispatchAction, ...)\
4222ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Debug, dispatchAction, __VA_ARGS__)
4224# define CDEBUG_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter()
4227# define CERROR_AFTER_N(writer, n, dispatchAction, ...)\
4228ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Error, dispatchAction, __VA_ARGS__)
4230# define CERROR_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter()
4233# define CFATAL_AFTER_N(writer, n, dispatchAction, ...)\
4234ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Fatal, dispatchAction, __VA_ARGS__)
4236# define CFATAL_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter()
4239# define CTRACE_AFTER_N(writer, n, dispatchAction, ...)\
4240ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Trace, dispatchAction, __VA_ARGS__)
4242# define CTRACE_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter()
4245# define CVERBOSE_AFTER_N(writer, n, vlevel, dispatchAction, ...)\
4246CVERBOSE_IF(writer, ELPP->validateAfterNCounter(__FILE__, __LINE__, n), vlevel, dispatchAction, __VA_ARGS__)
4248# define CVERBOSE_AFTER_N(writer, n, vlevel, dispatchAction, ...) el::base::NullWriter()
4252# define CINFO_N_TIMES(writer, n, dispatchAction, ...)\
4253ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Info, dispatchAction, __VA_ARGS__)
4255# define CINFO_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter()
4258# define CWARNING_N_TIMES(writer, n, dispatchAction, ...)\
4259ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Warning, dispatchAction, __VA_ARGS__)
4261# define CWARNING_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter()
4264# define CDEBUG_N_TIMES(writer, n, dispatchAction, ...)\
4265ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Debug, dispatchAction, __VA_ARGS__)
4267# define CDEBUG_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter()
4270# define CERROR_N_TIMES(writer, n, dispatchAction, ...)\
4271ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Error, dispatchAction, __VA_ARGS__)
4273# define CERROR_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter()
4276# define CFATAL_N_TIMES(writer, n, dispatchAction, ...)\
4277ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Fatal, dispatchAction, __VA_ARGS__)
4279# define CFATAL_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter()
4282# define CTRACE_N_TIMES(writer, n, dispatchAction, ...)\
4283ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Trace, dispatchAction, __VA_ARGS__)
4285# define CTRACE_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter()
4288# define CVERBOSE_N_TIMES(writer, n, vlevel, dispatchAction, ...)\
4289CVERBOSE_IF(writer, ELPP->validateNTimesCounter(__FILE__, __LINE__, n), vlevel, dispatchAction, __VA_ARGS__)
4291# define CVERBOSE_N_TIMES(writer, n, vlevel, dispatchAction, ...) el::base::NullWriter()
4301#undef CLOG_VERBOSE_IF
4310#define CLOG(LEVEL, ...)\
4311C##LEVEL(el::base::Writer, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4312#define CVLOG(vlevel, ...) CVERBOSE(el::base::Writer, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4314#define CLOG_IF(condition, LEVEL, ...)\
4315C##LEVEL##_IF(el::base::Writer, condition, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4316#define CVLOG_IF(condition, vlevel, ...)\
4317CVERBOSE_IF(el::base::Writer, condition, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4319#define CLOG_EVERY_N(n, LEVEL, ...)\
4320C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4321#define CVLOG_EVERY_N(n, vlevel, ...)\
4322CVERBOSE_EVERY_N(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4323#define CLOG_AFTER_N(n, LEVEL, ...)\
4324C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4325#define CVLOG_AFTER_N(n, vlevel, ...)\
4326CVERBOSE_AFTER_N(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4327#define CLOG_N_TIMES(n, LEVEL, ...)\
4328C##LEVEL##_N_TIMES(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4329#define CVLOG_N_TIMES(n, vlevel, ...)\
4330CVERBOSE_N_TIMES(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4345#undef ELPP_CURR_FILE_LOGGER_ID
4346#if defined(ELPP_DEFAULT_LOGGER)
4347# define ELPP_CURR_FILE_LOGGER_ID ELPP_DEFAULT_LOGGER
4349# define ELPP_CURR_FILE_LOGGER_ID el::base::consts::kDefaultLoggerId
4352#define ELPP_TRACE CLOG(TRACE, ELPP_CURR_FILE_LOGGER_ID)
4354#define LOG(LEVEL) CLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4355#define VLOG(vlevel) CVLOG(vlevel, ELPP_CURR_FILE_LOGGER_ID)
4357#define LOG_IF(condition, LEVEL) CLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4358#define VLOG_IF(condition, vlevel) CVLOG_IF(condition, vlevel, ELPP_CURR_FILE_LOGGER_ID)
4360#define LOG_EVERY_N(n, LEVEL) CLOG_EVERY_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4361#define VLOG_EVERY_N(n, vlevel) CVLOG_EVERY_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID)
4362#define LOG_AFTER_N(n, LEVEL) CLOG_AFTER_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4363#define VLOG_AFTER_N(n, vlevel) CVLOG_AFTER_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID)
4364#define LOG_N_TIMES(n, LEVEL) CLOG_N_TIMES(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4365#define VLOG_N_TIMES(n, vlevel) CVLOG_N_TIMES(n, vlevel, ELPP_CURR_FILE_LOGGER_ID)
4375#define CPLOG(LEVEL, ...)\
4376C##LEVEL(el::base::PErrorWriter, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4377#define CPLOG_IF(condition, LEVEL, ...)\
4378C##LEVEL##_IF(el::base::PErrorWriter, condition, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4379#define DCPLOG(LEVEL, ...)\
4380if (ELPP_DEBUG_LOG) C##LEVEL(el::base::PErrorWriter, el::base::DispatchAction::NormalLog, __VA_ARGS__)
4381#define DCPLOG_IF(condition, LEVEL, ...)\
4382C##LEVEL##_IF(el::base::PErrorWriter, (ELPP_DEBUG_LOG) && (condition), el::base::DispatchAction::NormalLog, __VA_ARGS__)
4383#define PLOG(LEVEL) CPLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4384#define PLOG_IF(condition, LEVEL) CPLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4385#define DPLOG(LEVEL) DCPLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4386#define DPLOG_IF(condition, LEVEL) DCPLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4390#undef CSYSLOG_EVERY_N
4391#undef CSYSLOG_AFTER_N
4392#undef CSYSLOG_N_TIMES
4395#undef SYSLOG_EVERY_N
4396#undef SYSLOG_AFTER_N
4397#undef SYSLOG_N_TIMES
4400#undef DCSYSLOG_EVERY_N
4401#undef DCSYSLOG_AFTER_N
4402#undef DCSYSLOG_N_TIMES
4405#undef DSYSLOG_EVERY_N
4406#undef DSYSLOG_AFTER_N
4407#undef DSYSLOG_N_TIMES
4408#if defined(ELPP_SYSLOG)
4409# define CSYSLOG(LEVEL, ...)\
4410C##LEVEL(el::base::Writer, el::base::DispatchAction::SysLog, __VA_ARGS__)
4411# define CSYSLOG_IF(condition, LEVEL, ...)\
4412C##LEVEL##_IF(el::base::Writer, condition, el::base::DispatchAction::SysLog, __VA_ARGS__)
4413# define CSYSLOG_EVERY_N(n, LEVEL, ...) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__)
4414# define CSYSLOG_AFTER_N(n, LEVEL, ...) C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__)
4415# define CSYSLOG_N_TIMES(n, LEVEL, ...) C##LEVEL##_N_TIMES(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__)
4416# define SYSLOG(LEVEL) CSYSLOG(LEVEL, el::base::consts::kSysLogLoggerId)
4417# define SYSLOG_IF(condition, LEVEL) CSYSLOG_IF(condition, LEVEL, el::base::consts::kSysLogLoggerId)
4418# define SYSLOG_EVERY_N(n, LEVEL) CSYSLOG_EVERY_N(n, LEVEL, el::base::consts::kSysLogLoggerId)
4419# define SYSLOG_AFTER_N(n, LEVEL) CSYSLOG_AFTER_N(n, LEVEL, el::base::consts::kSysLogLoggerId)
4420# define SYSLOG_N_TIMES(n, LEVEL) CSYSLOG_N_TIMES(n, LEVEL, el::base::consts::kSysLogLoggerId)
4421# define DCSYSLOG(LEVEL, ...) if (ELPP_DEBUG_LOG) C##LEVEL(el::base::Writer, el::base::DispatchAction::SysLog, __VA_ARGS__)
4422# define DCSYSLOG_IF(condition, LEVEL, ...)\
4423C##LEVEL##_IF(el::base::Writer, (ELPP_DEBUG_LOG) && (condition), el::base::DispatchAction::SysLog, __VA_ARGS__)
4424# define DCSYSLOG_EVERY_N(n, LEVEL, ...)\
4425if (ELPP_DEBUG_LOG) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__)
4426# define DCSYSLOG_AFTER_N(n, LEVEL, ...)\
4427if (ELPP_DEBUG_LOG) C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__)
4428# define DCSYSLOG_N_TIMES(n, LEVEL, ...)\
4429if (ELPP_DEBUG_LOG) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__)
4430# define DSYSLOG(LEVEL) DCSYSLOG(LEVEL, el::base::consts::kSysLogLoggerId)
4431# define DSYSLOG_IF(condition, LEVEL) DCSYSLOG_IF(condition, LEVEL, el::base::consts::kSysLogLoggerId)
4432# define DSYSLOG_EVERY_N(n, LEVEL) DCSYSLOG_EVERY_N(n, LEVEL, el::base::consts::kSysLogLoggerId)
4433# define DSYSLOG_AFTER_N(n, LEVEL) DCSYSLOG_AFTER_N(n, LEVEL, el::base::consts::kSysLogLoggerId)
4434# define DSYSLOG_N_TIMES(n, LEVEL) DCSYSLOG_N_TIMES(n, LEVEL, el::base::consts::kSysLogLoggerId)
4436# define CSYSLOG(LEVEL, ...) el::base::NullWriter()
4437# define CSYSLOG_IF(condition, LEVEL, ...) el::base::NullWriter()
4438# define CSYSLOG_EVERY_N(n, LEVEL, ...) el::base::NullWriter()
4439# define CSYSLOG_AFTER_N(n, LEVEL, ...) el::base::NullWriter()
4440# define CSYSLOG_N_TIMES(n, LEVEL, ...) el::base::NullWriter()
4441# define SYSLOG(LEVEL) el::base::NullWriter()
4442# define SYSLOG_IF(condition, LEVEL) el::base::NullWriter()
4443# define SYSLOG_EVERY_N(n, LEVEL) el::base::NullWriter()
4444# define SYSLOG_AFTER_N(n, LEVEL) el::base::NullWriter()
4445# define SYSLOG_N_TIMES(n, LEVEL) el::base::NullWriter()
4446# define DCSYSLOG(LEVEL, ...) el::base::NullWriter()
4447# define DCSYSLOG_IF(condition, LEVEL, ...) el::base::NullWriter()
4448# define DCSYSLOG_EVERY_N(n, LEVEL, ...) el::base::NullWriter()
4449# define DCSYSLOG_AFTER_N(n, LEVEL, ...) el::base::NullWriter()
4450# define DCSYSLOG_N_TIMES(n, LEVEL, ...) el::base::NullWriter()
4451# define DSYSLOG(LEVEL) el::base::NullWriter()
4452# define DSYSLOG_IF(condition, LEVEL) el::base::NullWriter()
4453# define DSYSLOG_EVERY_N(n, LEVEL) el::base::NullWriter()
4454# define DSYSLOG_AFTER_N(n, LEVEL) el::base::NullWriter()
4455# define DSYSLOG_N_TIMES(n, LEVEL) el::base::NullWriter()
4466#undef DCVLOG_EVERY_N
4468#undef DCVLOG_AFTER_N
4470#undef DCVLOG_N_TIMES
4472#define DCLOG(LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG(LEVEL, __VA_ARGS__)
4473#define DCLOG_VERBOSE(vlevel, ...) if (ELPP_DEBUG_LOG) CLOG_VERBOSE(vlevel, __VA_ARGS__)
4474#define DCVLOG(vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG(vlevel, __VA_ARGS__)
4476#define DCLOG_IF(condition, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_IF(condition, LEVEL, __VA_ARGS__)
4477#define DCVLOG_IF(condition, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_IF(condition, vlevel, __VA_ARGS__)
4479#define DCLOG_EVERY_N(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_EVERY_N(n, LEVEL, __VA_ARGS__)
4480#define DCVLOG_EVERY_N(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_EVERY_N(n, vlevel, __VA_ARGS__)
4481#define DCLOG_AFTER_N(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_AFTER_N(n, LEVEL, __VA_ARGS__)
4482#define DCVLOG_AFTER_N(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_AFTER_N(n, vlevel, __VA_ARGS__)
4483#define DCLOG_N_TIMES(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_N_TIMES(n, LEVEL, __VA_ARGS__)
4484#define DCVLOG_N_TIMES(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_N_TIMES(n, vlevel, __VA_ARGS__)
4488#if !defined(ELPP_NO_DEBUG_MACROS)
4501#define DLOG(LEVEL) DCLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4502#define DVLOG(vlevel) DCVLOG(vlevel, ELPP_CURR_FILE_LOGGER_ID)
4504#define DLOG_IF(condition, LEVEL) DCLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4505#define DVLOG_IF(condition, vlevel) DCVLOG_IF(condition, vlevel, ELPP_CURR_FILE_LOGGER_ID)
4507#define DLOG_EVERY_N(n, LEVEL) DCLOG_EVERY_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4508#define DVLOG_EVERY_N(n, vlevel) DCVLOG_EVERY_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID)
4509#define DLOG_AFTER_N(n, LEVEL) DCLOG_AFTER_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4510#define DVLOG_AFTER_N(n, vlevel) DCVLOG_AFTER_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID)
4511#define DLOG_N_TIMES(n, LEVEL) DCLOG_N_TIMES(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID)
4512#define DVLOG_N_TIMES(n, vlevel) DCVLOG_N_TIMES(n, vlevel, ELPP_CURR_FILE_LOGGER_ID)
4514#if !defined(ELPP_NO_CHECK_MACROS)
4525#undef CCHECK_NOTNULL
4526#undef CCHECK_STRCASEEQ
4527#undef CCHECK_STRCASENE
4538#undef CHECK_STRCASEEQ
4539#undef CHECK_STRCASENE
4540#define CCHECK(condition, ...) CLOG_IF(!(condition), FATAL, __VA_ARGS__) << "Check failed: [" << #condition << "] "
4541#define CPCHECK(condition, ...) CPLOG_IF(!(condition), FATAL, __VA_ARGS__) << "Check failed: [" << #condition << "] "
4542#define CHECK(condition) CCHECK(condition, ELPP_CURR_FILE_LOGGER_ID)
4543#define PCHECK(condition) CPCHECK(condition, ELPP_CURR_FILE_LOGGER_ID)
4544#define CCHECK_EQ(a, b, ...) CCHECK(a == b, __VA_ARGS__)
4545#define CCHECK_NE(a, b, ...) CCHECK(a != b, __VA_ARGS__)
4546#define CCHECK_LT(a, b, ...) CCHECK(a < b, __VA_ARGS__)
4547#define CCHECK_GT(a, b, ...) CCHECK(a > b, __VA_ARGS__)
4548#define CCHECK_LE(a, b, ...) CCHECK(a <= b, __VA_ARGS__)
4549#define CCHECK_GE(a, b, ...) CCHECK(a >= b, __VA_ARGS__)
4550#define CCHECK_BOUNDS(val, min, max, ...) CCHECK(val >= min && val <= max, __VA_ARGS__)
4551#define CHECK_EQ(a, b) CCHECK_EQ(a, b, ELPP_CURR_FILE_LOGGER_ID)
4552#define CHECK_NE(a, b) CCHECK_NE(a, b, ELPP_CURR_FILE_LOGGER_ID)
4553#define CHECK_LT(a, b) CCHECK_LT(a, b, ELPP_CURR_FILE_LOGGER_ID)
4554#define CHECK_GT(a, b) CCHECK_GT(a, b, ELPP_CURR_FILE_LOGGER_ID)
4555#define CHECK_LE(a, b) CCHECK_LE(a, b, ELPP_CURR_FILE_LOGGER_ID)
4556#define CHECK_GE(a, b) CCHECK_GE(a, b, ELPP_CURR_FILE_LOGGER_ID)
4557#define CHECK_BOUNDS(val, min, max) CCHECK_BOUNDS(val, min, max, ELPP_CURR_FILE_LOGGER_ID)
4558#define CCHECK_NOTNULL(ptr, ...) CCHECK((ptr) != nullptr, __VA_ARGS__)
4559#define CCHECK_STREQ(str1, str2, ...) CLOG_IF(!el::base::utils::Str::cStringEq(str1, str2), FATAL, __VA_ARGS__) \
4560<< "Check failed: [" << #str1 << " == " << #str2 << "] "
4561#define CCHECK_STRNE(str1, str2, ...) CLOG_IF(el::base::utils::Str::cStringEq(str1, str2), FATAL, __VA_ARGS__) \
4562<< "Check failed: [" << #str1 << " != " << #str2 << "] "
4563#define CCHECK_STRCASEEQ(str1, str2, ...) CLOG_IF(!el::base::utils::Str::cStringCaseEq(str1, str2), FATAL, __VA_ARGS__) \
4564<< "Check failed: [" << #str1 << " == " << #str2 << "] "
4565#define CCHECK_STRCASENE(str1, str2, ...) CLOG_IF(el::base::utils::Str::cStringCaseEq(str1, str2), FATAL, __VA_ARGS__) \
4566<< "Check failed: [" << #str1 << " != " << #str2 << "] "
4567#define CHECK_NOTNULL(ptr) CCHECK_NOTNULL((ptr), ELPP_CURR_FILE_LOGGER_ID)
4568#define CHECK_STREQ(str1, str2) CCHECK_STREQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID)
4569#define CHECK_STRNE(str1, str2) CCHECK_STRNE(str1, str2, ELPP_CURR_FILE_LOGGER_ID)
4570#define CHECK_STRCASEEQ(str1, str2) CCHECK_STRCASEEQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID)
4571#define CHECK_STRCASENE(str1, str2) CCHECK_STRCASENE(str1, str2, ELPP_CURR_FILE_LOGGER_ID)
4579#undef DCCHECK_BOUNDS
4580#undef DCCHECK_NOTNULL
4581#undef DCCHECK_STRCASEEQ
4582#undef DCCHECK_STRCASENE
4591#undef DCHECK_BOUNDS_
4592#undef DCHECK_NOTNULL
4593#undef DCHECK_STRCASEEQ
4594#undef DCHECK_STRCASENE
4596#define DCCHECK(condition, ...) if (ELPP_DEBUG_LOG) CCHECK(condition, __VA_ARGS__)
4597#define DCCHECK_EQ(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_EQ(a, b, __VA_ARGS__)
4598#define DCCHECK_NE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_NE(a, b, __VA_ARGS__)
4599#define DCCHECK_LT(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_LT(a, b, __VA_ARGS__)
4600#define DCCHECK_GT(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_GT(a, b, __VA_ARGS__)
4601#define DCCHECK_LE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_LE(a, b, __VA_ARGS__)
4602#define DCCHECK_GE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_GE(a, b, __VA_ARGS__)
4603#define DCCHECK_BOUNDS(val, min, max, ...) if (ELPP_DEBUG_LOG) CCHECK_BOUNDS(val, min, max, __VA_ARGS__)
4604#define DCCHECK_NOTNULL(ptr, ...) if (ELPP_DEBUG_LOG) CCHECK_NOTNULL((ptr), __VA_ARGS__)
4605#define DCCHECK_STREQ(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STREQ(str1, str2, __VA_ARGS__)
4606#define DCCHECK_STRNE(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRNE(str1, str2, __VA_ARGS__)
4607#define DCCHECK_STRCASEEQ(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRCASEEQ(str1, str2, __VA_ARGS__)
4608#define DCCHECK_STRCASENE(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRCASENE(str1, str2, __VA_ARGS__)
4609#define DCPCHECK(condition, ...) if (ELPP_DEBUG_LOG) CPCHECK(condition, __VA_ARGS__)
4610#define DCHECK(condition) DCCHECK(condition, ELPP_CURR_FILE_LOGGER_ID)
4611#define DCHECK_EQ(a, b) DCCHECK_EQ(a, b, ELPP_CURR_FILE_LOGGER_ID)
4612#define DCHECK_NE(a, b) DCCHECK_NE(a, b, ELPP_CURR_FILE_LOGGER_ID)
4613#define DCHECK_LT(a, b) DCCHECK_LT(a, b, ELPP_CURR_FILE_LOGGER_ID)
4614#define DCHECK_GT(a, b) DCCHECK_GT(a, b, ELPP_CURR_FILE_LOGGER_ID)
4615#define DCHECK_LE(a, b) DCCHECK_LE(a, b, ELPP_CURR_FILE_LOGGER_ID)
4616#define DCHECK_GE(a, b) DCCHECK_GE(a, b, ELPP_CURR_FILE_LOGGER_ID)
4617#define DCHECK_BOUNDS(val, min, max) DCCHECK_BOUNDS(val, min, max, ELPP_CURR_FILE_LOGGER_ID)
4618#define DCHECK_NOTNULL(ptr) DCCHECK_NOTNULL((ptr), ELPP_CURR_FILE_LOGGER_ID)
4619#define DCHECK_STREQ(str1, str2) DCCHECK_STREQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID)
4620#define DCHECK_STRNE(str1, str2) DCCHECK_STRNE(str1, str2, ELPP_CURR_FILE_LOGGER_ID)
4621#define DCHECK_STRCASEEQ(str1, str2) DCCHECK_STRCASEEQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID)
4622#define DCHECK_STRCASENE(str1, str2) DCCHECK_STRCASENE(str1, str2, ELPP_CURR_FILE_LOGGER_ID)
4623#define DPCHECK(condition) DCPCHECK(condition, ELPP_CURR_FILE_LOGGER_ID)
4625#if defined(ELPP_DISABLE_DEFAULT_CRASH_HANDLING)
4626# define ELPP_USE_DEF_CRASH_HANDLER false
4628# define ELPP_USE_DEF_CRASH_HANDLER true
4630#define ELPP_CRASH_HANDLER_INIT
4631#define ELPP_INIT_EASYLOGGINGPP(val) \
4634el::base::type::StoragePointer elStorage(val); \
4636el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER); \
4639#if ELPP_ASYNC_LOGGING
4640# define INITIALIZE_EASYLOGGINGPP ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()),\
4641new el::base::AsyncDispatchWorker()))
4643# define INITIALIZE_EASYLOGGINGPP ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder())))
4645#define INITIALIZE_NULL_EASYLOGGINGPP \
4648el::base::type::StoragePointer elStorage;\
4650el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\
4652#define SHARE_EASYLOGGINGPP(initializedStorage)\
4655el::base::type::StoragePointer elStorage(initializedStorage);\
4657el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\
4660#if defined(ELPP_UNICODE)
4661# define START_EASYLOGGINGPP(argc, argv) el::Helpers::setArgs(argc, argv); std::locale::global(std::locale(""))
4663# define START_EASYLOGGINGPP(argc, argv) el::Helpers::setArgs(argc, argv)
#define si(y, x, c)
Definition: aesb.c:48
#define s(x, c)
Definition: aesb.c:47
std::ostream & operator<<(std::ostream &os, const Student &s)
Definition: archivertest.cpp:30
cryptonote::block b
Definition: block.cpp:40
JSON writer.
Definition: writer.h:89
Definition: easylogging++.h:2182
void setEnabled(bool enabled)
Definition: easylogging++.h:2188
bool m_enabled
Definition: easylogging++.h:2195
Callback(void)
Definition: easylogging++.h:2184
virtual void handle(const T *handlePtr)=0
bool enabled(void) const
Definition: easylogging++.h:2185
Static class that contains helper functions for el::ConfigurationType.
Definition: easylogging++.h:696
static const char * convertToString(ConfigurationType configurationType)
Converts configuration type to associated const char*.
Definition: easylogging++.cc:258
static void forEachConfigType(base::type::EnumType *startIndex, const std::function< bool(void)> &fn)
Applies specified function to each configuration type starting from startIndex.
Definition: easylogging++.cc:299
static ConfigurationType castFromInt(base::type::EnumType c)
Casts int(ushort) to configurationt type, useful for iterating through enum.
Definition: easylogging++.h:707
static ConfigurationType convertFromString(const char *configStr)
Converts from configStr to ConfigurationType.
Definition: easylogging++.cc:290
static const base::type::EnumType kMaxValid
Represents maximum valid configuration type. This is used internally and you should not need it.
Definition: easylogging++.h:701
static base::type::EnumType castToInt(ConfigurationType configurationType)
Casts configuration type to int, useful for iterating through enum.
Definition: easylogging++.h:703
static const base::type::EnumType kMinValid
Represents minimum valid configuration type. Useful when iterating through enum.
Definition: easylogging++.h:699
Used to find configuration from configuration (pointers) repository. Avoid using it.
Definition: easylogging++.h:1747
ConfigurationType m_configurationType
Definition: easylogging++.h:1755
Level m_level
Definition: easylogging++.h:1754
Represents single configuration that has representing level, configuration type and a string based va...
Definition: easylogging++.h:1711
void setValue(const std::string &value)
Set string based configuration value.
Definition: easylogging++.h:1740
const std::string & value(void) const
Gets string based configuration value.
Definition: easylogging++.h:1733
ConfigurationType m_configurationType
Definition: easylogging++.h:1760
Level m_level
Definition: easylogging++.h:1759
std::string m_value
Definition: easylogging++.h:1761
Level level(void) const
Gets level of current configuration.
Definition: easylogging++.h:1723
virtual ~Configuration(void)
Definition: easylogging++.h:1716
ConfigurationType configurationType(void) const
Gets configuration type of current configuration.
Definition: easylogging++.h:1728
Parser used internally to parse configurations from file or text.
Definition: easylogging++.h:1877
Thread-safe Configuration repository.
Definition: easylogging++.h:1767
void clear(void)
Clears repository so that all the configurations are unset.
Definition: easylogging++.h:1849
Configuration * get(Level level, ConfigurationType configurationType)
Definition: easylogging++.h:1835
void setGlobally(ConfigurationType configurationType, const std::string &value)
Sets configuration for all levels.
Definition: easylogging++.h:1844
std::string m_configurationFile
Definition: easylogging++.h:1913
const std::string & configurationFile(void) const
Gets configuration file used in parsing this configurations.
Definition: easylogging++.h:1857
bool m_isFromFile
Definition: easylogging++.h:1914
virtual ~Configurations(void)
Definition: easylogging++.h:1781
Static helpers for developers.
Definition: easylogging++.h:3734
static base::type::StoragePointer storage()
Definition: easylogging++.h:3741
static bool hasCustomFormatSpecifier(const char *formatSpecifier)
Returns true if custom format specifier is installed.
Definition: easylogging++.h:3855
static bool uninstallCustomFormatSpecifier(const char *formatSpecifier)
Uninstalls user defined format specifier and handler.
Definition: easylogging++.h:3851
static void setThreadName(const std::string &name)
Sets thread name for current thread. Requires std::thread.
Definition: easylogging++.h:3753
static bool installLogDispatchCallback(const std::string &id)
Installs post log dispatch callback, this callback is triggered when log is dispatched.
Definition: easylogging++.h:3788
static void setArgs(int argc, char **argv)
Sets application arguments and figures out whats active for logging and whats not.
Definition: easylogging++.h:3745
static std::string convertTemplateToStdString(const T &templ)
Converts template to std::string - useful for loggable classes to log containers within log(std::ostr...
Definition: easylogging++.h:3818
static T * logDispatchCallback(const std::string &id)
Definition: easylogging++.h:3797
static void installCustomFormatSpecifier(const CustomFormatSpecifier &customFormatSpecifier)
Installs user defined format specifier and handler.
Definition: easylogging++.h:3847
static const el::base::utils::CommandLineArgs * commandLineArgs(void)
Returns command line arguments (pointer) provided to easylogging++.
Definition: easylogging++.h:3838
static void uninstallPreRollOutCallback(void)
Uninstalls pre rollout callback.
Definition: easylogging++.h:3783
static void uninstallLogDispatchCallback(const std::string &id)
Uninstalls log dispatch callback.
Definition: easylogging++.h:3793
static std::string getThreadName()
Definition: easylogging++.h:3756
static void validateFileRolling(Logger *logger, Level level)
Definition: easylogging++.h:3858
static void setStorage(base::type::StoragePointer storage)
Shares logging repository (base::Storage)
Definition: easylogging++.h:3737
static void setArgs(int argc, const char **argv)
Sets application arguments and figures out whats active for logging and whats not.
Definition: easylogging++.h:3749
static void reserveCustomFormatSpecifiers(std::size_t size)
Reserve space for custom format specifiers for performance.
Definition: easylogging++.h:3843
Static class that contains helper functions for el::Level.
Definition: easylogging++.h:631
static Level castFromInt(base::type::EnumType l)
Casts int(ushort) to level, useful for iterating through enum.
Definition: easylogging++.h:642
static Level convertFromString(const char *levelStr)
Converts from levelStr to Level.
Definition: easylogging++.cc:217
static const base::type::EnumType kMinValid
Represents minimum valid level. Useful when iterating through enum.
Definition: easylogging++.h:634
static base::type::EnumType castToInt(Level level)
Casts level to int, useful for iterating through enum.
Definition: easylogging++.h:638
static Level convertFromStringPrefix(const char *levelStr)
Converts from prefix of levelStr to Level.
Definition: easylogging++.cc:226
static void forEachLevel(base::type::EnumType *startIndex, const std::function< bool(void)> &fn)
Applies specified function to each level starting from startIndex.
Definition: easylogging++.cc:246
static const base::type::EnumType kMaxValid
Represents maximum valid level. This is used internally and you should not need it.
Definition: easylogging++.h:636
static const char * convertToString(Level level)
Converts level to associated const char*.
Definition: easylogging++.cc:188
Definition: easylogging++.h:2235
LogBuilder()
Definition: easylogging++.h:2237
virtual base::type::string_t build(const LogMessage *logMessage, bool appendNewLine) const =0
virtual ~LogBuilder(void)
Definition: easylogging++.h:2238
bool m_termSupportsColor
Definition: easylogging++.h:2245
Definition: easylogging++.h:2218
base::threading::Mutex m_fileLocksMapLock
Definition: easylogging++.h:2225
std::unordered_map< std::string, std::unique_ptr< base::threading::Mutex > > m_fileLocks
Definition: easylogging++.h:2224
virtual void handle(const LogDispatchData *data)
Definition: easylogging++.cc:2411
Definition: easylogging++.h:2197
void setLogMessage(LogMessage *logMessage)
Definition: easylogging++.h:2206
LogDispatchData()
Definition: easylogging++.h:2199
base::DispatchAction dispatchAction(void) const
Definition: easylogging++.h:2203
base::DispatchAction m_dispatchAction
Definition: easylogging++.h:2214
LogMessage * m_logMessage
Definition: easylogging++.h:2213
const LogMessage * logMessage(void) const
Definition: easylogging++.h:2200
void setDispatchAction(base::DispatchAction dispatchAction)
Definition: easylogging++.h:2209
Definition: easylogging++.h:2514
const base::type::string_t & message(void) const
Definition: easylogging++.h:2542
const std::string & file(void) const
Definition: easylogging++.h:2527
base::type::VerboseLevel m_verboseLevel
Definition: easylogging++.h:2551
Color m_color
Definition: easylogging++.h:2547
Level level(void) const
Definition: easylogging++.h:2521
const std::string & func(void) const
Definition: easylogging++.h:2533
Color color(void) const
Definition: easylogging++.h:2524
std::string m_file
Definition: easylogging++.h:2548
base::type::LineNumber line(void) const
Definition: easylogging++.h:2530
base::type::VerboseLevel verboseLevel(void) const
Definition: easylogging++.h:2536
Logger * m_logger
Definition: easylogging++.h:2552
base::type::string_t m_message
Definition: easylogging++.h:2553
Logger * logger(void) const
Definition: easylogging++.h:2539
Level m_level
Definition: easylogging++.h:2546
base::type::LineNumber m_line
Definition: easylogging++.h:2549
std::string m_func
Definition: easylogging++.h:2550
LogMessage(Level level, Color color, const std::string &file, base::type::LineNumber line, const std::string &func, base::type::VerboseLevel verboseLevel, Logger *logger, const base::type::string_t *msg=nullptr)
Definition: easylogging++.h:2516
Base of Easylogging++ friendly class.
Definition: easylogging++.h:1601
friend el::base::type::ostream_t & operator<<(el::base::type::ostream_t &os, const Loggable &loggable)
Definition: easylogging++.h:1606
virtual ~Loggable(void)
Definition: easylogging++.h:1603
virtual void log(el::base::type::ostream_t &) const =0
Definition: easylogging++.h:2231
Represents a logger holding ID and configurations we need to write logs.
Definition: easylogging++.h:2252
base::type::stringstream_t m_stream
Definition: easylogging++.h:2340
std::unordered_map< Level, unsigned int > m_unflushedCount
Definition: easylogging++.h:2344
Configurations m_configurations
Definition: easylogging++.h:2343
const std::string & id(void) const
Definition: easylogging++.h:2273
LogBuilder * logBuilder(void) const
Definition: easylogging++.h:2304
void setParentApplicationName(const std::string &parentApplicationName)
Definition: easylogging++.h:2281
LogBuilderPtr m_logBuilder
Definition: easylogging++.h:2346
void setLogBuilder(const LogBuilderPtr &logBuilder)
Definition: easylogging++.h:2308
base::TypedConfigurations * typedConfigurations(void)
Definition: easylogging++.h:2289
std::string m_id
Definition: easylogging++.h:2338
Configurations * configurations(void)
Definition: easylogging++.h:2285
base::TypedConfigurations * m_typedConfigurations
Definition: easylogging++.h:2339
bool enabled(Level level) const
Definition: easylogging++.h:2312
virtual void log(el::base::type::ostream_t &os) const
Definition: easylogging++.h:2263
base::LogStreamsReferenceMap * m_logStreamsReference
Definition: easylogging++.h:2345
base::type::stringstream_t & stream(void)
Definition: easylogging++.h:2378
bool isFlushNeeded(Level level)
Definition: easylogging++.h:2300
bool m_isConfigured
Definition: easylogging++.h:2342
virtual ~Logger(void)
Definition: easylogging++.h:2259
const std::string & parentApplicationName(void) const
Definition: easylogging++.h:2277
std::string m_parentApplicationName
Definition: easylogging++.h:2341
Adds flag and removes it when scope goes out.
Definition: easylogging++.h:3941
ScopedAddFlag(LoggingFlag flag)
Definition: easylogging++.h:3943
LoggingFlag m_flag
Definition: easylogging++.h:3950
~ScopedAddFlag(void)
Definition: easylogging++.h:3946
Removes flag and add it when scope goes out.
Definition: easylogging++.h:3953
LoggingFlag m_flag
Definition: easylogging++.h:3962
~ScopedRemoveFlag(void)
Definition: easylogging++.h:3958
ScopedRemoveFlag(LoggingFlag flag)
Definition: easylogging++.h:3955
Static helpers to deal with loggers and their configurations.
Definition: easylogging++.h:3864
static void reconfigureAllLoggers(ConfigurationType configurationType, const std::string &value)
Reconfigures single configuration for all the loggers.
Definition: easylogging++.h:3901
static void removeFlag(LoggingFlag flag)
Removes logging flag used internally.
Definition: easylogging++.h:3933
static bool hasFlag(LoggingFlag flag)
Determines whether or not certain flag is active.
Definition: easylogging++.h:3937
static void uninstallLoggerRegistrationCallback(const std::string &id)
Uninstalls log dispatch callback.
Definition: easylogging++.h:3879
static bool installLoggerRegistrationCallback(const std::string &id)
Installs logger registration callback, this callback is triggered when new logger is registered.
Definition: easylogging++.h:3874
static void addFlag(LoggingFlag flag)
Adds logging flag used internally.
Definition: easylogging++.h:3929
static void setLoggingLevel(Level level)
Sets hierarchy for logging. Needs to enable logging flag (HierarchicalLogging)
Definition: easylogging++.h:3965
static T * loggerRegistrationCallback(const std::string &id)
Definition: easylogging++.h:3883
Initializes syslog with process ID, options and facility. calls closelog() on d'tor.
Definition: easylogging++.h:3715
SysLogInitializer(const char *processIdent, int options=0, int facility=0)
Definition: easylogging++.h:3717
virtual ~SysLogInitializer(void)
Definition: easylogging++.h:3726
Definition: easylogging++.h:3987
Definition: easylogging++.h:2832
Definition: easylogging++.h:2793
const LogDispatchData * m_data
Definition: easylogging++.h:2797
Definition: easylogging++.h:2133
Predicate(const char *filename, base::type::LineNumber lineNumber)
Definition: easylogging++.h:2135
const char * m_filename
Definition: easylogging++.h:2146
base::type::LineNumber m_lineNumber
Definition: easylogging++.h:2147
bool operator()(const HitCounter *counter)
Definition: easylogging++.h:2139
Class that keeps record of current line hit for occasional logging.
Definition: easylogging++.h:2071
void validateHitCounts(std::size_t n)
Validates hit counts and resets it if necessary.
Definition: easylogging++.h:2110
HitCounter(const char *filename, base::type::LineNumber lineNumber)
Definition: easylogging++.h:2079
HitCounter(void)
Definition: easylogging++.h:2073
void resetLocation(const char *filename, base::type::LineNumber lineNumber)
Resets location of current hit counter.
Definition: easylogging++.h:2104
base::type::LineNumber m_lineNumber
Definition: easylogging++.h:2152
virtual ~HitCounter(void)
Definition: easylogging++.h:2100
HitCounter & operator=(const HitCounter &hitCounter)
Definition: easylogging++.h:2091
base::type::LineNumber lineNumber(void) const
Definition: easylogging++.h:2121
HitCounter(const HitCounter &hitCounter)
Definition: easylogging++.h:2085
std::size_t m_hitCounts
Definition: easylogging++.h:2153
std::size_t hitCounts(void) const
Definition: easylogging++.h:2125
const char * filename(void) const
Definition: easylogging++.h:2117
void increment(void)
Definition: easylogging++.h:2129
const char * m_filename
Definition: easylogging++.h:2151
Dispatches log messages.
Definition: easylogging++.h:2837
LogDispatcher(bool proceed, LogMessage *logMessage, base::DispatchAction dispatchAction)
Definition: easylogging++.h:2839
LogMessage * m_logMessage
Definition: easylogging++.h:2849
bool m_proceed
Definition: easylogging++.h:2848
base::DispatchAction m_dispatchAction
Definition: easylogging++.h:2850
Definition: easylogging++.h:2929
Logger * m_logger
Definition: easylogging++.h:3217
MessageBuilder & operator<<(const std::string &msg)
Definition: easylogging++.h:2943
MessageBuilder & writeIterator(Iterator begin_, Iterator end_, std::size_t size_)
Definition: easylogging++.h:3221
MessageBuilder & operator<<(std::ostream &(*OStreamMani)(std::ostream &))
Definition: easylogging++.h:2965
MessageBuilder(void)
Definition: easylogging++.h:2931
const base::type::char_t * m_containerLogSeperator
Definition: easylogging++.h:3218
Internal helper class that prevent copy constructor for class.
Definition: easylogging++.h:569
NoCopy & operator=(const NoCopy &)
NoCopy(void)
Definition: easylogging++.h:571
Writes nothing - Used when certain log is disabled.
Definition: easylogging++.h:3238
NullWriter & operator<<(std::ostream &(*)(std::ostream &))
Definition: easylogging++.h:3243
NullWriter(void)
Definition: easylogging++.h:3240
NullWriter & operator<<(const T &)
Definition: easylogging++.h:3248
Definition: easylogging++.h:3333
PErrorWriter(Level level, Color color, const char *file, base::type::LineNumber line, const char *func, base::DispatchAction dispatchAction=base::DispatchAction::NormalLog, base::type::VerboseLevel verboseLevel=0)
Definition: easylogging++.h:3335
Repository for hit counters used across the application.
Definition: easylogging++.h:2156
const base::HitCounter * getCounter(const char *filename, base::type::LineNumber lineNumber)
Gets hit counter registered at specified position.
Definition: easylogging++.h:2171
Loggers repository.
Definition: easylogging++.h:2386
std::unordered_map< std::string, base::type::LoggerRegistrationCallbackPtr > m_loggerRegistrationCallbacks
Definition: easylogging++.h:2450
void setDefaultConfigurations(const Configurations &configurations)
Definition: easylogging++.h:2394
base::LogStreamsReferenceMap * logStreamsReference(void)
Definition: easylogging++.h:2432
T * loggerRegistrationCallback(const std::string &id)
Definition: easylogging++.h:2417
bool installLoggerRegistrationCallback(const std::string &id)
Definition: easylogging++.h:2406
Configurations * defaultConfigurations(void)
Definition: easylogging++.h:2399
bool has(const std::string &id)
Definition: easylogging++.h:2423
void flushAll(void)
Definition: easylogging++.h:2436
Configurations m_defaultConfigurations
Definition: easylogging++.h:2448
virtual ~RegisteredLoggers(void)
Definition: easylogging++.h:2390
void unregister(Logger *&logger)
Definition: easylogging++.h:2427
void uninstallLoggerRegistrationCallback(const std::string &id)
Definition: easylogging++.h:2412
base::LogStreamsReferenceMap m_logStreamsReference
Definition: easylogging++.h:2449
LogBuilderPtr m_defaultLogBuilder
Definition: easylogging++.h:2447
void setDefaultLogBuilder(LogBuilderPtr &logBuilderPtr)
Definition: easylogging++.h:2441
Internal helper class that makes all default constructors private.
Definition: easylogging++.h:580
StaticClass & operator=(const StaticClass &)
StaticClass(const StaticClass &)
Easylogging++ management storage.
Definition: easylogging++.h:2615
base::threading::Mutex & customFormatSpecifiersLock()
Definition: easylogging++.h:2699
base::RegisteredHitCounters * m_registeredHitCounters
Definition: easylogging++.h:2759
base::VRegistry * m_vRegistry
Definition: easylogging++.h:2762
void setLoggingLevel(Level level)
Definition: easylogging++.h:2703
void setThreadName(const std::string &name)
Sets thread name for current thread. Requires std::thread.
Definition: easylogging++.h:2741
std::unordered_map< std::string, std::string > m_threadNames
Definition: easylogging++.h:2771
bool hasFlag(LoggingFlag flag) const
Definition: easylogging++.h:2667
void unsetPreRollOutCallback(void)
Definition: easylogging++.h:2683
void uninstallLogDispatchCallback(const std::string &id)
Definition: easylogging++.h:2713
void addFlag(LoggingFlag flag)
Definition: easylogging++.h:2659
base::RegisteredLoggers * m_registeredLoggers
Definition: easylogging++.h:2760
PreRollOutCallback m_preRollOutCallback
Definition: easylogging++.h:2768
T * logDispatchCallback(const std::string &id)
Definition: easylogging++.h:2717
void setFlags(base::type::EnumType flags)
Definition: easylogging++.h:2675
const std::vector< CustomFormatSpecifier > * customFormatSpecifiers(void) const
Definition: easylogging++.h:2695
const base::utils::CommandLineArgs * commandLineArgs(void) const
Definition: easylogging++.h:2655
void setPreRollOutCallback(const PreRollOutCallback &callback)
Definition: easylogging++.h:2679
bool validateEveryNCounter(const char *filename, base::type::LineNumber lineNumber, std::size_t occasion)
Definition: easylogging++.h:2625
base::RegisteredLoggers * registeredLoggers(void) const
Definition: easylogging++.h:2641
std::unordered_map< std::string, base::type::LogDispatchCallbackPtr > m_logDispatchCallbacks
Definition: easylogging++.h:2769
void removeFlag(LoggingFlag flag)
Definition: easylogging++.h:2663
base::threading::Mutex m_threadNamesLock
Definition: easylogging++.h:2774
base::RegisteredHitCounters * hitCounters(void) const
Definition: easylogging++.h:2637
std::unordered_map< std::string, base::type::PerformanceTrackingCallbackPtr > m_performanceTrackingCallbacks
Definition: easylogging++.h:2770
void setApplicationArguments(int argc, const char **argv)
Definition: easylogging++.h:2787
bool validateAfterNCounter(const char *filename, base::type::LineNumber lineNumber, std::size_t n)
Definition: easylogging++.h:2629
std::vector< CustomFormatSpecifier > m_customFormatSpecifiers
Definition: easylogging++.h:2772
Level m_loggingLevel
Definition: easylogging++.h:2775
base::VRegistry * vRegistry(void) const
Definition: easylogging++.h:2645
base::type::EnumType m_flags
Definition: easylogging++.h:2761
bool installLogDispatchCallback(const std::string &id)
Definition: easylogging++.h:2708
base::threading::Mutex m_customFormatSpecifiersLock
Definition: easylogging++.h:2773
base::type::EnumType flags(void) const
Definition: easylogging++.h:2671
std::string getThreadName(const std::string &threadId)
Definition: easylogging++.h:2747
PreRollOutCallback & preRollOutCallback(void)
Definition: easylogging++.h:2687
bool validateNTimesCounter(const char *filename, base::type::LineNumber lineNumber, std::size_t n)
Definition: easylogging++.h:2633
base::utils::CommandLineArgs m_commandLineArgs
Definition: easylogging++.h:2767
A subsecond precision class containing actual width and offset of the subsecond part.
Definition: easylogging++.h:865
unsigned int m_offset
Definition: easylogging++.h:877
bool operator==(const SubsecondPrecision &ssPrec)
Definition: easylogging++.h:873
SubsecondPrecision(void)
Definition: easylogging++.h:867
int m_width
Definition: easylogging++.h:876
SubsecondPrecision(int width)
Definition: easylogging++.h:870
Configurations with data types.
Definition: easylogging++.h:1941
Conf_T & getConfigByRef(Level level, std::unordered_map< Level, Conf_T > *confMap, const char *confName)
Definition: easylogging++.h:1996
Conf_T getConfigByVal(Level level, const std::unordered_map< Level, Conf_T > *confMap, const char *confName)
Definition: easylogging++.h:1990
const Configurations * configurations(void) const
Definition: easylogging++.h:1953
std::unordered_map< Level, base::SubsecondPrecision > m_subsecondPrecisionMap
Definition: easylogging++.h:1976
std::unordered_map< Level, std::size_t > m_maxLogFileSizeMap
Definition: easylogging++.h:1979
std::unordered_map< Level, base::LogFormat > m_logFormatMap
Definition: easylogging++.h:1975
virtual ~TypedConfigurations(void)
Definition: easylogging++.h:1950
Conf_T & unsafeGetConfigByRef(Level level, std::unordered_map< Level, Conf_T > *confMap, const char *confName)
Definition: easylogging++.h:2019
std::unordered_map< Level, bool > m_performanceTrackingMap
Definition: easylogging++.h:1977
std::unordered_map< Level, base::FileStreamPtr > m_fileStreamMap
Definition: easylogging++.h:1978
std::unordered_map< Level, bool > m_toStandardOutputMap
Definition: easylogging++.h:1974
std::unordered_map< Level, bool > m_toFileMap
Definition: easylogging++.h:1972
Conf_T unsafeGetConfigByVal(Level level, const std::unordered_map< Level, Conf_T > *confMap, const char *confName)
Definition: easylogging++.h:2002
std::unordered_map< Level, std::size_t > m_logFlushThresholdMap
Definition: easylogging++.h:1980
Configurations * m_configurations
Definition: easylogging++.h:1970
base::LogStreamsReferenceMap * m_logStreamsReference
Definition: easylogging++.h:1981
void setValue(Level level, const Conf_T &value, std::unordered_map< Level, Conf_T > *confMap, bool includeGlobalLevel=true)
Definition: easylogging++.h:2036
std::unordered_map< Level, std::string > m_filenameMap
Definition: easylogging++.h:1973
std::unordered_map< Level, bool > m_enabledMap
Definition: easylogging++.h:1971
bool validateFileRolling(Level level, const PreRollOutCallback &preRollOutCallback)
Definition: easylogging++.h:2065
Represents registries for verbose logging.
Definition: easylogging++.h:2456
const std::string & getFilenameCommonPrefix() const
Definition: easylogging++.h:2500
std::map< std::string, int > m_cached_allowed_categories
Definition: easylogging++.h:2509
void clearModules(void)
Definition: easylogging++.h:2469
base::type::VerboseLevel m_level
Definition: easylogging++.h:2505
std::string m_categoriesString
Definition: easylogging++.h:2510
std::vector< std::pair< std::string, Level > > m_categories
Definition: easylogging++.h:2508
std::string m_filenameCommonPrefix
Definition: easylogging++.h:2511
void setFilenameCommonPrefix(const std::string &prefix)
Definition: easylogging++.h:2496
const std::unordered_map< std::string, base::type::VerboseLevel > & modules(void) const
Definition: easylogging++.h:2485
base::type::VerboseLevel level(void) const
Definition: easylogging++.h:2463
base::type::EnumType * m_pFlags
Definition: easylogging++.h:2506
std::unordered_map< std::string, base::type::VerboseLevel > m_modules
Definition: easylogging++.h:2507
bool vModulesEnabled(void)
Whether or not vModules enabled.
Definition: easylogging++.h:2492
Main entry point of each logging.
Definition: easylogging++.h:3257
Logger * m_logger
Definition: easylogging++.h:3321
const char * m_file
Definition: easylogging++.h:3317
bool m_proceed
Definition: easylogging++.h:3322
Level m_level
Definition: easylogging++.h:3315
base::type::VerboseLevel m_verboseLevel
Definition: easylogging++.h:3320
const char * m_func
Definition: easylogging++.h:3319
Writer(LogMessage *msg, base::DispatchAction dispatchAction=base::DispatchAction::NormalLog)
Definition: easylogging++.h:3266
base::MessageBuilder m_messageBuilder
Definition: easylogging++.h:3323
Writer(Level level, Color color, const char *file, base::type::LineNumber line, const char *func, base::DispatchAction dispatchAction=base::DispatchAction::NormalLog, base::type::VerboseLevel verboseLevel=0)
Definition: easylogging++.h:3259
virtual ~Writer(void)
Definition: easylogging++.h:3271
std::vector< std::string > m_loggerIds
Definition: easylogging++.h:3325
LogMessage * m_msg
Definition: easylogging++.h:3314
const base::type::LineNumber m_line
Definition: easylogging++.h:3318
base::DispatchAction m_dispatchAction
Definition: easylogging++.h:3324
Writer & construct(Logger *logger, bool needLock=true)
Definition: easylogging++.cc:2913
Writer & operator<<(std::ostream &(*log)(std::ostream &))
Definition: easylogging++.h:3297
Color m_color
Definition: easylogging++.h:3316
Definition: easylogging++.h:3704
CrashHandler(bool)
Definition: easylogging++.h:3706
Base of thread safe class, this class is inheritable-only.
Definition: easylogging++.h:1033
virtual void acquireLock(void) ELPP_FINAL
Definition: easylogging++.h:1035
base::threading::Mutex m_mutex
Definition: easylogging++.h:1042
virtual void releaseLock(void) ELPP_FINAL
Definition: easylogging++.h:1036
virtual ~ThreadSafe(void)
Definition: easylogging++.h:1040
ThreadSafe(void)
Definition: easylogging++.h:1039
virtual base::threading::Mutex & lock(void) ELPP_FINAL
Definition: easylogging++.h:1037
Mutex wrapper used when multi-threading is disabled.
Definition: easylogging++.h:1008
NoMutex(void)
Definition: easylogging++.h:1010
void lock(void)
Definition: easylogging++.h:1011
bool try_lock(void)
Definition: easylogging++.h:1012
void unlock(void)
Definition: easylogging++.h:1015
Lock guard wrapper used when multi-threading is disabled.
Definition: easylogging++.h:1019
NoScopedLock(Mutex &)
Definition: easylogging++.h:1021
virtual ~NoScopedLock(void)
Definition: easylogging++.h:1023
Abstract registry (aka repository) that provides basic interface for pointer repository specified by ...
Definition: easylogging++.h:1293
virtual const Container & list(void) const ELPP_FINAL
Returns underlying container by constant reference.
Definition: easylogging++.h:1384
virtual void unregisterAll(void)=0
Unregisters all the pointers from current repository.
bool operator!=(const AbstractRegistry< T_Ptr, Container > &other)
Definition: easylogging++.h:1322
virtual const_iterator cbegin(void) const ELPP_FINAL
Definition: easylogging++.h:1359
Container::const_iterator const_iterator
Definition: easylogging++.h:1296
virtual bool empty(void) const ELPP_FINAL
Definition: easylogging++.h:1369
virtual iterator begin(void) ELPP_FINAL
Definition: easylogging++.h:1348
void reinitDeepCopy(const AbstractRegistry< T_Ptr, Container > &sr)
Definition: easylogging++.h:1393
Container m_list
Definition: easylogging++.h:1399
virtual std::size_t size(void) const ELPP_FINAL
Definition: easylogging++.h:1374
Container::iterator iterator
Definition: easylogging++.h:1295
virtual iterator end(void) ELPP_FINAL
Definition: easylogging++.h:1353
virtual ~AbstractRegistry(void)
Definition: easylogging++.h:1344
AbstractRegistry & operator=(AbstractRegistry &&sr)
Assignment move operator.
Definition: easylogging++.h:1335
AbstractRegistry(AbstractRegistry &&sr)
Move constructor that is useful for base classes.
Definition: easylogging++.h:1302
virtual Container & list(void) ELPP_FINAL
Returns underlying container by reference.
Definition: easylogging++.h:1379
virtual void deepCopy(const AbstractRegistry< T_Ptr, Container > &)=0
bool operator==(const AbstractRegistry< T_Ptr, Container > &other)
Definition: easylogging++.h:1310
virtual const_iterator cend(void) const ELPP_FINAL
Definition: easylogging++.h:1364
AbstractRegistry(void)
Default constructor.
Definition: easylogging++.h:1299
Command line arguments for application if specified using el::Helpers::setArgs(..) or START_EASYLOGGI...
Definition: easylogging++.h:1249
CommandLineArgs(int argc, char **argv)
Definition: easylogging++.h:1257
void setArgs(int argc, const char **argv)
Sets arguments and parses them.
Definition: easylogging++.h:1262
int m_argc
Definition: easylogging++.h:1281
virtual ~CommandLineArgs(void)
Definition: easylogging++.h:1260
std::unordered_map< std::string, std::string > m_paramsWithValue
Definition: easylogging++.h:1283
CommandLineArgs(void)
Definition: easylogging++.h:1251
CommandLineArgs(int argc, const char **argv)
Definition: easylogging++.h:1254
std::vector< std::string > m_params
Definition: easylogging++.h:1284
char ** m_argv
Definition: easylogging++.h:1282
Contains utilities for cross-platform date/time. This class make use of el::base::utils::Str.
Definition: easylogging++.h:1217
Definition: easylogging++.h:1077
Operating System helper static class used internally. You should not use it.
Definition: easylogging++.h:1175
A pointer registry mechanism to manage memory and provide search functionalities. (predicate version)
Definition: easylogging++.h:1484
T_Ptr * get(const T &arg1, const T2 arg2)
Gets pointer from repository with speicifed arguments. Arguments are passed to predicate in order to ...
Definition: easylogging++.h:1554
RegistryWithPred(const RegistryWithPred &sr)
Copy constructor that is useful for base classes. Try to avoid this constructor, use move constructor...
Definition: easylogging++.h:1497
RegistryWithPred< T_Ptr, Pred >::iterator iterator
Definition: easylogging++.h:1486
virtual void registerNew(T_Ptr *ptr) ELPP_FINAL
Definition: easylogging++.h:1547
RegistryWithPred(void)
Definition: easylogging++.h:1489
virtual void unregisterAll(void) ELPP_FINAL
Unregisters all the pointers from current repository.
Definition: easylogging++.h:1523
friend base::type::ostream_t & operator<<(base::type::ostream_t &os, const RegistryWithPred &sr)
Definition: easylogging++.h:1515
virtual void deepCopy(const AbstractRegistry< T_Ptr, std::vector< T_Ptr * > > &sr)
Definition: easylogging++.h:1563
virtual void unregister(T_Ptr *&ptr) ELPP_FINAL
Definition: easylogging++.h:1532
RegistryWithPred< T_Ptr, Pred >::const_iterator const_iterator
Definition: easylogging++.h:1487
virtual ~RegistryWithPred(void)
Definition: easylogging++.h:1492
RegistryWithPred & operator=(const RegistryWithPred &sr)
Assignment operator that unregisters all the existing registeries and deeply copies each of repo elem...
Definition: easylogging++.h:1507
A pointer registry mechanism to manage memory and provide search functionalities. (non-predicate vers...
Definition: easylogging++.h:1408
virtual void deepCopy(const AbstractRegistry< T_Ptr, std::unordered_map< T_Key, T_Ptr * > > &sr) ELPP_FINAL
Definition: easylogging++.h:1472
Registry & operator=(const Registry &sr)
Assignment operator that unregisters all the existing registeries and deeply copies each of repo elem...
Definition: easylogging++.h:1426
Registry< T_Ptr, T_Key >::const_iterator const_iterator
Definition: easylogging++.h:1411
T_Ptr * get(const T_Key &uniqKey)
Gets pointer from repository. If none found, nullptr is returned.
Definition: easylogging++.h:1464
virtual ~Registry(void)
Definition: easylogging++.h:1434
Registry< T_Ptr, T_Key >::iterator iterator
Definition: easylogging++.h:1410
Registry(void)
Definition: easylogging++.h:1413
void unregister(const T_Key &uniqKey)
Unregisters single entry mapped to specified unique key.
Definition: easylogging++.h:1455
virtual void registerNew(const T_Key &uniqKey, T_Ptr *ptr) ELPP_FINAL
Registers new registry to repository.
Definition: easylogging++.h:1449
virtual void unregisterAll(void) ELPP_FINAL
Unregisters all the pointers from current repository.
Definition: easylogging++.h:1439
Registry(const Registry &sr)
Copy constructor that is useful for base classes. Try to avoid this constructor, use move constructor...
Definition: easylogging++.h:1416
String utilities helper class used internally. You should not use it.
Definition: easylogging++.h:1104
static bool isDigit(char c)
Checks if character is digit. Dont use libc implementation of it to prevent locale issues.
Definition: easylogging++.h:1107
Definition: easylogging++.h:1569
static T * callback(const std::string &id, std::unordered_map< std::string, TPtr > *mapT)
Definition: easylogging++.h:1588
static bool installCallback(const std::string &id, std::unordered_map< std::string, TPtr > *mapT)
Definition: easylogging++.h:1572
static void uninstallCallback(const std::string &id, std::unordered_map< std::string, TPtr > *mapT)
Definition: easylogging++.h:1581
const_iterator begin() const noexcept
Definition: dandelionpp.h:80
Concept for receiving events from GenericReader upon parsing. The functions return true if no error o...
static constexpr const char hex[]
Definition: wipeable_string.cpp:36
static std::vector< std::string > lookup(lookup_t type, const char *hostname)
Definition: dns_checks.cpp:47
#define ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(temp)
Definition: easylogging++.h:2974
#define ELPP_FINAL
Definition: easylogging++.h:284
#define ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(temp)
Definition: easylogging++.h:2984
#define ELPP_INTERNAL_ERROR(msg, pe)
Definition: easylogging++.h:207
#define ELPP_EXPORT
Definition: easylogging++.h:252
#define ELPP_UNUSED(x)
Definition: easylogging++.h:240
#define ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(temp)
Definition: easylogging++.h:2969
#define ELPP_LITERAL(txt)
Definition: easylogging++.h:539
#define ELPP_SIMPLE_LOG(LOG_TYPE)
Definition: easylogging++.h:2934
#define ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(temp)
Definition: easylogging++.h:2979
#define ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(temp)
Definition: easylogging++.h:2989
#define ELPP
Definition: easylogging++.h:2792
#define ELPP_INTERNAL_INFO(lvl, msg)
Definition: easylogging++.h:221
bool operator==(expect< T > const &lhs, expect< U > const &rhs) noexcept(noexcept(lhs.equal(rhs)))
Definition: expect.h:402
const int max_
Definition: gmock-cardinalities.cc:89
int * count
Definition: gmock_stress_test.cc:176
#define inline
Definition: inline_c.h:34
#define const
Definition: ipfrdr.c:80
std::size_t count_
Definition: levin_notify.cpp:690
net::dandelionpp::connection_map map_
Definition: levin_notify.cpp:583
static void log()
Definition: logging.cpp:81
static void init()
Definition: logging.cpp:38
static MDB_envinfo info
Definition: mdb_load.c:37
static int version
Definition: mdb_load.c:29
static int flags
Definition: mdb_load.c:31
argparse args
Definition: build_protob.py:10
urllib t
Definition: console.py:33
def next(obj)
Definition: ast.py:58
static const int kCrashSignalsCount
Definition: easylogging++.h:836
const base::type::char_t * unit
Definition: easylogging++.h:798
const char * name
Definition: easylogging++.h:810
const char * detail
Definition: easylogging++.h:812
static const char kFormatSpecifierChar
Definition: easylogging++.h:764
const char * brief
Definition: easylogging++.h:811
static const std::size_t kSourceLineMaxLength
Definition: easylogging++.h:794
static const char * kDefaultLoggerId
Definition: easylogging++.h:772
static const char * kFilePathSeperator
Definition: easylogging++.h:790
static const unsigned int kDefaultSubsecondPrecision
Definition: easylogging++.h:767
double value
Definition: easylogging++.h:797
const struct el::base::consts::@15 kTimeFormats[]
static const Level kPerformanceTrackerDefaultLevel
Definition: easylogging++.h:795
static const char kFormatSpecifierCharValue
Definition: easylogging++.h:763
static const unsigned int kMaxLogPerCounter
Definition: easylogging++.h:765
static const std::size_t kSourceFilenameMaxLength
Definition: easylogging++.h:793
int numb
Definition: easylogging++.h:809
const struct el::base::consts::@16 kCrashSignals[]
static const unsigned int kMaxLogPerContainer
Definition: easylogging++.h:766
static const int kTimeFormatsCount
Definition: easylogging++.h:807
base::threading::internal::NoScopedLock< base::threading::Mutex > ScopedLock
Definition: easylogging++.h:1030
base::threading::internal::NoMutex Mutex
Definition: easylogging++.h:1029
static std::string getCurrentThreadId(void)
Definition: easylogging++.h:1071
std::shared_ptr< PerformanceTrackingCallback > PerformanceTrackingCallbackPtr
Definition: easylogging++.h:562
std::unique_ptr< el::base::PerformanceTracker > PerformanceTrackerPtr
Definition: easylogging++.h:564
std::stringstream stringstream_t
Definition: easylogging++.h:548
unsigned short VerboseLevel
Definition: easylogging++.h:558
base::Storage * StoragePointer
Definition: easylogging++.h:560
std::fstream fstream_t
Definition: easylogging++.h:549
std::string string_t
Definition: easylogging++.h:547
std::ostream ostream_t
Definition: easylogging++.h:550
unsigned long int LineNumber
Definition: easylogging++.h:559
std::shared_ptr< LogDispatchCallback > LogDispatchCallbackPtr
Definition: easylogging++.h:561
unsigned int EnumType
Definition: easylogging++.h:557
std::shared_ptr< LoggerRegistrationCallback > LoggerRegistrationCallbackPtr
Definition: easylogging++.h:563
char char_t
Definition: easylogging++.h:546
static base::type::EnumType Or(Enum e, base::type::EnumType flag)
Definition: easylogging++.h:907
static base::type::EnumType And(Enum e, base::type::EnumType flag)
Definition: easylogging++.h:899
static base::type::EnumType Not(Enum e, base::type::EnumType flag)
Definition: easylogging++.h:903
static bool hasFlag(Enum e, base::type::EnumType flag)
Definition: easylogging++.h:920
static void removeFlag(Enum e, base::type::EnumType *flag)
Definition: easylogging++.h:916
static void addFlag(Enum e, base::type::EnumType *flag)
Definition: easylogging++.h:912
static std::enable_if< std::is_pointer< T * >::value, void >::type safeDelete(T *&pointer)
Deletes memory safely and points to null.
Definition: easylogging++.h:889
ELPP_EXPORT base::type::StoragePointer elStorage
TimestampUnit
Enum to represent timestamp unit.
Definition: easylogging++.h:843
FormatFlags
Format flags used to determine specifiers that are active for performance improvements.
Definition: easylogging++.h:847
DispatchAction
Action to be taken for dispatching.
Definition: easylogging++.h:2177
std::unordered_map< std::string, FileStreamPtr > LogStreamsReferenceMap
Definition: easylogging++.h:1934
std::shared_ptr< base::type::fstream_t > FileStreamPtr
Definition: easylogging++.h:1933
SubsecondPrecision MillisecondsWidth
Type alias of SubsecondPrecision.
Definition: easylogging++.h:882
static void defaultPreRollOutCallback(const char *, std::size_t)
Definition: easylogging++.h:841
Easylogging++ entry namespace.
Definition: easylogging++.cc:27
LoggingFlag
Flags used while writing logs. This flags are set by user.
Definition: easylogging++.h:725
@ DisableVModulesExtensions
Disable VModules extensions.
@ DisablePerformanceTrackingCheckpointComparison
Disables comparing performance tracker's checkpoints.
@ DisableVModules
Disable VModules.
@ CreateLoggerAutomatically
Creates logger automatically when not available.
@ AutoSpacing
Adds spaces b/w logs that separated by left-shift operator.
@ HierarchicalLogging
Enables hierarchical logging.
@ ImmediateFlush
Flushes log with every log-entry (performance sensative) - Disabled by default.
@ LogDetailedCrashReason
When handling crashes by default, detailed crash reason will be logged as well.
@ NewLineForContainer
Makes sure we have new line for each container log entry.
@ StrictLogFileSizeCheck
Enables strict file rolling.
@ DisableApplicationAbortOnFatalLog
Allows to disable application abortion when logged using FATAL level.
@ MultiLoggerSupport
Supports use of multiple logging in same macro, e.g, CLOG(INFO, "default", "network")
@ AllowVerboseIfModuleNotSpecified
Makes sure if -vmodule is used and does not specifies a module, then verbose logging is allowed via t...
@ FixedTimeFormat
Preserves time format and does not convert it to sec, hour etc (performance tracking only)
@ ColoredTerminalOutput
Make terminal output colorful for supported terminals.
ConfigurationType
Represents enumeration of ConfigurationType used to configure or access certain aspect of logging.
Definition: easylogging++.h:664
@ Enabled
Determines whether or not corresponding level and logger of logging is enabled You may disable all lo...
@ MillisecondsWidth
Alias of SubsecondPrecision (for backward compatibility)
@ Filename
Determines log file (full path) to write logs to for correponding level and logger.
@ MaxLogFileSize
Specifies log file max size.
@ Format
Determines format of logging corresponding level and logger.
@ SubsecondPrecision
Specifies precision of the subsecond part. It should be within range (1-6).
@ ToStandardOutput
Whether or not to write corresponding level and logger log to standard output. By standard output mea...
@ PerformanceTracking
Determines whether or not performance tracking is enabled.
@ LogFlushThreshold
Specifies number of log entries to hold until we flush pending log data.
@ ToFile
Whether or not to write corresponding log to log file.
std::function< std::string(const LogMessage *)> FormatSpecifierValueResolver
Resolving function for format specifier.
Definition: easylogging++.h:1680
Level
Represents enumeration for severity level used to determine level of logging.
Definition: easylogging++.h:591
@ Warning
Useful when application has potentially harmful situtaions.
@ Info
Mainly useful to represent current progress of application.
@ Global
Generic level that represents all the levels. Useful when setting global configuration for all levels...
@ Unknown
Represents unknown level.
@ Fatal
Severe error information that will presumably abort application.
@ Error
Information representing errors in application but application will keep running.
@ Debug
Informational events most useful for developers to debug application.
@ Verbose
Information that can be highly useful and vary with verbose logging level.
@ Trace
Information that can be useful to back-trace certain events - mostly useful than debug logs.
base::debug::CrashHandler elCrashHandler
std::shared_ptr< LogBuilder > LogBuilderPtr
Definition: easylogging++.h:2248
Color
Definition: easylogging++.h:611
std::function< void(const char *, std::size_t)> PreRollOutCallback
Definition: easylogging++.h:839
Definition: document.h:406
c
Definition: pymoduletest.py:79
int
Definition: pymoduletest.py:17
@ empty
Definition: readline_buffer.h:9
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
Definition: gmock-generated-matchers.h:481
const char * name
Definition: options.c:30
enum upnpconfigoptions id
Definition: options.c:29
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
const GenericPointer< typename T::ValueType > & pointer
Definition: pointer.h:1124
const char *const str
Definition: portlistingparse.c:23
#define M(w0, w14, w9, w1)
Definition: sha512-blocks.c:41
tools::wallet2::message_signature_result_t result
Definition: signature.cpp:62
const char * buf
Definition: slow_memmem.cpp:73
std::vector< int8_t > m_data
Definition: base58.cpp:76
int bool
Definition: stdbool.h:35
#define true
Definition: stdbool.h:36
#define false
Definition: stdbool.h:37
std::size_t operator()(const el::Level &l) const
Definition: easylogging++.h:624
std::string data
Definition: base58.cpp:37