aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/src/mlog.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-04-01 11:29:43 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-04-01 11:29:43 +0100
commit62efe5f656d4f5a3f51880f16758f932102230cf (patch)
tree4b73fdbb53d5442b2a1845bba6d331d91ade845a /contrib/epee/src/mlog.cpp
parentMerge pull request #1930 (diff)
downloadmonero-62efe5f656d4f5a3f51880f16758f932102230cf.tar.xz
mlog: direct log category changes to file only
Because some people just won't even try to read what is written and freak out because the word FATAL is in here, despite the context making it clear it's not an error.
Diffstat (limited to 'contrib/epee/src/mlog.cpp')
-rw-r--r--contrib/epee/src/mlog.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/epee/src/mlog.cpp b/contrib/epee/src/mlog.cpp
index 205acccc9..7487fdbd2 100644
--- a/contrib/epee/src/mlog.cpp
+++ b/contrib/epee/src/mlog.cpp
@@ -33,8 +33,13 @@
INITIALIZE_EASYLOGGINGPP
+#undef MONERO_DEFAULT_LOG_CATEGORY
+#define MONERO_DEFAULT_LOG_CATEGORY "logging"
+
#define MLOG_BASE_FORMAT "%datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%loc\t%msg"
+#define MLOG_LOG(x) CINFO(el::base::Writer,el::base::DispatchAction::FileOnlyLog,MONERO_DEFAULT_LOG_CATEGORY) << x
+
using namespace epee;
static std::string generate_log_filename(const char *base)
@@ -88,10 +93,10 @@ static const char *get_default_categories(int level)
switch (level)
{
case 0:
- categories = "*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO";
+ categories = "*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO";
break;
case 1:
- categories = "*:WARNING,global:INFO,stacktrace:INFO";
+ categories = "*:WARNING,global:INFO,stacktrace:INFO,logging:INFO";
break;
case 2:
categories = "*:DEBUG";
@@ -142,7 +147,7 @@ void mlog_configure(const std::string &filename_base, bool console)
void mlog_set_categories(const char *categories)
{
el::Loggers::setCategories(categories);
- MGINFO("New log categories: " << categories);
+ MLOG_LOG("New log categories: " << categories);
}
// maps epee style log level to new logging system
@@ -150,7 +155,7 @@ void mlog_set_log_level(int level)
{
const char *categories = get_default_categories(level);
el::Loggers::setCategories(categories);
- MGINFO("New log categories: " << categories);
+ MLOG_LOG("New log categories: " << categories);
}
void mlog_set_log(const char *log)