From 91def9a59b7b6e252dba4a0a4dd559ad81be2b0d Mon Sep 17 00:00:00 2001 From: selsta Date: Sun, 17 Sep 2017 04:42:45 +0200 Subject: daemon, wallet: add --max-log-file-size option --- contrib/epee/include/misc_log_ex.h | 3 ++- contrib/epee/src/mlog.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'contrib/epee') diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h index ec4bcbe2d..d351b024d 100644 --- a/contrib/epee/include/misc_log_ex.h +++ b/contrib/epee/include/misc_log_ex.h @@ -52,6 +52,7 @@ #include "easylogging++.h" #define MONERO_DEFAULT_LOG_CATEGORY "default" +#define MAX_LOG_FILE_SIZE 104850000 // 100 MB - 7600 bytes #define MCFATAL(cat,x) CLOG(FATAL,cat) << x #define MCERROR(cat,x) CLOG(ERROR,cat) << x @@ -123,7 +124,7 @@ #endif std::string mlog_get_default_log_path(const char *default_filename); -void mlog_configure(const std::string &filename_base, bool console); +void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size = MAX_LOG_FILE_SIZE); void mlog_set_categories(const char *categories); void mlog_set_log_level(int level); void mlog_set_log(const char *log); diff --git a/contrib/epee/src/mlog.cpp b/contrib/epee/src/mlog.cpp index a3f38e677..964ba41df 100644 --- a/contrib/epee/src/mlog.cpp +++ b/contrib/epee/src/mlog.cpp @@ -111,7 +111,7 @@ static const char *get_default_categories(int level) return categories; } -void mlog_configure(const std::string &filename_base, bool console) +void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size) { el::Configurations c; c.setGlobally(el::ConfigurationType::Filename, filename_base); @@ -121,7 +121,7 @@ void mlog_configure(const std::string &filename_base, bool console) 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 + c.setGlobally(el::ConfigurationType::MaxLogFileSize, std::to_string(max_log_file_size)); el::Loggers::setDefaultConfigurations(c, true); el::Loggers::addFlag(el::LoggingFlag::HierarchicalLogging); -- cgit v1.2.3