diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/misc_log_ex.h | 3 | ||||
-rw-r--r-- | contrib/epee/src/mlog.cpp | 61 |
2 files changed, 35 insertions, 29 deletions
diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h index f04282438..fbfd6941f 100644 --- a/contrib/epee/include/misc_log_ex.h +++ b/contrib/epee/include/misc_log_ex.h @@ -51,8 +51,9 @@ #define ELPP_THREAD_SAFE #define ELPP_DEFAULT_LOG_FILE "" -#define ELPP_STACKTRACE 0 +#define ELPP_STACKTRACE_ON_CRASH 0 #define ELPP_DISABLE_DEFAULT_CRASH_HANDLING +#define ELPP_FEATURE_CRASH_LOG 1 #define ELPP_DISABLE_CHECK_MACROS #include "easylogging++.h" diff --git a/contrib/epee/src/mlog.cpp b/contrib/epee/src/mlog.cpp index 139e7b7d6..7f9ef4b3a 100644 --- a/contrib/epee/src/mlog.cpp +++ b/contrib/epee/src/mlog.cpp @@ -43,7 +43,12 @@ static std::string generate_log_filename(const char *base) char tmp[200]; struct tm tm; time_t now = time(NULL); - if (!gmtime_r(&now, &tm)) + if +#ifdef WIN32 + (!gmtime_s(&tm, &now)) +#else + (!gmtime_r(&now, &tm)) +#endif strcpy(tmp, "unknown"); else strftime(tmp, sizeof(tmp), "%Y-%m-%d-%H-%M-%S", &tm); @@ -77,6 +82,32 @@ static void mlog_set_common_prefix() el::Loggers::setFilenameCommonPrefix(std::string(path, expected_ptr - path)); } +static const char *get_default_categories(int level) +{ + const char *categories = ""; + switch (level) + { + case 0: + categories = "*:WARNING,net*:FATAL,global:INFO,verify:FATAL,stacktrace:INFO"; + break; + case 1: + categories = "*:WARNING,global:INFO,stacktrace:INFO"; + break; + case 2: + categories = "*:DEBUG"; + break; + case 3: + categories = "*:TRACE"; + break; + case 4: + categories = "*:TRACE"; + break; + default: + break; + } + return categories; +} + void mlog_configure(const std::string &filename_base, bool console) { el::Configurations c; @@ -103,37 +134,11 @@ void mlog_configure(const std::string &filename_base, bool console) const char *monero_log = getenv("MONERO_LOGS"); if (!monero_log) { - monero_log = "*:WARNING,net*:FATAL,global:INFO,verify:FATAL"; + monero_log = get_default_categories(0); } mlog_set_categories(monero_log); } -static const char *get_default_categories(int level) -{ - const char *categories = ""; - switch (level) - { - case 0: - categories = "*:FATAL,net*:FATAL,global:INFO,verify:FATAL,stacktrace:INFO"; - break; - case 1: - categories = "*:WARNING,global:INFO,stacktrace:INFO"; - break; - case 2: - categories = "*:DEBUG"; - break; - case 3: - categories = "*:TRACE"; - break; - case 4: - categories = "*:TRACE"; - break; - default: - break; - } - return categories; -} - void mlog_set_categories(const char *categories) { el::Loggers::setCategories(categories); |