17 #ifndef EASYLOGGINGPP_H 18 #define EASYLOGGINGPP_H 21 #if __cplusplus >= 201103L 23 #endif // __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 \ 32 + __GNUC_PATCHLEVEL__) 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 44 #if 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 62 # endif // !defined(__GLIBCXX__) || __GLIBCXX__ >= 20150426 63 # endif // __has_include(<thread>) 65 #if (defined(__MINGW32__) || defined(__MINGW64__)) 70 #if (defined(__CYGWIN__) && (__CYGWIN__ == 1)) 71 # define ELPP_CYGWIN 1 73 # define ELPP_CYGWIN 0 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__)) 94 # define ELPP_OS_MAC 1 96 # define ELPP_OS_MAC 0 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 152 # undef ELPP_OS_LINUX 153 # define ELPP_OS_UNIX 1 154 # define ELPP_OS_LINUX 1 155 #endif // !ELPP_OS_UNIX && !ELPP_OS_WINDOWS && ELPP_CYGWIN 156 #if !defined(ELPP_INTERNAL_DEBUGGING_OUT_INFO) 157 # define ELPP_INTERNAL_DEBUGGING_OUT_INFO std::cout 158 #endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) 159 #if !defined(ELPP_INTERNAL_DEBUGGING_OUT_ERROR) 160 # define ELPP_INTERNAL_DEBUGGING_OUT_ERROR std::cerr 161 #endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) 162 #if !defined(ELPP_INTERNAL_DEBUGGING_ENDL) 163 # define ELPP_INTERNAL_DEBUGGING_ENDL std::endl 164 #endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) 165 #if !defined(ELPP_INTERNAL_DEBUGGING_MSG) 166 # define ELPP_INTERNAL_DEBUGGING_MSG(msg) msg 167 #endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) 169 #if !defined(ELPP_DISABLE_ASSERT) 170 # if (defined(ELPP_DEBUG_ASSERT_FAILURE)) 171 # define ELPP_ASSERT(expr, msg) if (!(expr)) { \ 172 std::stringstream internalInfoStream; internalInfoStream << msg; \ 173 ELPP_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)) { \ 179 std::stringstream internalInfoStream; internalInfoStream << msg; \ 180 ELPP_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; } 184 # endif // (defined(ELPP_DEBUG_ASSERT_FAILURE)) 186 # define ELPP_ASSERT(x, y) 187 #endif //(!defined(ELPP_DISABLE_ASSERT) 188 #if ELPP_COMPILER_MSVC 189 # define ELPP_INTERNAL_DEBUGGING_WRITE_PERROR \ 190 { char buff[256]; strerror_s(buff, 256, errno); \ 191 ELPP_INTERNAL_DEBUGGING_OUT_ERROR << ": " << buff << " [" << errno << "]";} (void)0 193 # define ELPP_INTERNAL_DEBUGGING_WRITE_PERROR \ 194 ELPP_INTERNAL_DEBUGGING_OUT_ERROR << ": " << strerror(errno) << " [" << errno << "]"; (void)0 195 #endif // ELPP_COMPILER_MSVC 196 #if defined(ELPP_DEBUG_ERRORS) 197 # if !defined(ELPP_INTERNAL_ERROR) 198 # define ELPP_INTERNAL_ERROR(msg, pe) { \ 199 std::stringstream internalInfoStream; internalInfoStream << "<ERROR> " << msg; \ 200 ELPP_INTERNAL_DEBUGGING_OUT_ERROR \ 201 << "ERROR FROM EASYLOGGING++ (LINE: " << __LINE__ << ") " \ 202 << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << ELPP_INTERNAL_DEBUGGING_ENDL; \ 203 if (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) 208 #endif // defined(ELPP_DEBUG_ERRORS) 209 #if (defined(ELPP_DEBUG_INFO)) 210 # if !(defined(ELPP_INTERNAL_INFO_LEVEL)) 211 # define ELPP_INTERNAL_INFO_LEVEL 9 212 # endif // !(defined(ELPP_INTERNAL_INFO_LEVEL)) 213 # if !defined(ELPP_INTERNAL_INFO) 214 # define ELPP_INTERNAL_INFO(lvl, msg) { if (lvl <= ELPP_INTERNAL_INFO_LEVEL) { \ 215 std::stringstream internalInfoStream; internalInfoStream << "<INFO> " << msg; \ 216 ELPP_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) 222 #endif // (defined(ELPP_DEBUG_INFO)) 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"; 233 # endif // ELPP_COMPILER_MSVC 235 # endif // ELPP_COMPILER_GCC 237 # define ELPP_STACKTRACE 0 238 #endif // (defined(ELPP_FEATURE_ALL)) || (defined(ELPP_FEATURE_CRASH_LOG)) 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 244 #endif // ELPP_OS_UNIX 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) 250 # endif // defined(ELPP_EXPORT_SYMBOLS) 253 #endif // defined(ELPP_AS_DLL) && ELPP_COMPILER_MSVC 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 287 #endif // ELPP_COMPILER_INTEL || (ELPP_GCC_VERSION < 40702) 288 #if defined(ELPP_EXPERIMENTAL_ASYNC) 289 # define ELPP_ASYNC_LOGGING 1 291 # define ELPP_ASYNC_LOGGING 0 292 #endif // defined(ELPP_EXPERIMENTAL_ASYNC) 293 #if defined(ELPP_THREAD_SAFE) || ELPP_ASYNC_LOGGING 294 # define ELPP_THREADING_ENABLED 1 296 # define ELPP_THREADING_ENABLED 0 297 #endif // defined(ELPP_THREAD_SAFE) || ELPP_ASYNC_LOGGING 300 #if ELPP_COMPILER_MSVC // Visual C++ 301 # define ELPP_FUNC __FUNCSIG__ 302 #elif ELPP_COMPILER_GCC // GCC 303 # define ELPP_FUNC __PRETTY_FUNCTION__ 304 #elif ELPP_COMPILER_INTEL // Intel C++ 305 # define ELPP_FUNC __PRETTY_FUNCTION__ 306 #elif ELPP_COMPILER_CLANG // Clang++ 307 # define ELPP_FUNC __PRETTY_FUNCTION__ 309 # if defined(__func__) 310 # define ELPP_FUNC __func__ 312 # define ELPP_FUNC "" 313 # endif // defined(__func__) 314 #endif // defined(_MSC_VER) 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 329 #endif // (!defined(ELPP_DISABLE_DEBUG_LOGS) && (ELPP_LOGGING_ENABLED)) 330 #if (!defined(ELPP_DISABLE_INFO_LOGS) && (ELPP_LOGGING_ENABLED)) 331 # define ELPP_INFO_LOG 1 333 # define ELPP_INFO_LOG 0 334 #endif // (!defined(ELPP_DISABLE_INFO_LOGS) && (ELPP_LOGGING_ENABLED)) 335 #if (!defined(ELPP_DISABLE_WARNING_LOGS) && (ELPP_LOGGING_ENABLED)) 336 # define ELPP_WARNING_LOG 1 338 # define ELPP_WARNING_LOG 0 339 #endif // (!defined(ELPP_DISABLE_WARNING_LOGS) && (ELPP_LOGGING_ENABLED)) 340 #if (!defined(ELPP_DISABLE_ERROR_LOGS) && (ELPP_LOGGING_ENABLED)) 341 # define ELPP_ERROR_LOG 1 343 # define ELPP_ERROR_LOG 0 344 #endif // (!defined(ELPP_DISABLE_ERROR_LOGS) && (ELPP_LOGGING_ENABLED)) 345 #if (!defined(ELPP_DISABLE_FATAL_LOGS) && (ELPP_LOGGING_ENABLED)) 346 # define ELPP_FATAL_LOG 1 348 # define ELPP_FATAL_LOG 0 349 #endif // (!defined(ELPP_DISABLE_FATAL_LOGS) && (ELPP_LOGGING_ENABLED)) 350 #if (!defined(ELPP_DISABLE_TRACE_LOGS) && (ELPP_LOGGING_ENABLED)) 351 # define ELPP_TRACE_LOG 1 353 # define ELPP_TRACE_LOG 0 354 #endif // (!defined(ELPP_DISABLE_TRACE_LOGS) && (ELPP_LOGGING_ENABLED)) 355 #if (!defined(ELPP_DISABLE_VERBOSE_LOGS) && (ELPP_LOGGING_ENABLED)) 356 # define ELPP_VERBOSE_LOG 1 358 # define ELPP_VERBOSE_LOG 0 359 #endif // (!defined(ELPP_DISABLE_VERBOSE_LOGS) && (ELPP_LOGGING_ENABLED)) 360 #if (!(ELPP_CXX0X || ELPP_CXX11)) 361 # error "C++0x (or higher) support not detected! (Is `-std=c++11' missing?)" 362 #endif // (!(ELPP_CXX0X || ELPP_CXX11)) 364 #if defined(ELPP_SYSLOG) 366 #endif // defined(ELPP_SYSLOG) 376 #if defined(ELPP_UNICODE) 380 # endif // ELPP_OS_WINDOWS 381 #endif // defined(ELPP_UNICODE) 384 # include <execinfo.h> 385 #endif // ELPP_STACKTRACE 387 # include <sys/system_properties.h> 388 #endif // ELPP_OS_ANDROID 390 # include <sys/stat.h> 391 # include <sys/time.h> 392 #elif ELPP_OS_WINDOWS 394 # include <windows.h> 395 # if defined(WIN32_LEAN_AND_MEAN) 396 # if defined(ELPP_WINSOCK2) 397 # include <winsock2.h> 399 # include <winsock.h> 400 # endif // defined(ELPP_WINSOCK2) 401 # endif // defined(WIN32_LEAN_AND_MEAN) 402 #endif // ELPP_OS_UNIX 406 #include <unordered_map> 408 #include <functional> 414 #include <type_traits> 415 #if ELPP_THREADING_ENABLED 416 # if ELPP_USE_STD_THREADING 421 # include <pthread.h> 422 # endif // ELPP_OS_UNIX 423 # endif // ELPP_USE_STD_THREADING 424 #endif // ELPP_THREADING_ENABLED 425 #if ELPP_ASYNC_LOGGING 426 # if defined(ELPP_NO_SLEEP_FOR) 428 # endif // defined(ELPP_NO_SLEEP_FOR) 431 # include <condition_variable> 432 #endif // ELPP_ASYNC_LOGGING 433 #if defined(ELPP_STL_LOGGING) 441 # if defined(ELPP_LOG_STD_ARRAY) 443 # endif // defined(ELPP_LOG_STD_ARRAY) 444 # if defined(ELPP_LOG_UNORDERED_SET) 445 # include <unordered_set> 446 # endif // defined(ELPP_UNORDERED_SET) 447 #endif // defined(ELPP_STL_LOGGING) 448 #if defined(ELPP_QT_LOGGING) 451 # include <QByteArray> 458 # include <QLinkedList> 460 # include <QMultiHash> 462 #endif // defined(ELPP_QT_LOGGING) 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> 473 #endif // defined(ELPP_BOOST_LOGGING) 474 #if defined(ELPP_WXWIDGETS_LOGGING) 476 # include <wx/vector.h> 477 #endif // defined(ELPP_WXWIDGETS_LOGGING) 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 486 #endif // defined(ELPP_UTC_DATETIME) 491 class PerformanceTrackingData;
501 class RegisteredLoggers;
502 class PerformanceTracker;
503 class MessageBuilder;
507 class DefaultLogBuilder;
508 class DefaultLogDispatchCallback;
509 #if ELPP_ASYNC_LOGGING 510 class AsyncLogDispatchCallback;
511 class AsyncDispatchWorker;
512 #endif // ELPP_ASYNC_LOGGING 513 class 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 532 # endif // defined ELPP_CUSTOM_COUT 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 545 # endif // defined ELPP_CUSTOM_COUT 551 #endif // defined(ELPP_UNICODE) 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 556 #endif // defined(ELPP_CUSTOM_COUT_LINE) 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 777 static const char* kPerformanceLoggerId = ELPP_DEFAULT_PERFORMANCE_LOGGER;
779 static const char* kPerformanceLoggerId =
"performance";
780 #endif // ELPP_DEFAULT_PERFORMANCE_LOGGER 783 #if defined(ELPP_SYSLOG) 784 static const char* kSysLogLoggerId =
"syslog";
785 #endif // defined(ELPP_SYSLOG) 791 #endif // ELPP_OS_WINDOWS 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);
886 template <
typename T>
898 template <
typename Enum>
902 template <
typename Enum>
906 template <
typename Enum>
911 template <
typename Enum>
913 *flag = base::utils::bitwise::Or<Enum>(
e, *flag);
915 template <
typename Enum>
917 *flag = base::utils::bitwise::Not<Enum>(
e, *flag);
919 template <
typename Enum>
921 return base::utils::bitwise::And<Enum>(
e, flag) > 0x0;
924 namespace threading {
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);
940 # endif // ELPP_OS_UNIX 945 pthread_mutex_destroy(&m_underlyingMutex);
946 # elif ELPP_OS_WINDOWS 947 DeleteCriticalSection(&m_underlyingMutex);
948 # endif // ELPP_OS_UNIX 953 pthread_mutex_lock(&m_underlyingMutex);
954 # elif ELPP_OS_WINDOWS 955 EnterCriticalSection(&m_underlyingMutex);
956 # endif // ELPP_OS_UNIX 961 return (pthread_mutex_trylock(&m_underlyingMutex) == 0);
962 # elif ELPP_OS_WINDOWS 963 return TryEnterCriticalSection(&m_underlyingMutex);
964 # endif // ELPP_OS_UNIX 969 pthread_mutex_unlock(&m_underlyingMutex);
970 # elif ELPP_OS_WINDOWS 971 LeaveCriticalSection(&m_underlyingMutex);
972 # endif // ELPP_OS_UNIX 977 pthread_mutex_t m_underlyingMutex;
978 # elif ELPP_OS_WINDOWS 979 CRITICAL_SECTION m_underlyingMutex;
980 # endif // ELPP_OS_UNIX 983 template <
typename M>
1002 typedef std::recursive_mutex
Mutex;
1003 typedef std::lock_guard<base::threading::Mutex>
ScopedLock;
1004 # endif // !ELPP_USE_STD_THREADING 1011 inline void lock(
void) {}
1012 inline bool try_lock(
void) {
1015 inline void unlock(
void) {}
1018 template <
typename Mutex>
1021 explicit NoScopedLock(
Mutex&) {
1023 virtual ~NoScopedLock(
void) {
1029 typedef base::threading::internal::NoMutex
Mutex;
1030 typedef base::threading::internal::NoScopedLock<base::threading::Mutex>
ScopedLock;
1031 #endif // ELPP_THREADING_ENABLED 1045 #if ELPP_THREADING_ENABLED 1046 # if !ELPP_USE_STD_THREADING 1049 std::stringstream ss;
1050 # if (ELPP_OS_WINDOWS) 1051 ss << GetCurrentThreadId();
1052 # endif // (ELPP_OS_WINDOWS) 1058 std::stringstream ss;
1059 char prev_fill = ss.fill(
' ');
1062 auto prev_width = ss.width(16);
1063 ss << std::this_thread::get_id();
1065 ss.flags(prev_flags);
1066 ss.width(prev_width);
1069 # endif // !ELPP_USE_STD_THREADING 1074 #endif // ELPP_THREADING_ENABLED 1087 static bool pathExists(
const char* path,
bool considerFile =
false);
1108 return c >=
'0' &&
c <=
'9';
1147 #if defined(ELPP_UNICODE) 1150 #endif // defined(ELPP_UNICODE) 1157 static bool cStringEq(
const char* s1,
const char* s2);
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);
1178 static const char* getWindowsEnvironmentVariable(
const char* varname);
1183 #endif // ELPP_OS_WINDOWS 1190 #endif // ELPP_OS_ANDROID 1205 const char* alternativeBashCommand =
nullptr);
1241 static unsigned long long getTimeDifference(
const struct timeval& endTime,
const struct timeval& startTime,
1245 static struct ::tm*
buildTimeInfo(
struct timeval* currTime, struct ::tm* timeInfo);
1247 static char*
parseFormat(
char*
buf, std::size_t bufSz,
const char* format,
const struct tm* tInfo,
1254 setArgs(0, static_cast<char**>(
nullptr));
1264 inline void setArgs(
int argc,
const char** argv) {
1265 setArgs(argc, const_cast<char**>(argv));
1268 void setArgs(
int argc,
char** argv);
1275 bool hasParam(
const char* paramKey)
const;
1277 bool empty(
void)
const;
1279 std::size_t
size(
void)
const;
1294 template <
typename T_Ptr,
typename Container>
1316 for (std::size_t
i = 0;
i <
m_list.size(); ++
i) {
1328 for (std::size_t
i = 0;
i <
m_list.size(); ++
i) {
1409 template <
typename T_Ptr,
typename T_Key = const
char*>
1442 if (!this->
empty()) {
1443 for (
auto&& curr : this->
list()) {
1446 this->
list().clear();
1453 this->
list().insert(std::make_pair(uniqKey, ptr));
1458 T_Ptr* existing =
get(uniqKey);
1459 if (existing !=
nullptr) {
1460 this->
list().erase(uniqKey);
1466 T_Ptr*
get(
const T_Key& uniqKey) {
1468 return it == this->
list().end()
1485 template <
typename T_Ptr,
typename Pred>
1526 if (!this->
empty()) {
1527 for (
auto&& curr : this->
list()) {
1530 this->
list().clear();
1537 for (; iter != this->
end(); ++iter) {
1542 if (iter != this->
end() && *iter !=
nullptr) {
1543 this->
list().erase(iter);
1550 this->
list().push_back(ptr);
1555 template <
typename T,
typename T2>
1556 T_Ptr*
get(
const T& arg1,
const T2 arg2) {
1558 if (iter != this->
list().
end() && *iter !=
nullptr) {
1566 for (
const_iterator it = sr.list().begin(); it != sr.list().end(); ++it) {
1573 template <
typename T,
typename TPtr>
1575 if (mapT->find(
id) == mapT->end()) {
1576 mapT->insert(std::make_pair(
id, TPtr(
new T())));
1582 template <
typename T,
typename TPtr>
1584 if (mapT->find(
id) != mapT->end()) {
1589 template <
typename T,
typename TPtr>
1591 typename std::unordered_map<std::string, TPtr>::iterator iter = mapT->find(
id);
1592 if (iter != mapT->end()) {
1593 return static_cast<T*
>(iter->second.get());
1991 template <
typename Conf_T>
1992 inline Conf_T
getConfigByVal(
Level level,
const std::unordered_map<Level, Conf_T>* confMap,
const char* confName) {
1997 template <
typename Conf_T>
1998 inline Conf_T&
getConfigByRef(
Level level, std::unordered_map<Level, Conf_T>* confMap,
const char* confName) {
2003 template <
typename Conf_T>
2006 typename std::unordered_map<Level, Conf_T>::const_iterator it = confMap->find(level);
2007 if (it == confMap->end()) {
2013 << std::endl <<
"Please ensure you have properly configured logger.",
false);
2020 template <
typename Conf_T>
2023 typename std::unordered_map<Level, Conf_T>::iterator it = confMap->find(level);
2024 if (it == confMap->end()) {
2030 << std::endl <<
"Please ensure you have properly configured logger.",
false);
2037 template <
typename Conf_T>
2039 bool includeGlobalLevel =
true) {
2041 if (confMap->empty() && includeGlobalLevel) {
2046 typename std::unordered_map<Level, Conf_T>::iterator it = confMap->find(
Level::Global);
2047 if (it != confMap->end() && it->second ==
value) {
2051 it = confMap->find(level);
2052 if (it == confMap->end()) {
2054 confMap->insert(std::make_pair(level,
value));
2057 confMap->at(level) =
value;
2094 if (&hitCounter !=
this) {
2142 return ((counter !=
nullptr) &&
2175 return get(filename, lineNumber);
2183 template <
typename T>
2184 class Callback :
protected base::threading::ThreadSafe {
2195 virtual void handle(
const T* handlePtr) = 0;
2226 std::unordered_map<std::string, std::unique_ptr<base::threading::Mutex>>
m_fileLocks;
2318 #if ELPP_VARIADIC_TEMPLATES_SUPPORTED 2319 # define LOGGER_LEVEL_WRITERS_SIGNATURES(FUNCTION_NAME)\ 2320 template <typename T, typename... Args>\ 2321 inline void FUNCTION_NAME(const char*, const T&, const Args&...);\ 2322 template <typename T>\ 2323 inline void FUNCTION_NAME(const T&); 2325 template <
typename T,
typename...
Args>
2326 inline void verbose(
int,
const char*,
const T&,
const Args&...);
2328 template <
typename T>
2329 inline void verbose(
int,
const T&);
2331 LOGGER_LEVEL_WRITERS_SIGNATURES(
info)
2332 LOGGER_LEVEL_WRITERS_SIGNATURES(debug)
2333 LOGGER_LEVEL_WRITERS_SIGNATURES(warn)
2334 LOGGER_LEVEL_WRITERS_SIGNATURES(
error)
2335 LOGGER_LEVEL_WRITERS_SIGNATURES(fatal)
2336 LOGGER_LEVEL_WRITERS_SIGNATURES(
trace)
2337 # undef LOGGER_LEVEL_WRITERS_SIGNATURES 2338 #endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED 2364 #if ELPP_VARIADIC_TEMPLATES_SUPPORTED 2365 template <
typename T,
typename...
Args>
2366 void log_(
Level,
int,
const char*,
const T&,
const Args&...);
2368 template <
typename T>
2369 inline void log_(
Level,
int,
const T&);
2371 template <
typename T,
typename...
Args>
2374 template <
typename T>
2376 #endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED 2407 template <
typename T>
2409 return base::utils::Utils::installCallback<T, base::type::LoggerRegistrationCallbackPtr>(
id,
2413 template <
typename T>
2418 template <
typename T>
2426 return get(
id,
false) !=
nullptr;
2476 void setCategories(
const char* categories,
bool clear =
true);
2487 inline const std::unordered_map<std::string, base::type::VerboseLevel>&
modules(
void)
const {
2509 std::unordered_map<std::string, base::type::VerboseLevel>
m_modules;
2558 #if ELPP_ASYNC_LOGGING 2559 class AsyncLogItem {
2562 : m_logMessage(logMessage), m_dispatchData(
data), m_logLine(logLine) {}
2563 virtual ~AsyncLogItem() {}
2565 return &m_logMessage;
2568 return &m_dispatchData;
2578 class AsyncLogQueue :
public base::threading::ThreadSafe {
2580 virtual ~AsyncLogQueue() {
2584 inline AsyncLogItem
next(
void) {
2586 AsyncLogItem
result = m_queue.front();
2591 inline void push(
const AsyncLogItem& item) {
2595 inline void pop(
void) {
2599 inline AsyncLogItem front(
void) {
2601 return m_queue.front();
2603 inline bool empty(
void) {
2605 return m_queue.empty();
2608 std::queue<AsyncLogItem> m_queue;
2612 virtual ~IWorker() {}
2613 virtual void start() = 0;
2615 #endif // ELPP_ASYNC_LOGGING 2616 class Storage : base::NoCopy,
public base::threading::ThreadSafe {
2619 #if ELPP_ASYNC_LOGGING 2623 #endif // ELPP_ASYNC_LOGGING 2651 #if ELPP_ASYNC_LOGGING 2652 inline base::AsyncLogQueue* asyncLogQueue(
void)
const {
2653 return m_asyncLogQueue;
2655 #endif // ELPP_ASYNC_LOGGING 2709 template <
typename T>
2714 template <
typename T>
2718 template <
typename T>
2723 #if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING) 2724 template <
typename T>
2725 inline bool installPerformanceTrackingCallback(
const std::string&
id) {
2726 return base::utils::Utils::installCallback<T, base::type::PerformanceTrackingCallbackPtr>(
id,
2730 template <
typename T>
2731 inline void uninstallPerformanceTrackingCallback(
const std::string&
id) {
2732 base::utils::Utils::uninstallCallback<T, base::type::PerformanceTrackingCallbackPtr>(
id,
2736 template <
typename T>
2737 inline T* performanceTrackingCallback(
const std::string&
id) {
2740 #endif // defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING) 2744 if (
name.empty())
return;
2751 std::unordered_map<std::string, std::string>::const_iterator it =
m_threadNames.find(threadId);
2765 #if ELPP_ASYNC_LOGGING 2766 base::AsyncLogQueue* m_asyncLogQueue;
2767 base::IWorker* m_asyncDispatchWorker;
2768 #endif // ELPP_ASYNC_LOGGING 2794 #define ELPP el::base::Storage::getELPP() 2802 #if ELPP_ASYNC_LOGGING 2809 AsyncDispatchWorker();
2810 virtual ~AsyncDispatchWorker();
2813 void emptyQueue(
void);
2814 virtual void start(
void);
2815 void handle(AsyncLogItem* logItem);
2818 void setContinueRunning(
bool value) {
2820 m_continueRunning =
value;
2823 bool continueRunning(
void)
const {
2824 return m_continueRunning;
2827 std::condition_variable cv;
2828 bool m_continueRunning;
2831 #endif // ELPP_ASYNC_LOGGING 2854 #if defined(ELPP_STL_LOGGING) 2855 namespace workarounds {
2863 template <
typename T,
typename Container>
2864 class IterableContainer {
2866 typedef typename Container::iterator iterator;
2867 typedef typename Container::const_iterator const_iterator;
2868 IterableContainer(
void) {}
2869 virtual ~IterableContainer(
void) {}
2870 iterator begin(
void) {
2871 return getContainer().begin();
2873 iterator end(
void) {
2874 return getContainer().end();
2877 virtual Container& getContainer(
void) = 0;
2880 template<
typename T,
typename Container = std::vector<T>,
typename Comparator = std::less<
typename Container::value_type>>
2881 class IterablePriorityQueue :
public IterableContainer<T, Container>,
2882 public std::priority_queue<T, Container, Comparator> {
2884 IterablePriorityQueue(std::priority_queue<T, Container, Comparator> queue_) {
2887 this->push(queue_.top());
2892 inline Container& getContainer(
void) {
2897 template<
typename T,
typename Container = std::deque<T>>
2898 class IterableQueue :
public IterableContainer<T, Container>,
public std::queue<T, Container> {
2900 IterableQueue(std::queue<T, Container> queue_) {
2903 this->push(queue_.front());
2908 inline Container& getContainer(
void) {
2913 template<
typename T,
typename Container = std::deque<T>>
2914 class IterableStack :
public IterableContainer<T, Container>,
public std::stack<T, Container> {
2916 IterableStack(std::stack<T, Container> stack_) {
2919 this->push(stack_.top());
2924 inline Container& getContainer(
void) {
2929 #endif // defined(ELPP_STL_LOGGING) 2936 # define ELPP_SIMPLE_LOG(LOG_TYPE)\ 2937 MessageBuilder& operator<<(LOG_TYPE msg) {\ 2938 m_logger->stream() << msg;\ 2939 if (ELPP->hasFlag(LoggingFlag::AutoSpacing)) {\ 2940 m_logger->stream() << " ";\ 2971 #define ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(temp) \ 2972 template <typename T> \ 2973 inline MessageBuilder& operator<<(const temp<T>& template_inst) { \ 2974 return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ 2976 #define ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(temp) \ 2977 template <typename T1, typename T2> \ 2978 inline MessageBuilder& operator<<(const temp<T1, T2>& template_inst) { \ 2979 return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ 2981 #define ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(temp) \ 2982 template <typename T1, typename T2, typename T3> \ 2983 inline MessageBuilder& operator<<(const temp<T1, T2, T3>& template_inst) { \ 2984 return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ 2986 #define ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(temp) \ 2987 template <typename T1, typename T2, typename T3, typename T4> \ 2988 inline MessageBuilder& operator<<(const temp<T1, T2, T3, T4>& template_inst) { \ 2989 return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ 2991 #define ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(temp) \ 2992 template <typename T1, typename T2, typename T3, typename T4, typename T5> \ 2993 inline MessageBuilder& operator<<(const temp<T1, T2, T3, T4, T5>& template_inst) { \ 2994 return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ 2997 #if defined(ELPP_STL_LOGGING) 3005 template <
class T,
class Container>
3006 inline MessageBuilder& operator<<(const std::queue<T, Container>& queue_) {
3007 base::workarounds::IterableQueue<T, Container> iterableQueue_ =
3008 static_cast<base::workarounds::IterableQueue<T, Container>
>(queue_);
3009 return writeIterator(iterableQueue_.begin(), iterableQueue_.end(), iterableQueue_.size());
3011 template <
class T,
class Container>
3012 inline MessageBuilder& operator<<(const std::stack<T, Container>& stack_) {
3013 base::workarounds::IterableStack<T, Container> iterableStack_ =
3014 static_cast<base::workarounds::IterableStack<T, Container>
>(stack_);
3015 return writeIterator(iterableStack_.begin(), iterableStack_.end(), iterableStack_.size());
3017 template <
class T,
class Container,
class Comparator>
3018 inline MessageBuilder& operator<<(const std::priority_queue<T, Container, Comparator>& priorityQueue_) {
3019 base::workarounds::IterablePriorityQueue<T, Container, Comparator> iterablePriorityQueue_ =
3020 static_cast<base::workarounds::IterablePriorityQueue<T, Container, Comparator>
>(priorityQueue_);
3021 return writeIterator(iterablePriorityQueue_.begin(), iterablePriorityQueue_.end(), iterablePriorityQueue_.size());
3023 template <
class First,
class Second>
3024 MessageBuilder& operator<<(const std::pair<First, Second>& pair_) {
3026 operator << (static_cast<First>(pair_.first));
3028 operator << (static_cast<Second>(pair_.second));
3032 template <std::
size_t Size>
3039 # if defined(ELPP_LOG_STD_ARRAY) 3040 template <
class T, std::
size_t Size>
3041 inline MessageBuilder& operator<<(const std::array<T, Size>& array) {
3042 return writeIterator(array.begin(), array.end(), array.size());
3044 # endif // defined(ELPP_LOG_STD_ARRAY) 3045 # if defined(ELPP_LOG_UNORDERED_MAP) 3048 # endif // defined(ELPP_LOG_UNORDERED_MAP) 3049 # if defined(ELPP_LOG_UNORDERED_SET) 3052 # endif // defined(ELPP_LOG_UNORDERED_SET) 3053 #endif // defined(ELPP_STL_LOGGING) 3054 #if defined(ELPP_QT_LOGGING) 3056 # if defined(ELPP_UNICODE) 3060 # endif // defined(ELPP_UNICODE) 3070 # if defined(ELPP_UNICODE) 3074 # endif // defined(ELPP_UNICODE) 3078 # if defined(ELPP_UNICODE) 3082 # endif // defined(ELPP_UNICODE) 3099 template <
typename First,
typename Second>
3102 operator << (static_cast<First>(pair_.first));
3104 operator << (static_cast<Second>(pair_.second));
3108 template <
typename K,
typename V>
3111 QList<K> keys =
map_.keys();
3112 typename QList<K>::const_iterator begin = keys.
begin();
3113 typename QList<K>::const_iterator end = keys.end();
3115 for (
int index_ = 0; begin != end && index_ <
max_; ++index_, ++begin) {
3117 operator << (static_cast<K>(*begin));
3119 operator << (static_cast<V>(
map_.value(*begin)));
3129 template <
typename K,
typename V>
3131 operator << (static_cast<QMap<K, V>>(
map_));
3134 template <
typename K,
typename V>
3137 QList<K> keys = hash_.keys();
3138 typename QList<K>::const_iterator begin = keys.begin();
3139 typename QList<K>::const_iterator end = keys.end();
3141 for (
int index_ = 0; begin != end && index_ <
max_; ++index_, ++begin) {
3143 operator << (static_cast<K>(*begin));
3145 operator << (static_cast<V>(hash_.value(*begin)));
3155 template <
typename K,
typename V>
3156 inline MessageBuilder& operator<<(const QMultiHash<K, V>& multiHash_) {
3157 operator << (static_cast<QHash<K, V>>(multiHash_));
3160 #endif // defined(ELPP_QT_LOGGING) 3161 #if defined(ELPP_BOOST_LOGGING) 3170 #endif // defined(ELPP_BOOST_LOGGING) 3180 #define MAKE_CONTAINERELPP_FRIENDLY(ContainerType, SizeMethod, ElementInstance) \ 3181 el::base::type::ostream_t& operator<<(el::base::type::ostream_t& ss, const ContainerType& container) {\ 3182 const el::base::type::char_t* sep = ELPP->hasFlag(el::LoggingFlag::NewLineForContainer) ? \ 3183 ELPP_LITERAL("\n ") : ELPP_LITERAL(", ");\ 3184 ContainerType::const_iterator elem = container.begin();\ 3185 ContainerType::const_iterator endElem = container.end();\ 3186 std::size_t size_ = container.SizeMethod; \ 3187 ss << ELPP_LITERAL("[");\ 3188 for (std::size_t i = 0; elem != endElem && i < el::base::consts::kMaxLogPerContainer; ++i, ++elem) { \ 3189 ss << ElementInstance;\ 3190 ss << ((i < size_ - 1) ? sep : ELPP_LITERAL(""));\ 3192 if (elem != endElem) {\ 3193 ss << ELPP_LITERAL("...");\ 3195 ss << ELPP_LITERAL("]");\ 3198 #if defined(ELPP_WXWIDGETS_LOGGING) 3200 # define ELPP_WX_PTR_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), *(*elem)) 3201 # define ELPP_WX_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), (*elem)) 3202 # define ELPP_WX_HASH_MAP_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), \ 3203 ELPP_LITERAL("(") << elem->first << ELPP_LITERAL(", ") << elem->second << ELPP_LITERAL(")") 3205 # define ELPP_WX_PTR_ENABLED(ContainerType) 3206 # define ELPP_WX_ENABLED(ContainerType) 3207 # define ELPP_WX_HASH_MAP_ENABLED(ContainerType) 3208 #endif // defined(ELPP_WXWIDGETS_LOGGING) 3210 template <
class Class>
3212 #undef ELPP_SIMPLE_LOG 3213 #undef ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG 3214 #undef ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG 3215 #undef ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG 3216 #undef ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG 3217 #undef ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG 3222 template<
class Iterator>
3229 if (begin_ != end_) {
3249 template <
typename T>
3278 #if ELPP_LOGGING_ENABLED 3282 #endif // ELPP_LOGGING_ENABLED 3319 base::
Writer(level, color, file,
line, func, dispatchAction, verboseLevel) {
3326 #if ELPP_VARIADIC_TEMPLATES_SUPPORTED 3327 template <
typename T,
typename...
Args>
3328 void Logger::log_(
Level level,
int vlevel,
const char*
s,
const T&
value,
const Args&...
args) {
3329 base::MessageBuilder
b;
3339 log_(level, vlevel, ++
s,
args...);
3346 ELPP_INTERNAL_ERROR(
"Too many arguments provided. Unable to handle. Please provide more format specifiers",
false);
3348 template <
typename T>
3349 void Logger::log_(
Level level,
int vlevel,
const T&
log) {
3351 if (
ELPP->vRegistry()->allowed(vlevel, __FILE__)) {
3359 base::Writer(level,
Color::Default,
"FILE", 0,
"FUNCTION").construct(
this,
false) <<
log;
3362 template <
typename T,
typename...
Args>
3367 template <
typename T>
3370 log_(level, 0,
log);
3372 # if ELPP_VERBOSE_LOG 3373 template <
typename T,
typename...
Args>
3374 inline void Logger::verbose(
int vlevel,
const char*
s,
const T&
value,
const Args&...
args) {
3378 template <
typename T>
3379 inline void Logger::verbose(
int vlevel,
const T&
log) {
3384 template <
typename T,
typename...
Args>
3385 inline void Logger::verbose(
int,
const char*,
const T&,
const Args&...) {
3388 template <
typename T>
3389 inline void Logger::verbose(
int,
const T&) {
3392 # endif // ELPP_VERBOSE_LOG 3393 # define LOGGER_LEVEL_WRITERS(FUNCTION_NAME, LOG_LEVEL)\ 3394 template <typename T, typename... Args>\ 3395 inline void Logger::FUNCTION_NAME(const char* s, const T& value, const Args&... args) {\ 3396 log(LOG_LEVEL, s, value, args...);\ 3398 template <typename T>\ 3399 inline void Logger::FUNCTION_NAME(const T& value) {\ 3400 log(LOG_LEVEL, value);\ 3402 # define LOGGER_LEVEL_WRITERS_DISABLED(FUNCTION_NAME, LOG_LEVEL)\ 3403 template <typename T, typename... Args>\ 3404 inline void Logger::FUNCTION_NAME(const char*, const T&, const Args&...) {\ 3407 template <typename T>\ 3408 inline void Logger::FUNCTION_NAME(const T&) {\ 3416 # endif // ELPP_INFO_LOG 3421 # endif // ELPP_DEBUG_LOG 3422 # if ELPP_WARNING_LOG 3426 # endif // ELPP_WARNING_LOG 3431 # endif // ELPP_ERROR_LOG 3436 # endif // ELPP_FATAL_LOG 3441 # endif // ELPP_TRACE_LOG 3442 # undef LOGGER_LEVEL_WRITERS 3443 # undef LOGGER_LEVEL_WRITERS_DISABLED 3444 #endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED 3445 #if ELPP_COMPILER_MSVC 3446 # define ELPP_VARIADIC_FUNC_MSVC(variadicFunction, variadicArgs) variadicFunction variadicArgs 3447 # define ELPP_VARIADIC_FUNC_MSVC_RUN(variadicFunction, ...) ELPP_VARIADIC_FUNC_MSVC(variadicFunction, (__VA_ARGS__)) 3448 # define el_getVALength(...) ELPP_VARIADIC_FUNC_MSVC_RUN(el_resolveVALength, 0, ## __VA_ARGS__,\ 3449 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) 3451 # if ELPP_COMPILER_CLANG 3452 # define el_getVALength(...) el_resolveVALength(0, __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) 3454 # define el_getVALength(...) el_resolveVALength(0, ## __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) 3455 # endif // ELPP_COMPILER_CLANG 3456 #endif // ELPP_COMPILER_MSVC 3457 #define el_resolveVALength(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N 3458 #define ELPP_WRITE_LOG(writer, level, dispatchAction, ...) \ 3459 writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) 3460 #define ELPP_WRITE_LOG_IF(writer, condition, level, dispatchAction, ...) if (condition) \ 3461 writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) 3462 #define ELPP_WRITE_LOG_EVERY_N(writer, occasion, level, dispatchAction, ...) \ 3463 ELPP->validateEveryNCounter(__FILE__, __LINE__, occasion) && \ 3464 writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) 3465 #define ELPP_WRITE_LOG_AFTER_N(writer, n, level, dispatchAction, ...) \ 3466 ELPP->validateAfterNCounter(__FILE__, __LINE__, n) && \ 3467 writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) 3468 #define ELPP_WRITE_LOG_N_TIMES(writer, n, level, dispatchAction, ...) \ 3469 ELPP->validateNTimesCounter(__FILE__, __LINE__, n) && \ 3470 writer(level, el::Color::Default, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) 3471 #if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING) 3472 class PerformanceTrackingData {
3475 Checkpoint = 1, Complete = 2
3478 explicit PerformanceTrackingData(DataType dataType) : m_performanceTracker(
nullptr),
3479 m_dataType(dataType), m_firstCheckpoint(
false), m_file(
""), m_line(0), m_func(
"") {}
3481 inline const struct timeval* startTime(
void)
const;
3482 inline const struct timeval* endTime(
void)
const;
3483 inline const struct timeval* lastCheckpointTime(
void)
const;
3484 inline const base::PerformanceTracker* performanceTracker(
void)
const {
3485 return m_performanceTracker;
3487 inline PerformanceTrackingData::DataType dataType(
void)
const {
3490 inline bool firstCheckpoint(
void)
const {
3491 return m_firstCheckpoint;
3494 return m_checkpointId;
3496 inline const char* file(
void)
const {
3502 inline const char* func(
void)
const {
3506 return &m_formattedTimeTaken;
3510 base::PerformanceTracker* m_performanceTracker;
3512 PerformanceTrackingData::DataType m_dataType;
3513 bool m_firstCheckpoint;
3518 inline void init(base::PerformanceTracker* performanceTracker,
bool firstCheckpoint =
false) {
3519 m_performanceTracker = performanceTracker;
3520 m_firstCheckpoint = firstCheckpoint;
3523 friend class el::base::PerformanceTracker;
3528 class PerformanceTracker :
public base::threading::ThreadSafe,
public Loggable {
3535 PerformanceTracker(
const PerformanceTracker&
t) :
3536 m_blockName(
t.m_blockName), m_timestampUnit(
t.m_timestampUnit), m_loggerId(
t.m_loggerId), m_scopedLog(
t.m_scopedLog),
3537 m_level(
t.m_level), m_hasChecked(
t.m_hasChecked), m_lastCheckpointId(
t.m_lastCheckpointId), m_enabled(
t.m_enabled),
3538 m_startTime(
t.m_startTime), m_endTime(
t.m_endTime), m_lastCheckpointTime(
t.m_lastCheckpointTime) {
3540 virtual ~PerformanceTracker(
void);
3544 const char* func =
"");
3545 inline Level level(
void)
const {
3557 struct timeval m_startTime, m_endTime, m_lastCheckpointTime;
3559 PerformanceTracker(
void);
3561 friend class el::PerformanceTrackingData;
3562 friend class base::DefaultPerformanceTrackingCallback;
3565 return getFormattedTimeTaken(m_startTime);
3571 os << getFormattedTimeTaken();
3574 class DefaultPerformanceTrackingCallback :
public PerformanceTrackingCallback {
3576 void handle(
const PerformanceTrackingData*
data) {
3579 if (
m_data->dataType() == PerformanceTrackingData::DataType::Complete) {
3584 if (!
m_data->checkpointId().empty()) {
3588 *
m_data->performanceTracker();
3590 &&
m_data->performanceTracker()->m_hasChecked) {
3592 if (
m_data->performanceTracker()->m_lastCheckpointId.empty()) {
3607 const PerformanceTrackingData*
m_data;
3610 inline const std::string* PerformanceTrackingData::blockName()
const {
3611 return const_cast<const std::string*
>(&m_performanceTracker->m_blockName);
3613 inline const struct timeval* PerformanceTrackingData::startTime()
const {
3614 return const_cast<const struct timeval*
>(&m_performanceTracker->m_startTime);
3616 inline const struct timeval* PerformanceTrackingData::endTime()
const {
3617 return const_cast<const struct timeval*
>(&m_performanceTracker->m_endTime);
3619 inline const struct timeval* PerformanceTrackingData::lastCheckpointTime()
const {
3620 return const_cast<const struct timeval*
>(&m_performanceTracker->m_lastCheckpointTime);
3622 inline const std::string& PerformanceTrackingData::loggerId(
void)
const {
3623 return m_performanceTracker->m_loggerId;
3625 #endif // defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING) 3629 #if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_CRASH_LOG) 3630 class StackTrace : base::NoCopy {
3632 static const unsigned int kMaxStack = 64;
3633 static const unsigned int kStackStart = 2;
3634 class StackTraceEntry {
3638 StackTraceEntry(std::size_t index,
const std::string& loc) :
3642 std::size_t m_index;
3647 friend std::ostream&
operator<<(std::ostream& ss,
const StackTraceEntry&
si);
3650 StackTraceEntry(
void);
3657 virtual ~StackTrace(
void) {
3660 inline std::vector<StackTraceEntry>& getLatestStack(
void) {
3664 friend std::ostream&
operator<<(std::ostream& os,
const StackTrace& st);
3667 std::vector<StackTraceEntry> m_stack;
3669 void generateNew(
void);
3672 class CrashHandler : base::NoCopy {
3674 typedef void (*Handler)(
int);
3678 setHandler(cHandler);
3680 void setHandler(
const Handler& cHandler);
3690 #endif // defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_CRASH_LOG) 3694 #define MAKE_LOGGABLE(ClassType, ClassInstance, OutputStreamInstance) \ 3695 el::base::type::ostream_t& operator<<(el::base::type::ostream_t& OutputStreamInstance, const ClassType& ClassInstance) 3696 class SysLogInitializer {
3700 #if defined(ELPP_SYSLOG) 3701 openlog(processIdent, options, facility);
3706 #endif // defined(ELPP_SYSLOG) 3709 #if defined(ELPP_SYSLOG) 3711 #endif // defined(ELPP_SYSLOG) 3714 #define ELPP_INITIALIZE_SYSLOG(id, opt, fac) el::SysLogInitializer elSyslogInit(id, opt, fac) 3715 class Helpers : base::StaticClass {
3727 static inline void setArgs(
int argc,
char** argv) {
3728 ELPP->setApplicationArguments(argc, argv);
3731 static inline void setArgs(
int argc,
const char** argv) {
3732 ELPP->setApplicationArguments(argc, const_cast<char**>(argv));
3741 #if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_CRASH_LOG) 3742 static inline void setCrashHandler(
const el::base::debug::CrashHandler::Handler& crashHandler) {
3750 static void crashAbort(
int sig,
const char* sourceFile =
"",
unsigned int long line = 0);
3756 static void logCrashReason(
int sig,
bool stackTraceIfAvailable =
false,
3758 #endif // defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_CRASH_LOG) 3762 ELPP->setPreRollOutCallback(callback);
3766 ELPP->unsetPreRollOutCallback();
3769 template <
typename T>
3771 return ELPP->installLogDispatchCallback<
T>(
id);
3774 template <
typename T>
3776 ELPP->uninstallLogDispatchCallback<
T>(
id);
3778 template <
typename T>
3780 return ELPP->logDispatchCallback<
T>(
id);
3782 #if defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING) 3783 template <
typename T>
3785 static inline bool installPerformanceTrackingCallback(
const std::string&
id) {
3786 return ELPP->installPerformanceTrackingCallback<
T>(
id);
3789 template <
typename T>
3790 static inline void uninstallPerformanceTrackingCallback(
const std::string&
id) {
3791 ELPP->uninstallPerformanceTrackingCallback<
T>(
id);
3793 template <
typename T>
3794 static inline T* performanceTrackingCallback(
const std::string&
id) {
3795 return ELPP->performanceTrackingCallback<
T>(
id);
3797 #endif // defined(ELPP_FEATURE_ALL) || defined(ELPP_FEATURE_PERFORMANCE_TRACKING) 3798 template <
typename T>
3803 if (logger ==
nullptr) {
3807 b.initialize(logger);
3810 #if defined(ELPP_UNICODE) 3814 #endif // defined(ELPP_UNICODE) 3821 return ELPP->commandLineArgs();
3826 ELPP->m_customFormatSpecifiers.reserve(size);
3830 ELPP->installCustomFormatSpecifier(customFormatSpecifier);
3834 return ELPP->uninstallCustomFormatSpecifier(formatSpecifier);
3838 return ELPP->hasCustomFormatSpecifier(formatSpecifier);
3841 if (
ELPP ==
nullptr || logger ==
nullptr)
return;
3855 template <
typename T>
3857 return ELPP->registeredLoggers()->installLoggerRegistrationCallback<
T>(
id);
3860 template <
typename T>
3862 ELPP->registeredLoggers()->uninstallLoggerRegistrationCallback<
T>(
id);
3864 template <
typename T>
3866 return ELPP->registeredLoggers()->loggerRegistrationCallback<
T>(
id);
3891 bool reconfigureExistingLoggers =
false);
3912 ELPP->addFlag(flag);
3916 ELPP->removeFlag(flag);
3920 return ELPP->hasFlag(flag);
3948 ELPP->setLoggingLevel(level);
3957 static void setCategories(
const char* categories,
bool clear =
true);
3979 #define VLOG_IS_ON(verboseLevel) (ELPP->vRegistry()->allowed(verboseLevel, __FILE__)) 3983 #undef TIMED_SCOPE_IF 3985 #undef TIMED_FUNC_IF 3986 #undef ELPP_MIN_UNIT 3987 #if defined(ELPP_PERFORMANCE_MICROSECONDS) 3988 # define ELPP_MIN_UNIT el::base::TimestampUnit::Microsecond 3990 # define ELPP_MIN_UNIT el::base::TimestampUnit::Millisecond 3991 #endif // (defined(ELPP_PERFORMANCE_MICROSECONDS)) 3999 #define TIMED_SCOPE_IF(obj, blockname, condition) el::base::type::PerformanceTrackerPtr obj( condition ? \ 4000 new el::base::PerformanceTracker(blockname, ELPP_MIN_UNIT) : nullptr ) 4001 #define TIMED_SCOPE(obj, blockname) TIMED_SCOPE_IF(obj, blockname, true) 4002 #define TIMED_BLOCK(obj, blockName) for (struct { int i; el::base::type::PerformanceTrackerPtr timer; } obj = { 0, \ 4003 el::base::type::PerformanceTrackerPtr(new el::base::PerformanceTracker(blockName, ELPP_MIN_UNIT)) }; obj.i < 1; ++obj.i) 4004 #define TIMED_FUNC_IF(obj,condition) TIMED_SCOPE_IF(obj, ELPP_FUNC, condition) 4011 #define TIMED_FUNC(obj) TIMED_SCOPE(obj, ELPP_FUNC) 4012 #undef PERFORMANCE_CHECKPOINT 4013 #undef PERFORMANCE_CHECKPOINT_WITH_ID 4014 #define PERFORMANCE_CHECKPOINT(obj) obj->checkpoint(std::string(), __FILE__, __LINE__, ELPP_FUNC) 4015 #define PERFORMANCE_CHECKPOINT_WITH_ID(obj, id) obj->checkpoint(id, __FILE__, __LINE__, ELPP_FUNC) 4017 #undef ELPP_COUNTER_POS 4018 #define ELPP_COUNTER (ELPP->hitCounters()->getCounter(__FILE__, __LINE__)) 4020 #define ELPP_COUNTER_POS (ELPP_COUNTER == nullptr ? -1 : ELPP_COUNTER->hitCounts()) 4045 #undef CINFO_EVERY_N 4046 #undef CWARNING_EVERY_N 4047 #undef CDEBUG_EVERY_N 4048 #undef CERROR_EVERY_N 4049 #undef CFATAL_EVERY_N 4050 #undef CTRACE_EVERY_N 4051 #undef CVERBOSE_EVERY_N 4052 #undef CINFO_AFTER_N 4053 #undef CWARNING_AFTER_N 4054 #undef CDEBUG_AFTER_N 4055 #undef CERROR_AFTER_N 4056 #undef CFATAL_AFTER_N 4057 #undef CTRACE_AFTER_N 4058 #undef CVERBOSE_AFTER_N 4059 #undef CINFO_N_TIMES 4060 #undef CWARNING_N_TIMES 4061 #undef CDEBUG_N_TIMES 4062 #undef CERROR_N_TIMES 4063 #undef CFATAL_N_TIMES 4064 #undef CTRACE_N_TIMES 4065 #undef CVERBOSE_N_TIMES 4068 # define CINFO(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Info, dispatchAction, __VA_ARGS__) 4070 # define CINFO(writer, dispatchAction, ...) el::base::NullWriter() 4071 #endif // ELPP_INFO_LOG 4072 #if ELPP_WARNING_LOG 4073 # define CWARNING(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Warning, dispatchAction, __VA_ARGS__) 4075 # define CWARNING(writer, dispatchAction, ...) el::base::NullWriter() 4076 #endif // ELPP_WARNING_LOG 4078 # define CDEBUG(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Debug, dispatchAction, __VA_ARGS__) 4080 # define CDEBUG(writer, dispatchAction, ...) el::base::NullWriter() 4081 #endif // ELPP_DEBUG_LOG 4083 # define CERROR(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Error, dispatchAction, __VA_ARGS__) 4085 # define CERROR(writer, dispatchAction, ...) el::base::NullWriter() 4086 #endif // ELPP_ERROR_LOG 4088 # define CFATAL(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Fatal, dispatchAction, __VA_ARGS__) 4090 # define CFATAL(writer, dispatchAction, ...) el::base::NullWriter() 4091 #endif // ELPP_FATAL_LOG 4093 # define CTRACE(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Trace, dispatchAction, __VA_ARGS__) 4095 # define CTRACE(writer, dispatchAction, ...) el::base::NullWriter() 4096 #endif // ELPP_TRACE_LOG 4097 #if ELPP_VERBOSE_LOG 4098 # define CVERBOSE(writer, vlevel, dispatchAction, ...) if (VLOG_IS_ON(vlevel)) writer(\ 4099 el::Level::Verbose, __FILE__, __LINE__, ELPP_FUNC, dispatchAction, vlevel).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) 4101 # define CVERBOSE(writer, vlevel, dispatchAction, ...) el::base::NullWriter() 4102 #endif // ELPP_VERBOSE_LOG 4105 # define CINFO_IF(writer, condition_, dispatchAction, ...) \ 4106 ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Info, dispatchAction, __VA_ARGS__) 4108 # define CINFO_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() 4109 #endif // ELPP_INFO_LOG 4110 #if ELPP_WARNING_LOG 4111 # define CWARNING_IF(writer, condition_, dispatchAction, ...)\ 4112 ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Warning, dispatchAction, __VA_ARGS__) 4114 # define CWARNING_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() 4115 #endif // ELPP_WARNING_LOG 4117 # define CDEBUG_IF(writer, condition_, dispatchAction, ...)\ 4118 ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Debug, dispatchAction, __VA_ARGS__) 4120 # define CDEBUG_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() 4121 #endif // ELPP_DEBUG_LOG 4123 # define CERROR_IF(writer, condition_, dispatchAction, ...)\ 4124 ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Error, dispatchAction, __VA_ARGS__) 4126 # define CERROR_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() 4127 #endif // ELPP_ERROR_LOG 4129 # define CFATAL_IF(writer, condition_, dispatchAction, ...)\ 4130 ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Fatal, dispatchAction, __VA_ARGS__) 4132 # define CFATAL_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() 4133 #endif // ELPP_FATAL_LOG 4135 # define CTRACE_IF(writer, condition_, dispatchAction, ...)\ 4136 ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Trace, dispatchAction, __VA_ARGS__) 4138 # define CTRACE_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() 4139 #endif // ELPP_TRACE_LOG 4140 #if ELPP_VERBOSE_LOG 4141 # define CVERBOSE_IF(writer, condition_, vlevel, dispatchAction, ...) if (VLOG_IS_ON(vlevel) && (condition_)) writer( \ 4142 el::Level::Verbose, __FILE__, __LINE__, ELPP_FUNC, dispatchAction, vlevel).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) 4144 # define CVERBOSE_IF(writer, condition_, vlevel, dispatchAction, ...) el::base::NullWriter() 4145 #endif // ELPP_VERBOSE_LOG 4148 # define CINFO_EVERY_N(writer, occasion, dispatchAction, ...)\ 4149 ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Info, dispatchAction, __VA_ARGS__) 4151 # define CINFO_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() 4152 #endif // ELPP_INFO_LOG 4153 #if ELPP_WARNING_LOG 4154 # define CWARNING_EVERY_N(writer, occasion, dispatchAction, ...)\ 4155 ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Warning, dispatchAction, __VA_ARGS__) 4157 # define CWARNING_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() 4158 #endif // ELPP_WARNING_LOG 4160 # define CDEBUG_EVERY_N(writer, occasion, dispatchAction, ...)\ 4161 ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Debug, dispatchAction, __VA_ARGS__) 4163 # define CDEBUG_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() 4164 #endif // ELPP_DEBUG_LOG 4166 # define CERROR_EVERY_N(writer, occasion, dispatchAction, ...)\ 4167 ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Error, dispatchAction, __VA_ARGS__) 4169 # define CERROR_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() 4170 #endif // ELPP_ERROR_LOG 4172 # define CFATAL_EVERY_N(writer, occasion, dispatchAction, ...)\ 4173 ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Fatal, dispatchAction, __VA_ARGS__) 4175 # define CFATAL_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() 4176 #endif // ELPP_FATAL_LOG 4178 # define CTRACE_EVERY_N(writer, occasion, dispatchAction, ...)\ 4179 ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Trace, dispatchAction, __VA_ARGS__) 4181 # define CTRACE_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() 4182 #endif // ELPP_TRACE_LOG 4183 #if ELPP_VERBOSE_LOG 4184 # define CVERBOSE_EVERY_N(writer, occasion, vlevel, dispatchAction, ...)\ 4185 CVERBOSE_IF(writer, ELPP->validateEveryNCounter(__FILE__, __LINE__, occasion), vlevel, dispatchAction, __VA_ARGS__) 4187 # define CVERBOSE_EVERY_N(writer, occasion, vlevel, dispatchAction, ...) el::base::NullWriter() 4188 #endif // ELPP_VERBOSE_LOG 4191 # define CINFO_AFTER_N(writer, n, dispatchAction, ...)\ 4192 ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Info, dispatchAction, __VA_ARGS__) 4194 # define CINFO_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() 4195 #endif // ELPP_INFO_LOG 4196 #if ELPP_WARNING_LOG 4197 # define CWARNING_AFTER_N(writer, n, dispatchAction, ...)\ 4198 ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Warning, dispatchAction, __VA_ARGS__) 4200 # define CWARNING_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() 4201 #endif // ELPP_WARNING_LOG 4203 # define CDEBUG_AFTER_N(writer, n, dispatchAction, ...)\ 4204 ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Debug, dispatchAction, __VA_ARGS__) 4206 # define CDEBUG_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() 4207 #endif // ELPP_DEBUG_LOG 4209 # define CERROR_AFTER_N(writer, n, dispatchAction, ...)\ 4210 ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Error, dispatchAction, __VA_ARGS__) 4212 # define CERROR_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() 4213 #endif // ELPP_ERROR_LOG 4215 # define CFATAL_AFTER_N(writer, n, dispatchAction, ...)\ 4216 ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Fatal, dispatchAction, __VA_ARGS__) 4218 # define CFATAL_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() 4219 #endif // ELPP_FATAL_LOG 4221 # define CTRACE_AFTER_N(writer, n, dispatchAction, ...)\ 4222 ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Trace, dispatchAction, __VA_ARGS__) 4224 # define CTRACE_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() 4225 #endif // ELPP_TRACE_LOG 4226 #if ELPP_VERBOSE_LOG 4227 # define CVERBOSE_AFTER_N(writer, n, vlevel, dispatchAction, ...)\ 4228 CVERBOSE_IF(writer, ELPP->validateAfterNCounter(__FILE__, __LINE__, n), vlevel, dispatchAction, __VA_ARGS__) 4230 # define CVERBOSE_AFTER_N(writer, n, vlevel, dispatchAction, ...) el::base::NullWriter() 4231 #endif // ELPP_VERBOSE_LOG 4234 # define CINFO_N_TIMES(writer, n, dispatchAction, ...)\ 4235 ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Info, dispatchAction, __VA_ARGS__) 4237 # define CINFO_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() 4238 #endif // ELPP_INFO_LOG 4239 #if ELPP_WARNING_LOG 4240 # define CWARNING_N_TIMES(writer, n, dispatchAction, ...)\ 4241 ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Warning, dispatchAction, __VA_ARGS__) 4243 # define CWARNING_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() 4244 #endif // ELPP_WARNING_LOG 4246 # define CDEBUG_N_TIMES(writer, n, dispatchAction, ...)\ 4247 ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Debug, dispatchAction, __VA_ARGS__) 4249 # define CDEBUG_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() 4250 #endif // ELPP_DEBUG_LOG 4252 # define CERROR_N_TIMES(writer, n, dispatchAction, ...)\ 4253 ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Error, dispatchAction, __VA_ARGS__) 4255 # define CERROR_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() 4256 #endif // ELPP_ERROR_LOG 4258 # define CFATAL_N_TIMES(writer, n, dispatchAction, ...)\ 4259 ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Fatal, dispatchAction, __VA_ARGS__) 4261 # define CFATAL_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() 4262 #endif // ELPP_FATAL_LOG 4264 # define CTRACE_N_TIMES(writer, n, dispatchAction, ...)\ 4265 ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Trace, dispatchAction, __VA_ARGS__) 4267 # define CTRACE_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() 4268 #endif // ELPP_TRACE_LOG 4269 #if ELPP_VERBOSE_LOG 4270 # define CVERBOSE_N_TIMES(writer, n, vlevel, dispatchAction, ...)\ 4271 CVERBOSE_IF(writer, ELPP->validateNTimesCounter(__FILE__, __LINE__, n), vlevel, dispatchAction, __VA_ARGS__) 4273 # define CVERBOSE_N_TIMES(writer, n, vlevel, dispatchAction, ...) el::base::NullWriter() 4274 #endif // ELPP_VERBOSE_LOG 4283 #undef CLOG_VERBOSE_IF 4286 #undef CVLOG_EVERY_N 4288 #undef CVLOG_AFTER_N 4290 #undef CVLOG_N_TIMES 4292 #define CLOG(LEVEL, ...)\ 4293 C##LEVEL(el::base::Writer, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4294 #define CVLOG(vlevel, ...) CVERBOSE(el::base::Writer, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4296 #define CLOG_IF(condition, LEVEL, ...)\ 4297 C##LEVEL##_IF(el::base::Writer, condition, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4298 #define CVLOG_IF(condition, vlevel, ...)\ 4299 CVERBOSE_IF(el::base::Writer, condition, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4301 #define CLOG_EVERY_N(n, LEVEL, ...)\ 4302 C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4303 #define CVLOG_EVERY_N(n, vlevel, ...)\ 4304 CVERBOSE_EVERY_N(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4305 #define CLOG_AFTER_N(n, LEVEL, ...)\ 4306 C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4307 #define CVLOG_AFTER_N(n, vlevel, ...)\ 4308 CVERBOSE_AFTER_N(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4309 #define CLOG_N_TIMES(n, LEVEL, ...)\ 4310 C##LEVEL##_N_TIMES(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4311 #define CVLOG_N_TIMES(n, vlevel, ...)\ 4312 CVERBOSE_N_TIMES(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4327 #undef ELPP_CURR_FILE_LOGGER_ID 4328 #if defined(ELPP_DEFAULT_LOGGER) 4329 # define ELPP_CURR_FILE_LOGGER_ID ELPP_DEFAULT_LOGGER 4331 # define ELPP_CURR_FILE_LOGGER_ID el::base::consts::kDefaultLoggerId 4334 #define ELPP_TRACE CLOG(TRACE, ELPP_CURR_FILE_LOGGER_ID) 4336 #define LOG(LEVEL) CLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4337 #define VLOG(vlevel) CVLOG(vlevel, ELPP_CURR_FILE_LOGGER_ID) 4339 #define LOG_IF(condition, LEVEL) CLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4340 #define VLOG_IF(condition, vlevel) CVLOG_IF(condition, vlevel, ELPP_CURR_FILE_LOGGER_ID) 4342 #define LOG_EVERY_N(n, LEVEL) CLOG_EVERY_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4343 #define VLOG_EVERY_N(n, vlevel) CVLOG_EVERY_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) 4344 #define LOG_AFTER_N(n, LEVEL) CLOG_AFTER_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4345 #define VLOG_AFTER_N(n, vlevel) CVLOG_AFTER_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) 4346 #define LOG_N_TIMES(n, LEVEL) CLOG_N_TIMES(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4347 #define VLOG_N_TIMES(n, vlevel) CVLOG_N_TIMES(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) 4357 #define CPLOG(LEVEL, ...)\ 4358 C##LEVEL(el::base::PErrorWriter, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4359 #define CPLOG_IF(condition, LEVEL, ...)\ 4360 C##LEVEL##_IF(el::base::PErrorWriter, condition, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4361 #define DCPLOG(LEVEL, ...)\ 4362 if (ELPP_DEBUG_LOG) C##LEVEL(el::base::PErrorWriter, el::base::DispatchAction::NormalLog, __VA_ARGS__) 4363 #define DCPLOG_IF(condition, LEVEL, ...)\ 4364 C##LEVEL##_IF(el::base::PErrorWriter, (ELPP_DEBUG_LOG) && (condition), el::base::DispatchAction::NormalLog, __VA_ARGS__) 4365 #define PLOG(LEVEL) CPLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4366 #define PLOG_IF(condition, LEVEL) CPLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4367 #define DPLOG(LEVEL) DCPLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4368 #define DPLOG_IF(condition, LEVEL) DCPLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4372 #undef CSYSLOG_EVERY_N 4373 #undef CSYSLOG_AFTER_N 4374 #undef CSYSLOG_N_TIMES 4377 #undef SYSLOG_EVERY_N 4378 #undef SYSLOG_AFTER_N 4379 #undef SYSLOG_N_TIMES 4382 #undef DCSYSLOG_EVERY_N 4383 #undef DCSYSLOG_AFTER_N 4384 #undef DCSYSLOG_N_TIMES 4387 #undef DSYSLOG_EVERY_N 4388 #undef DSYSLOG_AFTER_N 4389 #undef DSYSLOG_N_TIMES 4390 #if defined(ELPP_SYSLOG) 4391 # define CSYSLOG(LEVEL, ...)\ 4392 C##LEVEL(el::base::Writer, el::base::DispatchAction::SysLog, __VA_ARGS__) 4393 # define CSYSLOG_IF(condition, LEVEL, ...)\ 4394 C##LEVEL##_IF(el::base::Writer, condition, el::base::DispatchAction::SysLog, __VA_ARGS__) 4395 # define CSYSLOG_EVERY_N(n, LEVEL, ...) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) 4396 # define CSYSLOG_AFTER_N(n, LEVEL, ...) C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) 4397 # define CSYSLOG_N_TIMES(n, LEVEL, ...) C##LEVEL##_N_TIMES(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) 4398 # define SYSLOG(LEVEL) CSYSLOG(LEVEL, el::base::consts::kSysLogLoggerId) 4399 # define SYSLOG_IF(condition, LEVEL) CSYSLOG_IF(condition, LEVEL, el::base::consts::kSysLogLoggerId) 4400 # define SYSLOG_EVERY_N(n, LEVEL) CSYSLOG_EVERY_N(n, LEVEL, el::base::consts::kSysLogLoggerId) 4401 # define SYSLOG_AFTER_N(n, LEVEL) CSYSLOG_AFTER_N(n, LEVEL, el::base::consts::kSysLogLoggerId) 4402 # define SYSLOG_N_TIMES(n, LEVEL) CSYSLOG_N_TIMES(n, LEVEL, el::base::consts::kSysLogLoggerId) 4403 # define DCSYSLOG(LEVEL, ...) if (ELPP_DEBUG_LOG) C##LEVEL(el::base::Writer, el::base::DispatchAction::SysLog, __VA_ARGS__) 4404 # define DCSYSLOG_IF(condition, LEVEL, ...)\ 4405 C##LEVEL##_IF(el::base::Writer, (ELPP_DEBUG_LOG) && (condition), el::base::DispatchAction::SysLog, __VA_ARGS__) 4406 # define DCSYSLOG_EVERY_N(n, LEVEL, ...)\ 4407 if (ELPP_DEBUG_LOG) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) 4408 # define DCSYSLOG_AFTER_N(n, LEVEL, ...)\ 4409 if (ELPP_DEBUG_LOG) C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) 4410 # define DCSYSLOG_N_TIMES(n, LEVEL, ...)\ 4411 if (ELPP_DEBUG_LOG) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) 4412 # define DSYSLOG(LEVEL) DCSYSLOG(LEVEL, el::base::consts::kSysLogLoggerId) 4413 # define DSYSLOG_IF(condition, LEVEL) DCSYSLOG_IF(condition, LEVEL, el::base::consts::kSysLogLoggerId) 4414 # define DSYSLOG_EVERY_N(n, LEVEL) DCSYSLOG_EVERY_N(n, LEVEL, el::base::consts::kSysLogLoggerId) 4415 # define DSYSLOG_AFTER_N(n, LEVEL) DCSYSLOG_AFTER_N(n, LEVEL, el::base::consts::kSysLogLoggerId) 4416 # define DSYSLOG_N_TIMES(n, LEVEL) DCSYSLOG_N_TIMES(n, LEVEL, el::base::consts::kSysLogLoggerId) 4418 # define CSYSLOG(LEVEL, ...) el::base::NullWriter() 4419 # define CSYSLOG_IF(condition, LEVEL, ...) el::base::NullWriter() 4420 # define CSYSLOG_EVERY_N(n, LEVEL, ...) el::base::NullWriter() 4421 # define CSYSLOG_AFTER_N(n, LEVEL, ...) el::base::NullWriter() 4422 # define CSYSLOG_N_TIMES(n, LEVEL, ...) el::base::NullWriter() 4423 # define SYSLOG(LEVEL) el::base::NullWriter() 4424 # define SYSLOG_IF(condition, LEVEL) el::base::NullWriter() 4425 # define SYSLOG_EVERY_N(n, LEVEL) el::base::NullWriter() 4426 # define SYSLOG_AFTER_N(n, LEVEL) el::base::NullWriter() 4427 # define SYSLOG_N_TIMES(n, LEVEL) el::base::NullWriter() 4428 # define DCSYSLOG(LEVEL, ...) el::base::NullWriter() 4429 # define DCSYSLOG_IF(condition, LEVEL, ...) el::base::NullWriter() 4430 # define DCSYSLOG_EVERY_N(n, LEVEL, ...) el::base::NullWriter() 4431 # define DCSYSLOG_AFTER_N(n, LEVEL, ...) el::base::NullWriter() 4432 # define DCSYSLOG_N_TIMES(n, LEVEL, ...) el::base::NullWriter() 4433 # define DSYSLOG(LEVEL) el::base::NullWriter() 4434 # define DSYSLOG_IF(condition, LEVEL) el::base::NullWriter() 4435 # define DSYSLOG_EVERY_N(n, LEVEL) el::base::NullWriter() 4436 # define DSYSLOG_AFTER_N(n, LEVEL) el::base::NullWriter() 4437 # define DSYSLOG_N_TIMES(n, LEVEL) el::base::NullWriter() 4438 #endif // defined(ELPP_SYSLOG) 4447 #undef DCLOG_EVERY_N 4448 #undef DCVLOG_EVERY_N 4449 #undef DCLOG_AFTER_N 4450 #undef DCVLOG_AFTER_N 4451 #undef DCLOG_N_TIMES 4452 #undef DCVLOG_N_TIMES 4454 #define DCLOG(LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG(LEVEL, __VA_ARGS__) 4455 #define DCLOG_VERBOSE(vlevel, ...) if (ELPP_DEBUG_LOG) CLOG_VERBOSE(vlevel, __VA_ARGS__) 4456 #define DCVLOG(vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG(vlevel, __VA_ARGS__) 4458 #define DCLOG_IF(condition, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_IF(condition, LEVEL, __VA_ARGS__) 4459 #define DCVLOG_IF(condition, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_IF(condition, vlevel, __VA_ARGS__) 4461 #define DCLOG_EVERY_N(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_EVERY_N(n, LEVEL, __VA_ARGS__) 4462 #define DCVLOG_EVERY_N(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_EVERY_N(n, vlevel, __VA_ARGS__) 4463 #define DCLOG_AFTER_N(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_AFTER_N(n, LEVEL, __VA_ARGS__) 4464 #define DCVLOG_AFTER_N(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_AFTER_N(n, vlevel, __VA_ARGS__) 4465 #define DCLOG_N_TIMES(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_N_TIMES(n, LEVEL, __VA_ARGS__) 4466 #define DCVLOG_N_TIMES(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_N_TIMES(n, vlevel, __VA_ARGS__) 4470 #if !defined(ELPP_NO_DEBUG_MACROS) 4477 #undef DVLOG_EVERY_N 4479 #undef DVLOG_AFTER_N 4481 #undef DVLOG_N_TIMES 4483 #define DLOG(LEVEL) DCLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4484 #define DVLOG(vlevel) DCVLOG(vlevel, ELPP_CURR_FILE_LOGGER_ID) 4486 #define DLOG_IF(condition, LEVEL) DCLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4487 #define DVLOG_IF(condition, vlevel) DCVLOG_IF(condition, vlevel, ELPP_CURR_FILE_LOGGER_ID) 4489 #define DLOG_EVERY_N(n, LEVEL) DCLOG_EVERY_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4490 #define DVLOG_EVERY_N(n, vlevel) DCVLOG_EVERY_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) 4491 #define DLOG_AFTER_N(n, LEVEL) DCLOG_AFTER_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4492 #define DVLOG_AFTER_N(n, vlevel) DCVLOG_AFTER_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) 4493 #define DLOG_N_TIMES(n, LEVEL) DCLOG_N_TIMES(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) 4494 #define DVLOG_N_TIMES(n, vlevel) DCVLOG_N_TIMES(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) 4495 #endif // defined(ELPP_NO_DEBUG_MACROS) 4496 #if !defined(ELPP_NO_CHECK_MACROS) 4506 #undef CCHECK_BOUNDS 4507 #undef CCHECK_NOTNULL 4508 #undef CCHECK_STRCASEEQ 4509 #undef CCHECK_STRCASENE 4519 #undef CHECK_NOTNULL 4520 #undef CHECK_STRCASEEQ 4521 #undef CHECK_STRCASENE 4522 #define CCHECK(condition, ...) CLOG_IF(!(condition), FATAL, __VA_ARGS__) << "Check failed: [" << #condition << "] " 4523 #define CPCHECK(condition, ...) CPLOG_IF(!(condition), FATAL, __VA_ARGS__) << "Check failed: [" << #condition << "] " 4524 #define CHECK(condition) CCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) 4525 #define PCHECK(condition) CPCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) 4526 #define CCHECK_EQ(a, b, ...) CCHECK(a == b, __VA_ARGS__) 4527 #define CCHECK_NE(a, b, ...) CCHECK(a != b, __VA_ARGS__) 4528 #define CCHECK_LT(a, b, ...) CCHECK(a < b, __VA_ARGS__) 4529 #define CCHECK_GT(a, b, ...) CCHECK(a > b, __VA_ARGS__) 4530 #define CCHECK_LE(a, b, ...) CCHECK(a <= b, __VA_ARGS__) 4531 #define CCHECK_GE(a, b, ...) CCHECK(a >= b, __VA_ARGS__) 4532 #define CCHECK_BOUNDS(val, min, max, ...) CCHECK(val >= min && val <= max, __VA_ARGS__) 4533 #define CHECK_EQ(a, b) CCHECK_EQ(a, b, ELPP_CURR_FILE_LOGGER_ID) 4534 #define CHECK_NE(a, b) CCHECK_NE(a, b, ELPP_CURR_FILE_LOGGER_ID) 4535 #define CHECK_LT(a, b) CCHECK_LT(a, b, ELPP_CURR_FILE_LOGGER_ID) 4536 #define CHECK_GT(a, b) CCHECK_GT(a, b, ELPP_CURR_FILE_LOGGER_ID) 4537 #define CHECK_LE(a, b) CCHECK_LE(a, b, ELPP_CURR_FILE_LOGGER_ID) 4538 #define CHECK_GE(a, b) CCHECK_GE(a, b, ELPP_CURR_FILE_LOGGER_ID) 4539 #define CHECK_BOUNDS(val, min, max) CCHECK_BOUNDS(val, min, max, ELPP_CURR_FILE_LOGGER_ID) 4540 #define CCHECK_NOTNULL(ptr, ...) CCHECK((ptr) != nullptr, __VA_ARGS__) 4541 #define CCHECK_STREQ(str1, str2, ...) CLOG_IF(!el::base::utils::Str::cStringEq(str1, str2), FATAL, __VA_ARGS__) \ 4542 << "Check failed: [" << #str1 << " == " << #str2 << "] " 4543 #define CCHECK_STRNE(str1, str2, ...) CLOG_IF(el::base::utils::Str::cStringEq(str1, str2), FATAL, __VA_ARGS__) \ 4544 << "Check failed: [" << #str1 << " != " << #str2 << "] " 4545 #define CCHECK_STRCASEEQ(str1, str2, ...) CLOG_IF(!el::base::utils::Str::cStringCaseEq(str1, str2), FATAL, __VA_ARGS__) \ 4546 << "Check failed: [" << #str1 << " == " << #str2 << "] " 4547 #define CCHECK_STRCASENE(str1, str2, ...) CLOG_IF(el::base::utils::Str::cStringCaseEq(str1, str2), FATAL, __VA_ARGS__) \ 4548 << "Check failed: [" << #str1 << " != " << #str2 << "] " 4549 #define CHECK_NOTNULL(ptr) CCHECK_NOTNULL((ptr), ELPP_CURR_FILE_LOGGER_ID) 4550 #define CHECK_STREQ(str1, str2) CCHECK_STREQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) 4551 #define CHECK_STRNE(str1, str2) CCHECK_STRNE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) 4552 #define CHECK_STRCASEEQ(str1, str2) CCHECK_STRCASEEQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) 4553 #define CHECK_STRCASENE(str1, str2) CCHECK_STRCASENE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) 4561 #undef DCCHECK_BOUNDS 4562 #undef DCCHECK_NOTNULL 4563 #undef DCCHECK_STRCASEEQ 4564 #undef DCCHECK_STRCASENE 4573 #undef DCHECK_BOUNDS_ 4574 #undef DCHECK_NOTNULL 4575 #undef DCHECK_STRCASEEQ 4576 #undef DCHECK_STRCASENE 4578 #define DCCHECK(condition, ...) if (ELPP_DEBUG_LOG) CCHECK(condition, __VA_ARGS__) 4579 #define DCCHECK_EQ(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_EQ(a, b, __VA_ARGS__) 4580 #define DCCHECK_NE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_NE(a, b, __VA_ARGS__) 4581 #define DCCHECK_LT(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_LT(a, b, __VA_ARGS__) 4582 #define DCCHECK_GT(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_GT(a, b, __VA_ARGS__) 4583 #define DCCHECK_LE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_LE(a, b, __VA_ARGS__) 4584 #define DCCHECK_GE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_GE(a, b, __VA_ARGS__) 4585 #define DCCHECK_BOUNDS(val, min, max, ...) if (ELPP_DEBUG_LOG) CCHECK_BOUNDS(val, min, max, __VA_ARGS__) 4586 #define DCCHECK_NOTNULL(ptr, ...) if (ELPP_DEBUG_LOG) CCHECK_NOTNULL((ptr), __VA_ARGS__) 4587 #define DCCHECK_STREQ(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STREQ(str1, str2, __VA_ARGS__) 4588 #define DCCHECK_STRNE(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRNE(str1, str2, __VA_ARGS__) 4589 #define DCCHECK_STRCASEEQ(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRCASEEQ(str1, str2, __VA_ARGS__) 4590 #define DCCHECK_STRCASENE(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRCASENE(str1, str2, __VA_ARGS__) 4591 #define DCPCHECK(condition, ...) if (ELPP_DEBUG_LOG) CPCHECK(condition, __VA_ARGS__) 4592 #define DCHECK(condition) DCCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) 4593 #define DCHECK_EQ(a, b) DCCHECK_EQ(a, b, ELPP_CURR_FILE_LOGGER_ID) 4594 #define DCHECK_NE(a, b) DCCHECK_NE(a, b, ELPP_CURR_FILE_LOGGER_ID) 4595 #define DCHECK_LT(a, b) DCCHECK_LT(a, b, ELPP_CURR_FILE_LOGGER_ID) 4596 #define DCHECK_GT(a, b) DCCHECK_GT(a, b, ELPP_CURR_FILE_LOGGER_ID) 4597 #define DCHECK_LE(a, b) DCCHECK_LE(a, b, ELPP_CURR_FILE_LOGGER_ID) 4598 #define DCHECK_GE(a, b) DCCHECK_GE(a, b, ELPP_CURR_FILE_LOGGER_ID) 4599 #define DCHECK_BOUNDS(val, min, max) DCCHECK_BOUNDS(val, min, max, ELPP_CURR_FILE_LOGGER_ID) 4600 #define DCHECK_NOTNULL(ptr) DCCHECK_NOTNULL((ptr), ELPP_CURR_FILE_LOGGER_ID) 4601 #define DCHECK_STREQ(str1, str2) DCCHECK_STREQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) 4602 #define DCHECK_STRNE(str1, str2) DCCHECK_STRNE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) 4603 #define DCHECK_STRCASEEQ(str1, str2) DCCHECK_STRCASEEQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) 4604 #define DCHECK_STRCASENE(str1, str2) DCCHECK_STRCASENE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) 4605 #define DPCHECK(condition) DCPCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) 4606 #endif // defined(ELPP_NO_CHECK_MACROS) 4607 #if defined(ELPP_DISABLE_DEFAULT_CRASH_HANDLING) 4608 # define ELPP_USE_DEF_CRASH_HANDLER false 4610 # define ELPP_USE_DEF_CRASH_HANDLER true 4611 #endif // defined(ELPP_DISABLE_DEFAULT_CRASH_HANDLING) 4612 #define ELPP_CRASH_HANDLER_INIT 4613 #define ELPP_INIT_EASYLOGGINGPP(val) \ 4616 el::base::type::StoragePointer elStorage(val); \ 4618 el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER); \ 4621 #if ELPP_ASYNC_LOGGING 4622 # define INITIALIZE_EASYLOGGINGPP ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()),\ 4623 new el::base::AsyncDispatchWorker())) 4625 # define INITIALIZE_EASYLOGGINGPP ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()))) 4626 #endif // ELPP_ASYNC_LOGGING 4627 #define INITIALIZE_NULL_EASYLOGGINGPP \ 4630 el::base::type::StoragePointer elStorage;\ 4632 el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\ 4634 #define SHARE_EASYLOGGINGPP(initializedStorage)\ 4637 el::base::type::StoragePointer elStorage(initializedStorage);\ 4639 el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\ 4642 #if defined(ELPP_UNICODE) 4643 # define START_EASYLOGGINGPP(argc, argv) el::Helpers::setArgs(argc, argv); std::locale::global(std::locale("")) 4645 # define START_EASYLOGGINGPP(argc, argv) el::Helpers::setArgs(argc, argv) 4646 #endif // defined(ELPP_UNICODE) 4647 #endif // EASYLOGGINGPP_H bool priority_allowed(int priority, const std::string &category)
Definition: easylogging++.cc:2230
std::unordered_map< Level, std::size_t > m_logFlushThresholdMap
Definition: easylogging++.h:1982
base::type::LineNumber line(void) const
Definition: easylogging++.h:2532
static void buildBaseFilename(const std::string &fullPath, char buff[], std::size_t limit=base::consts::kSourceFilenameMaxLength, const char *seperator=base::consts::kFilePathSeperator)
builds base filename and puts it in buff
Definition: easylogging++.cc:947
Conf_T & getConfigByRef(Level level, std::unordered_map< Level, Conf_T > *confMap, const char *confName)
Definition: easylogging++.h:1998
virtual ~Storage(void)
Definition: easylogging++.cc:2349
static base::type::string_t formatTime(unsigned long long time, base::TimestampUnit timestampUnit)
Formats time to get unit accordingly, units like second if > 1000 or minutes if > 60000 etc...
Definition: easylogging++.cc:1308
char char_t
Definition: easylogging++.h:546
static const base::type::EnumType kMinValid
Represents minimum valid level. Useful when iterating through enum.
Definition: easylogging++.h:634
virtual ~ScopedLock(void)
Definition: easylogging++.h:991
double value
Definition: easylogging++.h:797
void setArgs(int argc, const char **argv)
Sets arguments and parses them.
Definition: easylogging++.h:1264
std::shared_ptr< base::type::fstream_t > FileStreamPtr
Definition: easylogging++.h:1935
virtual void log(el::base::type::ostream_t &os) const
Definition: easylogging++.cc:338
Specifies precision of the subsecond part. It should be within range (1-6).
static std::string getCategories()
Gets current categories.
Definition: easylogging++.cc:3540
void setValue(Level level, const Conf_T &value, std::unordered_map< Level, Conf_T > *confMap, bool includeGlobalLevel=true)
Definition: easylogging++.h:2038
void setLogBuilder(const LogBuilderPtr &logBuilder)
Definition: easylogging++.h:2310
Abstract registry (aka repository) that provides basic interface for pointer repository specified by ...
Definition: easylogging++.h:1295
static bool hasLogger(const std::string &identity)
Whether or not logger with id is registered.
Definition: easylogging++.cc:3389
bool toFile(Level level)
Definition: easylogging++.cc:1744
void flush(void)
Flushes logger to sync all log files for all levels.
Definition: easylogging++.cc:778
bool validateNTimes(const char *filename, base::type::LineNumber lineNumber, std::size_t n)
Validates counter for hits are <= n, i.e, registers new if does not exist otherwise updates original ...
Definition: easylogging++.cc:1983
std::unordered_map< Level, bool > m_enabledMap
Definition: easylogging++.h:1973
void setModules(const char *modules)
Definition: easylogging++.cc:2063
virtual const_iterator cbegin(void) const ELPP_FINAL
Definition: easylogging++.h:1361
base::threading::Mutex m_mutex
Definition: easylogging++.h:1042
Parser used internally to parse configurations from file or text.
Definition: easylogging++.h:1879
std::size_t operator()(const el::Level &l) const
Definition: easylogging++.h:624
const struct el::base::consts::@16 kCrashSignals[]
static int init(int argc, char **argv, struct runtime_vars *v)
Definition: miniupnpd.c:1149
void unregister(const T_Key &uniqKey)
Unregisters single entry mapped to specified unique key.
Definition: easylogging++.h:1457
static const unsigned int kMaxLogPerCounter
Definition: easylogging++.h:765
bool validateEveryN(const char *filename, base::type::LineNumber lineNumber, std::size_t n)
Validates counter for every N, i.e, registers new if does not exist otherwise updates original one...
Definition: easylogging++.cc:1953
const uint32_t T[512]
Definition: groestl_tables.h:36
Determines whether or not corresponding level and logger of logging is enabled You may disable all lo...
Operating System helper static class used internally. You should not use it.
Definition: easylogging++.h:1175
std::string getCategories()
Definition: easylogging++.cc:2222
static void setCategories(const char *categories, bool clear=true)
Sets categories as specified (on the fly)
Definition: easylogging++.cc:3536
const base::LogFormat & logFormat(Level level)
Definition: easylogging++.cc:1756
bool hasFlag(LoggingFlag flag) const
Definition: easylogging++.h:2669
static void installPreRollOutCallback(const PreRollOutCallback &callback)
Installs pre rollout callback, this callback is triggered when log file is about to be rolled out (ca...
Definition: easylogging++.h:3761
std::fstream fstream_t
Definition: easylogging++.h:549
static Logger * reconfigureLogger(Logger *logger, const Configurations &configurations)
Reconfigures specified logger with new configurations.
Definition: easylogging++.cc:3393
Callback(void)
Definition: easylogging++.h:2186
Configuration(const Configuration &c)
Definition: easylogging++.cc:316
virtual base::type::string_t build(const LogMessage *logMessage, bool appendNewLine) const =0
SysLogInitializer(const char *processIdent, int options=0, int facility=0)
Definition: easylogging++.h:3699
Determines whether or not performance tracking is enabled.
Color color(void) const
Definition: easylogging++.h:2526
virtual void releaseLock(void) ELPP_FINAL
Definition: easylogging++.h:1036
static T * callback(const std::string &id, std::unordered_map< std::string, TPtr > *mapT)
Definition: easylogging++.h:1590
void uninstallLoggerRegistrationCallback(const std::string &id)
Definition: easylogging++.h:2414
Used to find configuration from configuration (pointers) repository. Avoid using it.
Definition: easylogging++.h:1749
static const char * convertToString(ConfigurationType configurationType)
Converts configuration type to associated const char*.
Definition: easylogging++.cc:263
std::map< std::string, int > m_cached_allowed_categories
Definition: easylogging++.h:2511
void convertToColoredOutput(base::type::string_t *logLine, Level level, Color color)
Definition: easylogging++.cc:662
Creates logger automatically when not available.
static std::vector< std::string > * populateAllLoggerIds(std::vector< std::string > *targetList)
Populates all logger IDs in current repository.
Definition: easylogging++.cc:3452
unsigned long getULong(std::string confVal)
Definition: easylogging++.cc:1839
static const char * kFilePathSeperator
Definition: easylogging++.h:790
int * count
Definition: gmock_stress_test.cc:176
static void removeFlag(LoggingFlag flag)
Removes logging flag used internally.
Definition: easylogging++.h:3915
void flushAll(void)
Definition: easylogging++.h:2438
const std::string & filename(Level level)
Definition: easylogging++.cc:1748
static void buildStrippedFilename(const char *filename, char buff[], const std::string &commonPrefix=NULL, std::size_t limit=base::consts::kSourceFilenameMaxLength)
builds stripped filename and puts it in buff
Definition: easylogging++.cc:931
ScopedLock(M &mutex)
Definition: easylogging++.h:986
ConfigurationType configurationType(void) const
Gets configuration type of current configuration.
Definition: easylogging++.h:1730
const std::string & file(void) const
Definition: easylogging++.h:2529
static unsigned long long getTimeDifference(const struct timeval &endTime, const struct timeval &startTime, base::TimestampUnit timestampUnit)
Gets time difference in milli/micro second depending on timestampUnit.
Definition: easylogging++.cc:1326
static std::string extractPathFromFilename(const std::string &fullPath, const char *seperator=base::consts::kFilePathSeperator)
Extracts path of filename with leading slash.
Definition: easylogging++.cc:920
Container::const_iterator const_iterator
Definition: easylogging++.h:1298
static bool hasFlag(LoggingFlag flag)
Determines whether or not certain flag is active.
Definition: easylogging++.h:3919
void setLoggingLevel(Level level)
Definition: easylogging++.h:2705
std::size_t count_
Definition: levin_notify.cpp:694
Information representing errors in application but application will keep running. ...
Definition: easylogging++.h:1571
base::threading::Mutex & fileHandle(const LogDispatchData *data)
Definition: easylogging++.cc:2435
virtual ~Logger(void)
Definition: easylogging++.h:2261
JSON writer.
Definition: fwd.h:95
const base::type::LineNumber m_line
Definition: easylogging++.h:3298
static el::base::type::StoragePointer & getELPP()
Definition: easylogging++.cc:2290
static Level convertFromStringPrefix(const char *levelStr)
Converts from prefix of levelStr to Level.
Definition: easylogging++.cc:231
int i
Definition: pymoduletest.py:23
ELPP_EXPORT base::type::StoragePointer elStorage
enum upnpconfigoptions id
Definition: options.c:29
NoCopy(void)
Definition: easylogging++.h:571
virtual void handle(const LogDispatchData *data)
Definition: easylogging++.cc:2424
void setDefaultLogBuilder(LogBuilderPtr &logBuilderPtr)
Definition: easylogging++.h:2443
bool m_isConfigured
Definition: easylogging++.h:2344
static const std::string & getFilenameCommonPrefix()
Gets filename common prefix.
Definition: easylogging++.cc:3552
Color m_color
Definition: easylogging++.h:3296
const std::string & value(void) const
Gets string based configuration value.
Definition: easylogging++.h:1735
base::type::stringstream_t & stream(void)
Definition: easylogging++.h:2380
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
std::pair< epee::span< const std::uint8_t >, epee::span< const std::uint8_t > > get(MDB_cursor &cur, MDB_cursor_op op, std::size_t key, std::size_t value)
Definition: value_stream.cpp:53
static std::string getThreadName()
Definition: easylogging++.h:3738
static void setDefaultLogBuilder(el::LogBuilderPtr &logBuilderPtr)
Changes default log builder for future loggers.
Definition: easylogging++.cc:3381
#define ELPP_EXPORT
Definition: easylogging++.h:252
::std::string string
Definition: gtest-port.h:1097
static base::type::EnumType castToInt(Level level)
Casts level to int, useful for iterating through enum.
Definition: easylogging++.h:638
static std::string & rtrim(std::string &str)
Definition: easylogging++.cc:995
std::ostream ostream_t
Definition: easylogging++.h:550
CrashHandler(bool)
Definition: easylogging++.h:3688
static T * loggerRegistrationCallback(const std::string &id)
Definition: easylogging++.h:3865
virtual const_iterator cend(void) const ELPP_FINAL
Definition: easylogging++.h:1366
MessageBuilder & operator<<(std::ostream &(*OStreamMani)(std::ostream &))
Definition: easylogging++.h:2967
bool enabled(void) const
Definition: easylogging++.h:2187
virtual ~Configurations(void)
Definition: easylogging++.h:1783
static bool pathExists(const char *path, bool considerFile=false)
Determines whether or not provided path exist in current file system.
Definition: easylogging++.cc:863
std::unordered_map< std::string, base::type::PerformanceTrackingCallbackPtr > m_performanceTrackingCallbacks
Definition: easylogging++.h:2772
bool validateNTimesCounter(const char *filename, base::type::LineNumber lineNumber, std::size_t n)
Definition: easylogging++.h:2635
#define ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(temp)
Definition: easylogging++.h:2971
const std::string & configurationFile(void) const
Gets configuration file used in parsing this configurations.
Definition: easylogging++.h:1859
void build(Configurations *configurations)
Definition: easylogging++.cc:1784
Definition: easylogging++.h:2220
t
Definition: console.py:33
static void setThreadName(const std::string &name)
Sets thread name for current thread. Requires std::thread.
Definition: easylogging++.h:3735
#define ELPP
Definition: easylogging++.h:2794
base::type::VerboseLevel level(void) const
Definition: easylogging++.h:2465
friend base::type::ostream_t & operator<<(base::type::ostream_t &os, const RegistryWithPred &sr)
Definition: easylogging++.h:1517
static bool uninstallCustomFormatSpecifier(const char *formatSpecifier)
Uninstalls user defined format specifier and handler.
Definition: easylogging++.h:3833
Predicate(Level level, ConfigurationType configurationType)
Used to find configuration from configuration (pointers) repository. Avoid using it.
Definition: easylogging++.cc:345
static char * convertAndAddToBuff(std::size_t n, int len, char *buf, const char *bufLim, bool zeroPadded=true)
Definition: easylogging++.cc:1091
std::shared_ptr< LogDispatchCallback > LogDispatchCallbackPtr
Definition: easylogging++.h:561
static bool createPath(const std::string &path)
Creates specified path on file system.
Definition: easylogging++.cc:880
static void setVerboseLevel(base::type::VerboseLevel level)
Sets verbose level on the fly.
Definition: easylogging++.cc:3518
base::RegisteredHitCounters * hitCounters(void) const
Definition: easylogging++.h:2639
Informational events most useful for developers to debug application.
base::type::VerboseLevel m_level
Definition: easylogging++.h:2507
const base::MillisecondsWidth & millisecondsWidth(Level level=Level::Global)
Definition: easylogging++.cc:1764
Severe error information that will presumably abort application.
base::threading::Mutex m_threadNamesLock
Definition: easylogging++.h:2776
std::size_t hitCounts(void) const
Definition: easylogging++.h:2127
SubsecondPrecision(void)
Definition: easylogging++.h:867
friend base::type::ostream_t & operator<<(base::type::ostream_t &os, const CommandLineArgs &c)
Definition: easylogging++.cc:1482
Main entry point of each logging.
Definition: easylogging++.h:3259
ConfigurationType m_configurationType
Definition: easylogging++.h:1762
static Level castFromInt(base::type::EnumType l)
Casts int(ushort) to level, useful for iterating through enum.
Definition: easylogging++.h:642
Base of thread safe class, this class is inheritable-only.
Definition: easylogging++.h:1033
bool parseFromFile(const std::string &configurationFile, Configurations *base=nullptr)
Parses configuration from file.
Definition: easylogging++.cc:371
void insertFile(Level level, const std::string &fullFilename)
Definition: easylogging++.cc:1893
ConfigurationType m_configurationType
Definition: easylogging++.h:1757
static void setDefaultConfigurations(const Configurations &configurations, bool reconfigureExistingLoggers=false)
Sets default configurations. This configuration is used for future (and conditionally for existing) l...
Definition: easylogging++.cc:3431
void setGlobally(ConfigurationType configurationType, const std::string &value)
Sets configuration for all levels.
Definition: easylogging++.h:1846
base::type::fstream_t * fileStream(Level level)
Definition: easylogging++.cc:1772
NullWriter(void)
Definition: easylogging++.h:3242
std::string data
Definition: base58.cpp:37
Easylogging++ entry namespace.
Definition: easylogging++.cc:27
Scoped lock for compiler that dont yet support std::lock_guard.
Definition: easylogging++.h:984
Definition: easylogging++.h:3686
Container m_list
Definition: easylogging++.h:1401
std::vector< std::pair< std::string, Level > > m_categories
Definition: easylogging++.h:2510
Base of Easylogging++ friendly class.
Definition: easylogging++.h:1603
LoggingFlag
Flags used while writing logs. This flags are set by user.
Definition: easylogging++.h:725
int type
Definition: superscalar.cpp:50
Makes sure we have new line for each container log entry.
SubsecondPrecision MillisecondsWidth
Type alias of SubsecondPrecision.
Definition: easylogging++.h:882
const char * s
Definition: minissdp.c:596
Disables comparing performance tracker's checkpoints.
Conf_T & unsafeGetConfigByRef(Level level, std::unordered_map< Level, Conf_T > *confMap, const char *confName)
Definition: easylogging++.h:2021
void setFlags(base::type::EnumType flags)
Definition: easylogging++.h:2677
Color m_color
Definition: easylogging++.h:2549
static const unsigned int kMaxLogPerContainer
Definition: easylogging++.h:766
static bool allowed(Level leve, const char *cat)
Determines whether logging will occur at this level and category.
Definition: easylogging++.cc:3369
Definition: easylogging++.h:2834
HitCounter(void)
Definition: easylogging++.h:2075
Definition: easylogging++.h:2135
unsigned long int LineNumber
Definition: easylogging++.h:559
static std::string getCurrentThreadId(void)
Gets ID of currently running threading in windows systems. On unix, nothing is returned.
Definition: easylogging++.h:1048
unsigned int m_offset
Definition: easylogging++.h:877
int m_width
Definition: easylogging++.h:876
base::threading::internal::Mutex Mutex
Definition: easylogging++.h:999
Definition: easylogging++.h:2516
def run(t, blocks)
Definition: block_weight.py:35
static bool isComment(const std::string &line)
Definition: easylogging++.cc:545
const char * filename(void) const
Definition: easylogging++.h:2119
std::unordered_map< Level, bool > m_performanceTrackingMap
Definition: easylogging++.h:1979
#define ELPP_INTERNAL_INFO(lvl, msg)
Definition: easylogging++.h:221
static std::string currentHost(void)
Gets current host name or computer name.
Definition: easylogging++.cc:1234
static char * clearBuff(char buff[], std::size_t lim)
Definition: easylogging++.cc:1112
static const char * convertToString(Level level)
Converts level to associated const char*.
Definition: easylogging++.cc:193
virtual void registerNew(T_Ptr *ptr) ELPP_FINAL
Definition: easylogging++.h:1549
virtual iterator end(void) ELPP_FINAL
Definition: easylogging++.h:1355
RegistryWithPred(const RegistryWithPred &sr)
Copy constructor that is useful for base classes. Try to avoid this constructor, use move constructor...
Definition: easylogging++.h:1499
base::VRegistry * m_vRegistry
Definition: easylogging++.h:2764
std::unordered_map< Level, std::string > m_filenameMap
Definition: easylogging++.h:1975
base::RegisteredLoggers * m_registeredLoggers
Definition: easylogging++.h:2762
Represents unknown level.
tools::wallet2::message_signature_result_t result
Definition: signature.cpp:62
Definition: easylogging++.h:2233
bool toStandardOutput(Level level)
Definition: easylogging++.cc:1752
virtual void unregisterAll(void) ELPP_FINAL
Unregisters all the pointers from current repository.
Definition: easylogging++.h:1441
Level
Represents enumeration for severity level used to determine level of logging.
Definition: easylogging++.h:591
AbstractRegistry(AbstractRegistry &&sr)
Move constructor that is useful for base classes.
Definition: easylogging++.h:1304
static char * wcharPtrToCharPtr(const wchar_t *line)
Converst wchar* to char* NOTE: Need to free return value after use!
Definition: easylogging++.cc:1120
RegistryWithPred< T_Ptr, Pred >::iterator iterator
Definition: easylogging++.h:1488
Level m_level
Definition: easylogging++.h:2548
args
Definition: build_protob.py:10
void clearModules(void)
Definition: easylogging++.h:2471
base::DispatchAction m_dispatchAction
Definition: easylogging++.h:2852
const char * name
Definition: easylogging++.h:810
virtual ~Registry(void)
Definition: easylogging++.h:1436
const char * brief
Definition: easylogging++.h:811
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:3800
LogBuilder()
Definition: easylogging++.h:2239
static char * addToBuff(const char *str, char *buf, const char *bufLim)
Definition: easylogging++.cc:1106
void setApplicationArguments(int argc, const char **argv)
Definition: easylogging++.h:2789
T * logDispatchCallback(const std::string &id)
Definition: easylogging++.h:2719
void setColor(Color color, bool bright)
Definition: easylogging++.cc:692
virtual void unregister(T_Ptr *&ptr) ELPP_FINAL
Definition: easylogging++.h:1534
bool uninstallCustomFormatSpecifier(const char *formatSpecifier)
Definition: easylogging++.cc:2382
static std::size_t getSizeOfFile(base::type::fstream_t *fs)
Gets size of file provided in stream.
Definition: easylogging++.cc:853
virtual ~Configuration(void)
Definition: easylogging++.h:1718
FormatFlags
Format flags used to determine specifiers that are active for performance improvements.
Definition: easylogging++.h:847
bool m_termSupportsColor
Definition: easylogging++.h:2247
void resolveLoggerFormatSpec(void) const
Definition: easylogging++.cc:811
LogBuilderPtr m_logBuilder
Definition: easylogging++.h:2348
virtual ~Writer(void)
Definition: easylogging++.h:3273
std::unordered_map< Level, base::FileStreamPtr > m_fileStreamMap
Definition: easylogging++.h:1980
M * m_mutex
Definition: easylogging++.h:995
const int max_
Definition: gmock-cardinalities.cc:89
static std::string currentUser(void)
Gets current username.
Definition: easylogging++.cc:1221
static void setVModules(const char *modules)
Sets vmodules as specified (on the fly)
Definition: easylogging++.cc:3526
Determines log file (full path) to write logs to for correponding level and logger.
virtual ~ThreadSafe(void)
Definition: easylogging++.h:1040
void lock(void)
Definition: easylogging++.h:951
virtual void log(el::base::type::ostream_t &os) const
Definition: easylogging++.h:2265
base::type::LineNumber m_line
Definition: easylogging++.h:2551
base::TypedConfigurations * m_typedConfigurations
Definition: easylogging++.h:2341
void installCustomFormatSpecifier(const CustomFormatSpecifier &customFormatSpecifier)
Definition: easylogging++.cc:2374
Writes nothing - Used when certain log is disabled.
Definition: easylogging++.h:3240
base::type::LineNumber m_lineNumber
Definition: easylogging++.h:2149
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:2518
Mutex(void)
Definition: easylogging++.h:931
Container::iterator iterator
Definition: easylogging++.h:1297
static const unsigned int kDefaultSubsecondPrecision
Definition: easylogging++.h:767
Loggers repository.
Definition: easylogging++.h:2388
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
Definition: gmock-generated-matchers.h:481
Conf_T getConfigByVal(Level level, const std::unordered_map< Level, Conf_T > *confMap, const char *confName)
Definition: easylogging++.h:1992
virtual ~LogBuilder(void)
Definition: easylogging++.h:2240
bool enabled(Level level) const
Definition: easylogging++.h:2314
#define ELPP_INTERNAL_ERROR(msg, pe)
Definition: easylogging++.h:207
void setFromArgs(const base::utils::CommandLineArgs *commandLineArgs)
Definition: easylogging++.cc:2271
Adds spaces b/w logs that separated by left-shift operator.
void setFilenameCommonPrefix(const std::string &prefix)
Definition: easylogging++.h:2498
bool hasConfiguration(ConfigurationType configurationType)
Determines whether or not specified configuration type exists in the repository.
Definition: easylogging++.cc:403
base::type::string_t build(const LogMessage *logMessage, bool appendNewLine) const
Definition: easylogging++.cc:2787
std::unordered_map< std::string, std::string > m_paramsWithValue
Definition: easylogging++.h:1285
Internal helper class that prevent copy constructor for class.
Definition: easylogging++.h:569
String utilities helper class used internally. You should not use it.
Definition: easylogging++.h:1104
CommandLineArgs(int argc, const char **argv)
Definition: easylogging++.h:1256
virtual ~Loggable(void)
Definition: easylogging++.h:1605
static void defaultPreRollOutCallback(const char *, std::size_t)
Definition: easylogging++.h:841
static const int kCrashSignalsCount
Definition: easylogging++.h:836
Makes sure if -vmodule is used and does not specifies a module, then verbose logging is allowed via t...
void initialize(Logger *logger)
Definition: easylogging++.cc:2900
Information that can be highly useful and vary with verbose logging level.
void setDispatchAction(base::DispatchAction dispatchAction)
Definition: easylogging++.h:2211
Determines format of logging corresponding level and logger.
static void removeFlag(Enum e, base::type::EnumType *flag)
Definition: easylogging++.h:916
static void setStorage(base::type::StoragePointer storage)
Shares logging repository (base::Storage)
Definition: easylogging++.h:3719
RegisteredLoggers(const LogBuilderPtr &defaultLogBuilder)
Definition: easylogging++.cc:1998
Disable VModules extensions.
#define ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(temp)
Definition: easylogging++.h:2976
static void installCustomFormatSpecifier(const CustomFormatSpecifier &customFormatSpecifier)
Installs user defined format specifier and handler.
Definition: easylogging++.h:3829
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:3316
LogBuilderPtr m_defaultLogBuilder
Definition: easylogging++.h:2449
static std::string & replaceAll(std::string &str, char replaceWhat, char replaceWith)
Replaces all instances of replaceWhat with 'replaceWith'. Original variable is changed for performanc...
Definition: easylogging++.cc:1014
std::unique_ptr< el::base::PerformanceTracker > PerformanceTrackerPtr
Definition: easylogging++.h:564
e
Definition: pymoduletest.py:79
friend class el::base::PerformanceTracker
Definition: easylogging++.h:2784
virtual ~AbstractRegistry(void)
Definition: easylogging++.h:1346
static bool contains(const char *str, char c)
Returns true if c exist in str.
Definition: easylogging++.cc:1083
const base::SubsecondPrecision & subsecondPrecision(Level level=Level::Global)
Definition: easylogging++.cc:1760
virtual ~Mutex(void)
Definition: easylogging++.h:943
friend el::base::type::ostream_t & operator<<(el::base::type::ostream_t &os, const Loggable &loggable)
Definition: easylogging++.h:1608
modules
Definition: check_missing_rpc_methods.py:19
static base::TypedConfigurations defaultTypedConfigurations(void)
Default typed configuration based on existing defaultConf.
Definition: easylogging++.cc:3446
base::type::EnumType m_flags
Definition: easylogging++.h:2763
bool parseFromText(const std::string &configurationsString, Configurations *base=nullptr)
Parse configurations from configuration string.
Definition: easylogging++.cc:385
virtual std::size_t size(void) const ELPP_FINAL
Definition: easylogging++.h:1376
Writer & operator<<(const std::string &log)
Definition: easylogging++.h:3277
SubsecondPrecision(int width)
Definition: easylogging++.h:870
base::TypedConfigurations * typedConfigurations(void)
Definition: easylogging++.h:2291
void unlock(void)
Definition: easylogging++.h:967
static bool isValidId(const std::string &id)
Definition: easylogging++.cc:769
void addFlag(LoggingFlag flag)
Definition: easylogging++.h:2661
const struct el::base::consts::@15 kTimeFormats[]
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
bool validateEveryNCounter(const char *filename, base::type::LineNumber lineNumber, std::size_t occasion)
Definition: easylogging++.h:2627
std::unordered_map< Level, unsigned int > m_unflushedCount
Definition: easylogging++.h:2346
A pointer registry mechanism to manage memory and provide search functionalities. (predicate version)...
Definition: easylogging++.h:1486
virtual void deepCopy(const AbstractRegistry< T_Ptr, Container > &)=0
const char * m_func
Definition: easylogging++.h:3299
static std::string & trim(std::string &str)
Definition: easylogging++.cc:1002
LogDispatcher(bool proceed, LogMessage *logMessage, base::DispatchAction dispatchAction)
Definition: easylogging++.h:2841
bool try_lock(void)
Definition: easylogging++.h:959
LogMessage * m_logMessage
Definition: easylogging++.h:2851
bool operator==(const SubsecondPrecision &ssPrec)
Definition: easylogging++.h:873
void initUnflushedCount(void)
Definition: easylogging++.cc:802
TypedConfigurations(Configurations *configurations, base::LogStreamsReferenceMap *logStreamsReference)
Constructor to initialize (construct) the object off el::Configurations.
Definition: easylogging++.cc:1727
Definition: readline_buffer.h:9
std::unordered_map< std::string, FileStreamPtr > LogStreamsReferenceMap
Definition: easylogging++.h:1936
std::vector< std::string > m_params
Definition: easylogging++.h:1286
std::shared_ptr< PerformanceTrackingCallback > PerformanceTrackingCallbackPtr
Definition: easylogging++.h:562
static base::type::EnumType And(Enum e, base::type::EnumType flag)
Definition: easylogging++.h:899
void dispatch(base::type::string_t &&rawLinePrefix, base::type::string_t &&rawLinePayload, base::type::string_t &&logLine)
Definition: easylogging++.cc:2601
std::unordered_map< Level, bool > m_toStandardOutputMap
Definition: easylogging++.h:1976
bool hasCustomFormatSpecifier(const char *formatSpecifier)
Definition: easylogging++.cc:2368
LogMessage * m_msg
Definition: easylogging++.h:3294
std::string resolveFilename(const std::string &filename)
Definition: easylogging++.cc:1854
static const Level kPerformanceTrackerDefaultLevel
Definition: easylogging++.h:795
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:251
static bool cStringCaseEq(const char *s1, const char *s2)
Compares cstring equality (case-insensitive) - uses toupper(char) Dont use strcasecmp because of CRT ...
Definition: easylogging++.cc:1064
base::LogStreamsReferenceMap m_logStreamsReference
Definition: easylogging++.h:2451
Logger * m_logger
Definition: easylogging++.h:3301
static void uninstallLogDispatchCallback(const std::string &id)
Uninstalls log dispatch callback.
Definition: easylogging++.h:3775
Registry & operator=(const Registry &sr)
Assignment operator that unregisters all the existing registeries and deeply copies each of repo elem...
Definition: easylogging++.h:1428
const char * m_filename
Definition: easylogging++.h:2153
virtual void handle(const T *handlePtr)=0
static bool isConfig(const std::string &line)
Definition: easylogging++.cc:549
Preserves time format and does not convert it to sec, hour etc (performance tracking only) ...
#define ELPP_SIMPLE_LOG(LOG_TYPE)
Definition: easylogging++.h:2936
void clear(void)
Clears repository so that all the configurations are unset.
Definition: easylogging++.h:1851
unsigned int EnumType
Definition: easylogging++.h:557
std::function< std::string(const LogMessage *)> FormatSpecifierValueResolver
Resolving function for format specifier.
Definition: easylogging++.h:1682
~ScopedAddFlag(void)
Definition: easylogging++.h:3928
Registry< T_Ptr, T_Key >::const_iterator const_iterator
Definition: easylogging++.h:1413
::std::wstring wstring
Definition: gtest-port.h:1103
static base::type::EnumType castToInt(ConfigurationType configurationType)
Casts configuration type to int, useful for iterating through enum.
Definition: easylogging++.h:703
base::LogStreamsReferenceMap * m_logStreamsReference
Definition: easylogging++.h:2347
std::size_t size(void) const
Returns total number of arguments. This exclude argv[0].
Definition: easylogging++.cc:1478
void init(int width)
Definition: easylogging++.cc:1518
bool validateFileRolling(Level level, const PreRollOutCallback &preRollOutCallback)
Definition: easylogging++.h:2067
Logger * m_logger
Definition: easylogging++.h:3219
static const char * kDefaultLoggerId
Definition: easylogging++.h:772
bool has(const std::string &id)
Definition: easylogging++.h:2425
static void log()
Definition: logging.cpp:85
base::threading::internal::ScopedLock< base::threading::Mutex > ScopedLock
Definition: easylogging++.h:1000
void setLevel(base::type::VerboseLevel level)
Sets verbose level. Accepted range is 0-9.
Definition: easylogging++.cc:2055
Definition: easylogging++.h:2199
HitCounter(const HitCounter &hitCounter)
Definition: easylogging++.h:2087
static void setFilenameCommonPrefix(const std::string &prefix)
Sets filename common prefix.
Definition: easylogging++.cc:3548
Static class that contains helper functions for el::ConfigurationType.
Definition: easylogging++.h:696
bool operator!=(const AbstractRegistry< T_Ptr, Container > &other)
Definition: easylogging++.h:1324
Definition: easylogging++.h:3314
bool isFlushNeeded(Level level)
Definition: easylogging++.h:2302
virtual void unregisterAll(void)=0
Unregisters all the pointers from current repository.
bool allowed(Level level, const std::string &category)
Definition: easylogging++.cc:2227
virtual void log(el::base::type::ostream_t &) const =0
const char * m_filename
Definition: easylogging++.h:2148
base::type::EnumType flags(void) const
Definition: easylogging++.h:2673
static char * parseFormat(char *buf, std::size_t bufSz, const char *format, const struct tm *tInfo, std::size_t msec, const base::SubsecondPrecision *ssPrec)
Definition: easylogging++.cc:1365
std::string m_id
Definition: easylogging++.h:2340
bool m_enabled
Definition: easylogging++.h:2197
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:304
static ConfigurationType convertFromString(const char *configStr)
Converts from configStr to ConfigurationType.
Definition: easylogging++.cc:295
void unsafeSet(Level level, ConfigurationType configurationType, const std::string &value)
Thread unsafe set.
Definition: easylogging++.cc:624
static void addFlag(Enum e, base::type::EnumType *flag)
Definition: easylogging++.h:912
friend class el::base::PerformanceTracker
Definition: easylogging++.h:2359
void unsetPreRollOutCallback(void)
Definition: easylogging++.h:2685
bool operator()(const HitCounter *counter)
Definition: easylogging++.h:2141
static void setArgs(int argc, const char **argv)
Sets application arguments and figures out whats active for logging and whats not.
Definition: easylogging++.h:3731
Storage(const LogBuilderPtr &defaultLogBuilder)
Definition: easylogging++.cc:2300
static std::string & toUpper(std::string &str)
Converts string to uppercase.
Definition: easylogging++.cc:1050
base::DispatchAction m_dispatchAction
Definition: easylogging++.h:2216
static bool isDigit(char c)
Checks if character is digit. Dont use libc implementation of it to prevent locale issues...
Definition: easylogging++.h:1107
void reconfigure(void)
Reconfigures logger using existing configurations.
Definition: easylogging++.cc:764
static const std::string releaseDate(void)
Release date of current version.
Definition: easylogging++.cc:3562
Adds flag and removes it when scope goes out.
Definition: easylogging++.h:3923
unsigned short VerboseLevel
Definition: easylogging++.h:558
void unregister(Logger *&logger)
Definition: easylogging++.h:2429
#define ELPP_UNUSED(x)
Definition: easylogging++.h:240
void setEnabled(bool enabled)
Definition: easylogging++.h:2190
A pointer registry mechanism to manage memory and provide search functionalities. (non-predicate vers...
Definition: easylogging++.h:1410
static void clearCategories(void)
Clears categories.
Definition: easylogging++.cc:3544
const std::string & parentApplicationName(void) const
Definition: easylogging++.h:2279
static void flushAll(void)
Flushes all loggers for all levels - Be careful if you dont know how many loggers are registered...
Definition: easylogging++.cc:3514
RegistryWithPred & operator=(const RegistryWithPred &sr)
Assignment operator that unregisters all the existing registeries and deeply copies each of repo elem...
Definition: easylogging++.h:1509
static const std::size_t kSourceFilenameMaxLength
Definition: easylogging++.h:793
Definition: easylogging++.h:2931
int
Definition: pymoduletest.py:17
static void reconfigureAllLoggers(const Configurations &configurations)
Reconfigures all the existing loggers with new configurations.
Definition: easylogging++.cc:3414
set
Definition: gmock_class.py:44
Static helpers to deal with loggers and their configurations.
Definition: easylogging++.h:3846
base::threading::Mutex m_customFormatSpecifiersLock
Definition: easylogging++.h:2775
bool installLogDispatchCallback(const std::string &id)
Definition: easylogging++.h:2710
static bool hasFlag(Enum e, base::type::EnumType flag)
Definition: easylogging++.h:920
Configurations(void)
Default constructor with empty repository.
Definition: easylogging++.cc:356
std::unordered_map< std::string, std::string > m_threadNames
Definition: easylogging++.h:2773
base::type::ostream_t & operator<<(base::type::ostream_t &os, const CommandLineArgs &c)
Definition: easylogging++.cc:1482
Contains utilities for cross-platform date/time. This class make use of el::base::utils::Str.
Definition: easylogging++.h:1219
ScopedAddFlag(LoggingFlag flag)
Definition: easylogging++.h:3925
void unsafeSetGlobally(ConfigurationType configurationType, const std::string &value, bool includeGlobalLevel)
Sets configurations (Unsafely) for all levels including Level::Global if includeGlobalLevel is true...
Definition: easylogging++.cc:648
static const char kFormatSpecifierCharValue
Definition: easylogging++.h:763
bool unsafeValidateFileRolling(Level level, const PreRollOutCallback &preRollOutCallback)
Definition: easylogging++.cc:1932
std::unordered_map< Level, base::LogFormat > m_logFormatMap
Definition: easylogging++.h:1977
Configurations with data types.
Definition: easylogging++.h:1943
bool performanceTracking(Level level=Level::Global)
Definition: easylogging++.cc:1768
MessageBuilder & writeIterator(Iterator begin_, Iterator end_, std::size_t size_)
Definition: easylogging++.h:3223
static void setLoggingLevel(Level level)
Sets hierarchy for logging. Needs to enable logging flag (HierarchicalLogging)
Definition: easylogging++.h:3947
static bool termSupportsColor(void)
Whether or not the process's current terminal supports colors.
Definition: easylogging++.cc:1257
virtual ~TypedConfigurations(void)
Definition: easylogging++.h:1952
virtual void unregisterAll(void) ELPP_FINAL
Unregisters all the pointers from current repository.
Definition: easylogging++.h:1525
std::vector< std::string > m_loggerIds
Definition: easylogging++.h:3305
Configurations * m_configurations
Definition: easylogging++.h:1972
void setPreRollOutCallback(const PreRollOutCallback &callback)
Definition: easylogging++.h:2681
bool m_isFromFile
Definition: easylogging++.h:1916
static void gettimeofday(struct timeval *tv)
Cross platform gettimeofday for Windows and unix platform. This can be used to determine current micr...
Definition: easylogging++.cc:1264
#define false
Definition: stdbool.h:37
virtual ~CommandLineArgs(void)
Definition: easylogging++.h:1262
base::utils::CommandLineArgs m_commandLineArgs
Definition: easylogging++.h:2769
net::dandelionpp::connection_map map_
Definition: levin_notify.cpp:587
const base::type::char_t * unit
Definition: easylogging++.h:798
PreRollOutCallback m_preRollOutCallback
Definition: easylogging++.h:2770
std::shared_ptr< LogBuilder > LogBuilderPtr
Definition: easylogging++.h:2250
LoggingFlag m_flag
Definition: easylogging++.h:3944
virtual void acquireLock(void) ELPP_FINAL
Definition: easylogging++.h:1035
const base::HitCounter * getCounter(const char *filename, base::type::LineNumber lineNumber)
Gets hit counter registered at specified position.
Definition: easylogging++.h:2173
Alias of SubsecondPrecision (for backward compatibility)
Make terminal output colorful for supported terminals.
#define ELPP_LITERAL(txt)
Definition: easylogging++.h:539
HitCounter & operator=(const HitCounter &hitCounter)
Definition: easylogging++.h:2093
static MDB_envinfo info
Definition: mdb_load.c:37
Repository for hit counters used across the application.
Definition: easylogging++.h:2158
void removeFlag(LoggingFlag flag)
Definition: easylogging++.h:2665
Configurations m_defaultConfigurations
Definition: easylogging++.h:2450
static void replaceFirstWithEscape(base::type::string_t &str, const base::type::string_t &replaceWhat, const base::type::string_t &replaceWith)
Definition: easylogging++.cc:1030
static const int kTimeFormatsCount
Definition: easylogging++.h:807
virtual ~SysLogInitializer(void)
Definition: easylogging++.h:3708
bool installLoggerRegistrationCallback(const std::string &id)
Definition: easylogging++.h:2408
static void configureFromGlobal(const char *globalConfigurationFilePath)
Sets configurations from global configuration file.
Definition: easylogging++.cc:3461
LogBuilder * logBuilder(void) const
Definition: easylogging++.h:2306
Logger * logger(void) const
Definition: easylogging++.h:2541
static const std::string getBashOutput(const char *command)
Runs command on terminal and returns the output.
Definition: easylogging++.cc:1169
base::type::LineNumber lineNumber(void) const
Definition: easylogging++.h:2123
const char * buf
Definition: slow_memmem.cpp:73
bool validateAfterNCounter(const char *filename, base::type::LineNumber lineNumber, std::size_t n)
Definition: easylogging++.h:2631
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:3261
void validateHitCounts(std::size_t n)
Validates hit counts and resets it if necessary.
Definition: easylogging++.h:2112
Useful when application has potentially harmful situtaions.
Definition: easylogging++.h:1077
void handle(const LogDispatchData *data)
Definition: easylogging++.cc:2456
int numb
Definition: easylogging++.h:809
static bool wildCardMatch(const char *str, const char *pattern)
Matches wildcards, '*' and '?' only supported.
Definition: easylogging++.cc:964
std::string string_t
Definition: easylogging++.h:547
When handling crashes by default, detailed crash reason will be logged as well.
static bool cStringEq(const char *s1, const char *s2)
Compares cstring equality - uses strcmp.
Definition: easylogging++.cc:1058
DispatchAction
Action to be taken for dispatching.
Definition: easylogging++.h:2179
void setThreadName(const std::string &name)
Sets thread name for current thread. Requires std::thread.
Definition: easylogging++.h:2743
Enables strict file rolling.
std::size_t maxLogFileSize(Level level)
Definition: easylogging++.cc:1776
static base::type::StoragePointer storage()
Definition: easylogging++.h:3723
void unsafeFlushAll(void)
Definition: easylogging++.cc:2040
void setApplicationArguments(int argc, char **argv)
Definition: easylogging++.cc:2393
Conf_T unsafeGetConfigByVal(Level level, const std::unordered_map< Level, Conf_T > *confMap, const char *confName)
Definition: easylogging++.h:2004
std::unordered_map< std::string, std::unique_ptr< base::threading::Mutex > > m_fileLocks
Definition: easylogging++.h:2226
static void uninstallPreRollOutCallback(void)
Uninstalls pre rollout callback.
Definition: easylogging++.h:3765
const char * m_file
Definition: easylogging++.h:3297
NullWriter & operator<<(const T &)
Definition: easylogging++.h:3250
const char * detail
Definition: easylogging++.h:812
virtual void deepCopy(const AbstractRegistry< T_Ptr, std::unordered_map< T_Key, T_Ptr *>> &sr) ELPP_FINAL
Definition: easylogging++.h:1474
std::string m_parentApplicationName
Definition: easylogging++.h:2343
void setRemainingToDefault(void)
Lets you set the remaining configurations to default.
Definition: easylogging++.cc:465
static void uninstallLoggerRegistrationCallback(const std::string &id)
Uninstalls log dispatch callback.
Definition: easylogging++.h:3861
static std::string getEnvironmentVariable(const char *variableName, const char *defaultVal, const char *alternativeBashCommand=nullptr)
Gets environment variable. This is cross-platform and CRT safe (for VC++)
Definition: easylogging++.cc:1197
virtual Container & list(void) ELPP_FINAL
Returns underlying container by reference.
Definition: easylogging++.h:1381
Removes flag and add it when scope goes out.
Definition: easylogging++.h:3935
base::Storage * StoragePointer
Definition: easylogging++.h:560
static T * logDispatchCallback(const std::string &id)
Definition: easylogging++.h:3779
#define si(y, x, c)
Definition: aesb.c:48
const char *const str
Definition: portlistingparse.c:23
MessageBuilder & operator<<(const std::string &msg)
Definition: easylogging++.h:2945
const std::string & id(void) const
Definition: easylogging++.h:2275
std::string m_func
Definition: easylogging++.h:2552
std::vector< int8_t > m_data
Definition: base58.cpp:76
LoggingFlag m_flag
Definition: easylogging++.h:3932
Level m_level
Definition: easylogging++.h:1756
Flushes log with every log-entry (performance sensative) - Disabled by default.
static void reserveCustomFormatSpecifiers(std::size_t size)
Reserve space for custom format specifiers for performance.
Definition: easylogging++.h:3825
const base::utils::CommandLineArgs * commandLineArgs(void) const
Definition: easylogging++.h:2657
static struct ::tm * buildTimeInfo(struct timeval *currTime, struct ::tm *timeInfo)
Definition: easylogging++.cc:1339
bool operator()(const Configuration *conf) const
Definition: easylogging++.cc:350
static bool unregisterLogger(const std::string &identity)
Unregisters logger - use it only when you know what you are doing, you may unregister loggers initial...
Definition: easylogging++.cc:3385
void configure(const Configurations &configurations)
Configures the logger using specified configurations.
Definition: easylogging++.cc:745
Definition: document.h:406
Thread-safe Configuration repository.
Definition: easylogging++.h:1769
CommandLineArgs(int argc, char **argv)
Definition: easylogging++.h:1259
Writer(LogMessage *msg, base::DispatchAction dispatchAction=base::DispatchAction::NormalLog)
Definition: easylogging++.h:3268
Mainly useful to represent current progress of application.
std::string m_filenameCommonPrefix
Definition: easylogging++.h:2513
void setValue(const std::string &value)
Set string based configuration value.
Definition: easylogging++.h:1742
key identity()
Definition: rctOps.h:73
Level level(void) const
Gets level of current configuration.
Definition: easylogging++.h:1725
bool enabled(Level level)
Definition: easylogging++.cc:1740
base::threading::Mutex m_fileLocksMapLock
Definition: easylogging++.h:2227
static bool installCallback(const std::string &id, std::unordered_map< std::string, TPtr > *mapT)
Definition: easylogging++.h:1574
base::threading::Mutex & customFormatSpecifiersLock()
Definition: easylogging++.h:2701
const T & move(const T &t)
Definition: gtest-port.h:1317
Dispatches log messages.
Definition: easylogging++.h:2839
bool hasParam(const char *paramKey) const
Return true if arguments has a param (not having a value) i,e without '='.
Definition: easylogging++.cc:1470
Predicate(const char *filename, base::type::LineNumber lineNumber)
Definition: easylogging++.h:2137
static const base::LogStreamsReferenceMap * logStreamsReference(void)
Returns log stream reference pointer if needed by user.
Definition: easylogging++.cc:3442
static void reconfigureAllLoggers(ConfigurationType configurationType, const std::string &value)
Reconfigures single configuration for all the loggers.
Definition: easylogging++.h:3883
const std::string & func(void) const
Definition: easylogging++.h:2535
static bool parseFromText(const std::string &configurationsString, Configurations *sender, Configurations *base=nullptr)
Parse configurations from configuration string.
Definition: easylogging++.cc:506
std::function< void(const char *, std::size_t)> PreRollOutCallback
Definition: easylogging++.h:839
static bool parseFromFile(const std::string &configurationFile, Configurations *sender, Configurations *base=nullptr)
Parses configuration from file.
Definition: easylogging++.cc:488
Level m_level
Definition: easylogging++.h:1761
virtual ~PErrorWriter(void)
Definition: easylogging++.cc:3082
void resetLocation(const char *filename, base::type::LineNumber lineNumber)
Resets location of current hit counter.
Definition: easylogging++.h:2106
Configurations * configurations(void)
Definition: easylogging++.h:2287
static const std::string version(void)
Current version number.
Definition: easylogging++.cc:3558
virtual ~RegisteredLoggers(void)
Definition: easylogging++.h:2392
bool operator==(const AbstractRegistry< T_Ptr, Container > &other)
Definition: easylogging++.h:1312
TimestampUnit
Enum to represent timestamp unit.
Definition: easylogging++.h:843
Command line arguments for application if specified using el::Helpers::setArgs(..) or START_EASYLOGGI...
Definition: easylogging++.h:1251
Configurations * defaultConfigurations(void)
Definition: easylogging++.h:2401
PreRollOutCallback & preRollOutCallback(void)
Definition: easylogging++.h:2689
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
static bool endsWith(const std::string &str, const std::string &end)
Determines whether or not str ends with specified string.
Definition: easylogging++.cc:1010
const_iterator begin() const noexcept
Definition: dandelionpp.h:80
void setDefaultConfigurations(const Configurations &configurations)
Definition: easylogging++.h:2396
base::RegisteredHitCounters * m_registeredHitCounters
Definition: easylogging++.h:2761
base::DispatchAction m_dispatchAction
Definition: easylogging++.h:3304
Definition: easylogging++.h:2795
std::string getThreadName(const std::string &threadId)
Definition: easylogging++.h:2749
static const char kFormatSpecifierChar
Definition: easylogging++.h:764
base::MessageBuilder m_messageBuilder
Definition: easylogging++.h:3303
Specifies number of log entries to hold until we flush pending log data.
time
Definition: gen_wide_data.py:40
static bool parseLine(std::string *line, std::string *currConfigStr, std::string *currLevelStr, Level *currLevel, Configurations *conf)
Definition: easylogging++.cc:557
base::type::string_t m_message
Definition: easylogging++.h:2555
std::string m_configurationFile
Definition: easylogging++.h:1915
static bool configureFromArg(const char *argKey)
Configures loggers using command line arg. Ensure you have already set command line args...
Definition: easylogging++.cc:3502
static void addFlag(LoggingFlag flag)
Adds logging flag used internally.
Definition: easylogging++.h:3911
std::unordered_map< std::string, base::type::LoggerRegistrationCallbackPtr > m_loggerRegistrationCallbacks
Definition: easylogging++.h:2452
Definition: easylogging++.h:2237
static void validateFileRolling(Logger *logger, Level level)
Definition: easylogging++.h:3840
static const base::type::EnumType kMinValid
Represents minimum valid configuration type. Useful when iterating through enum.
Definition: easylogging++.h:699
Configurations m_configurations
Definition: easylogging++.h:2345
std::shared_ptr< LoggerRegistrationCallback > LoggerRegistrationCallbackPtr
Definition: easylogging++.h:563
LogMessage * m_logMessage
Definition: easylogging++.h:2215
static Logger * getLogger(const std::string &identity, bool registerIfNotAvailable=true)
Gets existing or registers new logger.
Definition: easylogging++.cc:3377
static std::string timevalToString(struct timeval tval, const char *format, const el::base::SubsecondPrecision *ssPrec)
Converts timeval (struct from ctime) to string using specified format and subsecond precision...
Definition: easylogging++.cc:1297
base::type::VerboseLevel verboseLevel(void) const
Definition: easylogging++.h:2538
int bool
Definition: stdbool.h:35
AbstractRegistry(void)
Default constructor.
Definition: easylogging++.h:1301
NullWriter & operator<<(std::ostream &(*)(std::ostream &))
Definition: easylogging++.h:3245
base::debug::CrashHandler elCrashHandler
T * loggerRegistrationCallback(const std::string &id)
Definition: easylogging++.h:2419
static const el::base::utils::CommandLineArgs * commandLineArgs(void)
Returns command line arguments (pointer) provided to easylogging++.
Definition: easylogging++.h:3820
bool vModulesEnabled(void)
Whether or not vModules enabled.
Definition: easylogging++.h:2494
void setFromBase(Configurations *base)
Sets configuration based-off an existing configurations.
Definition: easylogging++.cc:393
A subsecond precision class containing actual width and offset of the subsecond part.
Definition: easylogging++.h:865
static bool installLoggerRegistrationCallback(const std::string &id)
Installs logger registration callback, this callback is triggered when new logger is registered...
Definition: easylogging++.h:3856
#define ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(temp)
Definition: easylogging++.h:2986
const std::string & getFilenameCommonPrefix() const
Definition: easylogging++.h:2502
const Configurations * configurations(void) const
Definition: easylogging++.h:1955
~ScopedRemoveFlag(void)
Definition: easylogging++.h:3940
base::VRegistry * vRegistry(void) const
Definition: easylogging++.h:2647
virtual iterator begin(void) ELPP_FINAL
Definition: easylogging++.h:1350
Level m_level
Definition: easylogging++.h:3295
void clearCategories(void)
Definition: easylogging++.cc:2152
NoCopy & operator=(const NoCopy &)
Logger * m_logger
Definition: easylogging++.h:2554
Configuration & operator=(const Configuration &c)
Definition: easylogging++.cc:322
virtual void deepCopy(const AbstractRegistry< T_Ptr, std::vector< T_Ptr *>> &sr)
Definition: easylogging++.h:1565
static const std::size_t kSourceLineMaxLength
Definition: easylogging++.h:794
std::string m_file
Definition: easylogging++.h:2550
std::string m_value
Definition: easylogging++.h:1763
std::unordered_map< std::string, base::type::LogDispatchCallbackPtr > m_logDispatchCallbacks
Definition: easylogging++.h:2771
const char * getParamValue(const char *paramKey) const
Returns value of arguments.
Definition: easylogging++.cc:1465
void dispatch(void)
Definition: easylogging++.cc:2868
void unsafeSetIfNotExist(Level level, ConfigurationType configurationType, const std::string &value)
Unsafely sets configuration if does not already exist.
Definition: easylogging++.cc:617
base::LogStreamsReferenceMap * logStreamsReference(void)
Definition: easylogging++.h:2434
base::type::VerboseLevel m_verboseLevel
Definition: easylogging++.h:3300
prefix
Definition: check.py:15
std::unordered_map< std::string, base::type::VerboseLevel > m_modules
Definition: easylogging++.h:2509
base::threading::ScopedLock m_sync
Definition: easylogging++.h:3306
Definition: easylogging++.h:494
#define M(w0, w14, w9, w1)
Definition: sha512-blocks.c:41
POD_CLASS hash
Definition: hash.h:49
virtual ~HitCounter(void)
Definition: easylogging++.h:2102
VRegistry(base::type::VerboseLevel level, base::type::EnumType *pFlags)
Definition: easylogging++.cc:2051
base::RegisteredLoggers * registeredLoggers(void) const
Definition: easylogging++.h:2643
Logger & operator=(const Logger &logger)
Definition: easylogging++.cc:731
base::DispatchAction dispatchAction(void) const
Definition: easylogging++.h:2205
virtual const Container & list(void) const ELPP_FINAL
Returns underlying container by constant reference.
Definition: easylogging++.h:1386
CommandLineArgs(void)
Definition: easylogging++.h:1253
Generic level that represents all the levels. Useful when setting global configuration for all levels...
Registry< T_Ptr, T_Key >::iterator iterator
Definition: easylogging++.h:1412
virtual void registerNew(const T_Key &uniqKey, T_Ptr *ptr) ELPP_FINAL
Registers new registry to repository.
Definition: easylogging++.h:1451
bool m_proceed
Definition: easylogging++.h:2850
void triggerDispatch(void)
Definition: easylogging++.cc:3052
const LogMessage * logMessage(void) const
Definition: easylogging++.h:2202
static void ignoreComments(std::string *line)
Definition: easylogging++.cc:522
static int priority(Level level)
Definition: easylogging++.cc:2136
Whether or not to write corresponding log to log file.
#define ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(temp)
Definition: easylogging++.h:2981
static const Configurations * defaultConfigurations(void)
Returns current default.
Definition: easylogging++.cc:3438
Represents single configuration that has representing level, configuration type and a string based va...
Definition: easylogging++.h:1713
Internal helper class that makes all default constructors private.
Definition: easylogging++.h:580
void uninstallLogDispatchCallback(const std::string &id)
Definition: easylogging++.h:2715
void setLogMessage(LogMessage *logMessage)
Definition: easylogging++.h:2208
static base::type::EnumType Not(Enum e, base::type::EnumType flag)
Definition: easylogging++.h:903
virtual ~RegistryWithPred(void)
Definition: easylogging++.h:1494
A mutex wrapper for compiler that dont yet support std::recursive_mutex.
Definition: easylogging++.h:929
static bool isLevel(const std::string &line)
Definition: easylogging++.cc:541
static base::type::fstream_t * newFileStream(const std::string &filename)
Creates new out file stream for specified filename.
Definition: easylogging++.cc:829
ScopedRemoveFlag(LoggingFlag flag)
Definition: easylogging++.h:3937
const base::type::char_t * m_containerLogSeperator
Definition: easylogging++.h:3220
Whether or not to write corresponding level and logger log to standard output. By standard output mea...
Class that keeps record of current line hit for occasional logging.
Definition: easylogging++.h:2073
def next(obj)
Definition: ast.py:58
Represents a logger holding ID and configurations we need to write logs.
Definition: easylogging++.h:2254
ConfigurationType
Represents enumeration of ConfigurationType used to configure or access certain aspect of logging...
Definition: easylogging++.h:664
base::type::stringstream_t m_stream
Definition: easylogging++.h:2342
AbstractRegistry & operator=(AbstractRegistry &&sr)
Assignment move operator.
Definition: easylogging++.h:1337
Registry(const Registry &sr)
Copy constructor that is useful for base classes. Try to avoid this constructor, use move constructor...
Definition: easylogging++.h:1418
static const base::type::EnumType kMaxValid
Represents maximum valid level. This is used internally and you should not need it.
Definition: easylogging++.h:636
const GenericPointer< typename T::ValueType > & pointer
Definition: pointer.h:1124
std::unordered_map< Level, bool > m_toFileMap
Definition: easylogging++.h:1974
const char * name
Definition: options.c:30
void increment(void)
Definition: easylogging++.h:2131
static base::type::EnumType Or(Enum e, base::type::EnumType flag)
Definition: easylogging++.h:907
RegistryWithPred< T_Ptr, Pred >::const_iterator const_iterator
Definition: easylogging++.h:1489
static Level convertFromString(const char *levelStr)
Converts from levelStr to Level.
Definition: easylogging++.cc:222
const LogDispatchData * m_data
Definition: easylogging++.h:2799
static std::string getDateTime(const char *format, const base::SubsecondPrecision *ssPrec)
Gets current date and time with a subsecond part.
Definition: easylogging++.cc:1291
HitCounter(const char *filename, base::type::LineNumber lineNumber)
Definition: easylogging++.h:2081
void setCategories(const char *categories, bool clear=true)
Definition: easylogging++.cc:2159
constexpr bool trace
Definition: common.hpp:104
std::stringstream stringstream_t
Definition: easylogging++.h:548
std::vector< CustomFormatSpecifier > m_customFormatSpecifiers
Definition: easylogging++.h:2774
void initializeLogger(const std::string &loggerId, bool lookup=true, bool needLock=true)
Definition: easylogging++.cc:2958
LogDispatchData()
Definition: easylogging++.h:2201
base::type::VerboseLevel m_verboseLevel
Definition: easylogging++.h:2553
StaticClass & operator=(const StaticClass &)
static bool startsWith(const std::string &str, const std::string &start)
Determines whether or not str starts with specified string.
Definition: easylogging++.cc:1006
const std::unordered_map< std::string, base::type::VerboseLevel > & modules(void) const
Definition: easylogging++.h:2487
char ** m_argv
Definition: easylogging++.h:1284
const std::vector< CustomFormatSpecifier > * customFormatSpecifiers(void) const
Definition: easylogging++.h:2697
Static class that contains helper functions for el::Level.
Definition: easylogging++.h:631
Writer & construct(Logger *logger, bool needLock=true)
Definition: easylogging++.cc:2926
Level m_loggingLevel
Definition: easylogging++.h:2777
void setParentApplicationName(const std::string &parentApplicationName)
Definition: easylogging++.h:2283
bool m_proceed
Definition: easylogging++.h:3302
line
Definition: check.py:23
std::unordered_map< Level, std::size_t > m_maxLogFileSizeMap
Definition: easylogging++.h:1981
void reinitDeepCopy(const AbstractRegistry< T_Ptr, Container > &sr)
Definition: easylogging++.h:1395
error
Tracks LMDB error codes.
Definition: error.h:44
int m_argc
Definition: easylogging++.h:1283
#define const
Definition: ipfrdr.c:80
static std::vector< std::string > lookup(lookup_t type, const char *hostname)
Definition: dns_checks.cpp:47
static void uninstallCallback(const std::string &id, std::unordered_map< std::string, TPtr > *mapT)
Definition: easylogging++.h:1583
base::type::LineNumber m_lineNumber
Definition: easylogging++.h:2154
Color
Definition: easylogging++.h:611
base::LogStreamsReferenceMap * m_logStreamsReference
Definition: easylogging++.h:1983
bool validateAfterN(const char *filename, base::type::LineNumber lineNumber, std::size_t n)
Validates counter for hits >= N, i.e, registers new if does not exist otherwise updates original one...
Definition: easylogging++.cc:1966
Enables hierarchical logging.
static constexpr const char hex[]
Definition: wipeable_string.cpp:36
Registry(void)
Definition: easylogging++.h:1415
#define true
Definition: stdbool.h:36
Definition: easylogging++.h:3969
static std::string & ltrim(std::string &str)
Definition: easylogging++.cc:988
Level level(void) const
Definition: easylogging++.h:2523
MessageBuilder(void)
Definition: easylogging++.h:2933
ThreadSafe(void)
Definition: easylogging++.h:1039
c
Definition: pymoduletest.py:79
static bool hasCustomFormatSpecifier(const char *formatSpecifier)
Returns true if custom format specifier is installed.
Definition: easylogging++.h:3837
#define ELPP_FINAL
Definition: easylogging++.h:284
Supports use of multiple logging in same macro, e.g, CLOG(INFO, "default", "network") ...
Static helpers for developers.
Definition: easylogging++.h:3716
std::size_t logFlushThreshold(Level level)
Definition: easylogging++.cc:1780
bool empty(void) const
Returns true if no params available. This exclude argv[0].
Definition: easylogging++.cc:1474
static ConfigurationType castFromInt(base::type::EnumType c)
Casts int(ushort) to configurationt type, useful for iterating through enum.
Definition: easylogging++.h:707
bool hasParamWithValue(const char *paramKey) const
Returns true if arguments contain paramKey with a value (seperated by '=')
Definition: easylogging++.cc:1461
cryptonote::block b
Definition: block.cpp:40
std::string m_categoriesString
Definition: easylogging++.h:2512
#define ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(temp)
Definition: easylogging++.h:2991
static void clearVModules(void)
Clears vmodules.
Definition: easylogging++.cc:3532
Information that can be useful to back-trace certain events - mostly useful than debug logs...
RegistryWithPred(void)
Definition: easylogging++.h:1491
const char * queue
Definition: testobsdrdr.c:21
virtual base::threading::Mutex & lock(void) ELPP_FINAL
Definition: easylogging++.h:1037
const base::type::string_t & message(void) const
Definition: easylogging++.h:2544
Specifies log file max size.
std::size_t m_hitCounts
Definition: easylogging++.h:2155
void processDispatch()
Definition: easylogging++.cc:2999
Represents registries for verbose logging.
Definition: easylogging++.h:2458
void setToDefault(void)
Sets configurations to "factory based" configurations.
Definition: easylogging++.cc:441
std::unordered_map< Level, base::SubsecondPrecision > m_subsecondPrecisionMap
Definition: easylogging++.h:1978
static base::type::VerboseLevel verboseLevel(void)
Gets current verbose level.
Definition: easylogging++.cc:3522
static void setArgs(int argc, char **argv)
Sets application arguments and figures out whats active for logging and whats not.
Definition: easylogging++.h:3727
base::type::EnumType * m_pFlags
Definition: easylogging++.h:2508
Easylogging++ management storage.
Definition: easylogging++.h:2617
#define inline
Definition: inline_c.h:34
Allows to disable application abortion when logged using FATAL level.
virtual bool empty(void) const ELPP_FINAL
Definition: easylogging++.h:1371
static bool installLogDispatchCallback(const std::string &id)
Installs post log dispatch callback, this callback is triggered when log is dispatched.
Definition: easylogging++.h:3770