mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-23 13:47:47 +00:00
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.
This commit is contained in:
parent
5161f16f4a
commit
5e61687fdf
1 changed files with 4 additions and 2 deletions
|
@ -33,7 +33,6 @@
|
||||||
|
|
||||||
INITIALIZE_EASYLOGGINGPP
|
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"
|
#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;
|
using namespace epee;
|
||||||
|
@ -83,7 +82,10 @@ void mlog_configure(const std::string &filename_base, bool console)
|
||||||
el::Configurations c;
|
el::Configurations c;
|
||||||
c.setGlobally(el::ConfigurationType::Filename, filename_base);
|
c.setGlobally(el::ConfigurationType::Filename, filename_base);
|
||||||
c.setGlobally(el::ConfigurationType::ToFile, "true");
|
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::ToStandardOutput, console ? "true" : "false");
|
||||||
c.setGlobally(el::ConfigurationType::MaxLogFileSize, "104850000"); // 100 MB - 7600 bytes
|
c.setGlobally(el::ConfigurationType::MaxLogFileSize, "104850000"); // 100 MB - 7600 bytes
|
||||||
el::Loggers::setDefaultConfigurations(c, true);
|
el::Loggers::setDefaultConfigurations(c, true);
|
||||||
|
|
Loading…
Reference in a new issue