diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-04-16 22:45:02 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-04-16 22:45:02 +0200 |
commit | 213fd5007dfa305e94a94116e155d196fb82d6ac (patch) | |
tree | 52f1b69c32a01b2a63d01eea6a43696699b923a3 /external/easylogging++ | |
parent | Merge pull request #5441 (diff) | |
parent | easylogging++: minimal stdout logging format (diff) | |
download | monero-213fd5007dfa305e94a94116e155d196fb82d6ac.tar.xz |
Merge pull request #5442
428249c5 easylogging++: minimal stdout logging format (moneromooo-monero)
Diffstat (limited to 'external/easylogging++')
-rw-r--r-- | external/easylogging++/easylogging++.cc | 25 | ||||
-rw-r--r-- | external/easylogging++/easylogging++.h | 2 |
2 files changed, 22 insertions, 5 deletions
diff --git a/external/easylogging++/easylogging++.cc b/external/easylogging++/easylogging++.cc index 43d37feac..5a806dc69 100644 --- a/external/easylogging++/easylogging++.cc +++ b/external/easylogging++/easylogging++.cc @@ -2342,6 +2342,19 @@ base::threading::Mutex& LogDispatchCallback::fileHandle(const LogDispatchData* d namespace base { // DefaultLogDispatchCallback +const char* convertToChar(Level level) { + // Do not use switch over strongly typed enums because Intel C++ compilers dont support them yet. + if (level == Level::Global) return "G"; + if (level == Level::Debug) return "D"; + if (level == Level::Info) return "I"; + if (level == Level::Warning) return "W"; + if (level == Level::Error) return "E"; + if (level == Level::Fatal) return "F"; + if (level == Level::Verbose) return "V"; + if (level == Level::Trace) return "T"; + return "?"; +} + void DefaultLogDispatchCallback::handle(const LogDispatchData* data) { #if defined(ELPP_THREAD_SAFE) #if 0 @@ -2350,11 +2363,15 @@ void DefaultLogDispatchCallback::handle(const LogDispatchData* data) { #endif #endif m_data = data; - dispatch(m_data->logMessage()->logger()->logBuilder()->build(m_data->logMessage(), + base::TypedConfigurations* tc = m_data->logMessage()->logger()->typedConfigurations(); + const base::LogFormat* logFormat = &tc->logFormat(m_data->logMessage()->level()); + dispatch(base::utils::DateTime::getDateTime(logFormat->dateTimeFormat().c_str(), &tc->subsecondPrecision(m_data->logMessage()->level())) + + "\t" + convertToChar(m_data->logMessage()->level()) + " " + m_data->logMessage()->message() + "\n", + m_data->logMessage()->logger()->logBuilder()->build(m_data->logMessage(), m_data->dispatchAction() == base::DispatchAction::NormalLog || m_data->dispatchAction() == base::DispatchAction::FileOnlyLog)); } -void DefaultLogDispatchCallback::dispatch(base::type::string_t&& logLine) { +void DefaultLogDispatchCallback::dispatch(base::type::string_t&& rawLine, base::type::string_t&& logLine) { 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( @@ -2381,8 +2398,8 @@ void DefaultLogDispatchCallback::dispatch(base::type::string_t&& 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); + m_data->logMessage()->logger()->logBuilder()->convertToColoredOutput(&rawLine, m_data->logMessage()->level()); + ELPP_COUT << ELPP_COUT_LINE(rawLine); } } } diff --git a/external/easylogging++/easylogging++.h b/external/easylogging++/easylogging++.h index 6646d2cb5..f0d8d5df7 100644 --- a/external/easylogging++/easylogging++.h +++ b/external/easylogging++/easylogging++.h @@ -2777,7 +2777,7 @@ class DefaultLogDispatchCallback : public LogDispatchCallback { void handle(const LogDispatchData* data); private: const LogDispatchData* m_data; - void dispatch(base::type::string_t&& logLine); + void dispatch(base::type::string_t&& rawLine, base::type::string_t&& logLine); }; #if ELPP_ASYNC_LOGGING class AsyncLogDispatchCallback : public LogDispatchCallback { |