diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2019-11-19 21:44:48 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-11-19 21:44:48 +0000 |
commit | 2810db8896aef992209ba13563104ed4d12c53a0 (patch) | |
tree | 6396655d59a2616339b2deb14e7eb5f5d09ccf47 /src/mongo/logv2/text_formatter.h | |
parent | ebbc4ed166c5f5aec7700e44b47b1c5879917c61 (diff) | |
download | mongo-2810db8896aef992209ba13563104ed4d12c53a0.tar.gz |
SERVER-44556 Move logging formatters into cpp files.
Diffstat (limited to 'src/mongo/logv2/text_formatter.h')
-rw-r--r-- | src/mongo/logv2/text_formatter.h | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/src/mongo/logv2/text_formatter.h b/src/mongo/logv2/text_formatter.h index 017dbdc34b0..ccc61ffb0e0 100644 --- a/src/mongo/logv2/text_formatter.h +++ b/src/mongo/logv2/text_formatter.h @@ -31,8 +31,7 @@ #include "mongo/logv2/plain_formatter.h" -namespace mongo { -namespace logv2 { +namespace mongo::logv2 { class TextFormatter : protected PlainFormatter { public: @@ -40,27 +39,7 @@ public: return false; }; - void operator()(boost::log::record_view const& rec, - boost::log::formatting_ostream& strm) const { - using namespace boost::log; - - fmt::memory_buffer buffer; - fmt::format_to( - buffer, - "{} {:<2} {:<8} [{}] ", - extract<Date_t>(attributes::timeStamp(), rec).get().toString(), - extract<LogSeverity>(attributes::severity(), rec).get().toStringDataCompact(), - extract<LogComponent>(attributes::component(), rec).get().getNameForLog(), - extract<StringData>(attributes::threadName(), rec).get()); - strm.write(buffer.data(), buffer.size()); - - if (extract<LogTag>(attributes::tags(), rec).get().has(LogTag::kStartupWarnings)) { - strm << "** WARNING: "; - } - - PlainFormatter::operator()(rec, strm); - } + void operator()(boost::log::record_view const& rec, boost::log::formatting_ostream& strm) const; }; -} // namespace logv2 -} // namespace mongo +} // namespace mongo::logv2 |