aboutsummaryrefslogtreecommitdiff
path: root/external/easylogging++/easylogging++.cc
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-03-25 19:42:12 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-04-10 21:05:22 +0100
commit5bab044984be78e5e71cf5e0b7f1ef043f6091b1 (patch)
tree85520c1bfc81902c23b35b68803fe606c82a5057 /external/easylogging++/easylogging++.cc
parenteayslogging++: Fix bad memory access before opening any files (diff)
downloadmonero-5bab044984be78e5e71cf5e0b7f1ef043f6091b1.tar.xz
easylogging++: add file-only logs
Diffstat (limited to 'external/easylogging++/easylogging++.cc')
-rw-r--r--external/easylogging++/easylogging++.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/external/easylogging++/easylogging++.cc b/external/easylogging++/easylogging++.cc
index f40658096..1fca50678 100644
--- a/external/easylogging++/easylogging++.cc
+++ b/external/easylogging++/easylogging++.cc
@@ -2183,11 +2183,11 @@ void Storage::setApplicationArguments(int argc, char** argv) {
void DefaultLogDispatchCallback::handle(const LogDispatchData* data) {
m_data = data;
dispatch(m_data->logMessage()->logger()->logBuilder()->build(m_data->logMessage(),
- m_data->dispatchAction() == base::DispatchAction::NormalLog));
+ m_data->dispatchAction() == base::DispatchAction::NormalLog || m_data->dispatchAction() == base::DispatchAction::FileOnlyLog));
}
void DefaultLogDispatchCallback::dispatch(base::type::string_t&& logLine) {
- if (m_data->dispatchAction() == base::DispatchAction::NormalLog) {
+ if (m_data->dispatchAction() == base::DispatchAction::NormalLog || m_data->dispatchAction() == base::DispatchAction::FileOnlyLog) {
if (m_data->logMessage()->logger()->m_typedConfigurations->toFile(m_data->logMessage()->level())) {
base::type::fstream_t* fs = m_data->logMessage()->logger()->m_typedConfigurations->fileStream(
m_data->logMessage()->level());
@@ -2210,10 +2210,12 @@ void DefaultLogDispatchCallback::dispatch(base::type::string_t&& logLine) {
<< m_data->logMessage()->logger()->id() << "]", false);
}
}
- if (m_data->logMessage()->logger()->m_typedConfigurations->toStandardOutput(m_data->logMessage()->level())) {
- if (ELPP->hasFlag(LoggingFlag::ColoredTerminalOutput))
- m_data->logMessage()->logger()->logBuilder()->convertToColoredOutput(&logLine, m_data->logMessage()->level());
- ELPP_COUT << ELPP_COUT_LINE(logLine);
+ if (m_data->dispatchAction() != base::DispatchAction::FileOnlyLog) {
+ if (m_data->logMessage()->logger()->m_typedConfigurations->toStandardOutput(m_data->logMessage()->level())) {
+ if (ELPP->hasFlag(LoggingFlag::ColoredTerminalOutput))
+ m_data->logMessage()->logger()->logBuilder()->convertToColoredOutput(&logLine, m_data->logMessage()->level());
+ ELPP_COUT << ELPP_COUT_LINE(logLine);
+ }
}
}
#if defined(ELPP_SYSLOG)
@@ -2249,8 +2251,8 @@ void DefaultLogDispatchCallback::dispatch(base::type::string_t&& logLine) {
void AsyncLogDispatchCallback::handle(const LogDispatchData* data) {
base::type::string_t logLine = data->logMessage()->logger()->logBuilder()->build(data->logMessage(),
- data->dispatchAction() == base::DispatchAction::NormalLog);
- if (data->dispatchAction() == base::DispatchAction::NormalLog
+ data->dispatchAction() == base::DispatchAction::NormalLog || data->dispatchAction() == base::DispatchAction::FileOnlyLog);
+ if ((data->dispatchAction() == base::DispatchAction::NormalLog || data->dispatchAction() == base::DispatchAction::FileOnlyLog)
&& data->logMessage()->logger()->typedConfigurations()->toStandardOutput(data->logMessage()->level())) {
if (ELPP->hasFlag(LoggingFlag::ColoredTerminalOutput))
data->logMessage()->logger()->logBuilder()->convertToColoredOutput(&logLine, data->logMessage()->level());
@@ -2305,7 +2307,7 @@ void AsyncDispatchWorker::handle(AsyncLogItem* logItem) {
Logger* logger = logMessage->logger();
base::TypedConfigurations* conf = logger->typedConfigurations();
base::type::string_t logLine = logItem->logLine();
- if (data->dispatchAction() == base::DispatchAction::NormalLog) {
+ if (data->dispatchAction() == base::DispatchAction::NormalLog || data->dispatchAction() == base::DispatchAction::FileOnlyLog) {
if (conf->toFile(logMessage->level())) {
base::type::fstream_t* fs = conf->fileStream(logMessage->level());
if (fs != nullptr) {