aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-01-16 19:41:29 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-01-16 19:43:00 +0000
commit5e61687fdf7f626de93515b3b8468a09e9373931 (patch)
treee12c7378968fc68794db73425563f58c1b42052f
parenteasylogging++: enforce recursive mutex (diff)
downloadmonero-5e61687fdf7f626de93515b3b8468a09e9373931.tar.xz
mlog: allow overriding log format
using the MONERO_LOG_FORMAT environment variable. Default is: %datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%loc\t%msg Field list in easylogging++ documentation. Don't forget to escape as needed.
-rw-r--r--contrib/epee/src/mlog.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/epee/src/mlog.cpp b/contrib/epee/src/mlog.cpp
index 37a15bbd5..f1d74a2a3 100644
--- a/contrib/epee/src/mlog.cpp
+++ b/contrib/epee/src/mlog.cpp
@@ -33,7 +33,6 @@
INITIALIZE_EASYLOGGINGPP
-//#define MLOG_BASE_FORMAT "%datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%fbase:%line\t%msg"
#define MLOG_BASE_FORMAT "%datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%loc\t%msg"
using namespace epee;
@@ -83,7 +82,10 @@ void mlog_configure(const std::string &filename_base, bool console)
el::Configurations c;
c.setGlobally(el::ConfigurationType::Filename, filename_base);
c.setGlobally(el::ConfigurationType::ToFile, "true");
- c.setGlobally(el::ConfigurationType::Format, MLOG_BASE_FORMAT);
+ const char *log_format = getenv("MONERO_LOG_FORMAT");
+ if (!log_format)
+ log_format = MLOG_BASE_FORMAT;
+ c.setGlobally(el::ConfigurationType::Format, log_format);
c.setGlobally(el::ConfigurationType::ToStandardOutput, console ? "true" : "false");
c.setGlobally(el::ConfigurationType::MaxLogFileSize, "104850000"); // 100 MB - 7600 bytes
el::Loggers::setDefaultConfigurations(c, true);