summaryrefslogtreecommitdiff
path: root/src/mongo/logv2/text_formatter.h
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2019-11-19 21:44:48 +0000
committerevergreen <evergreen@mongodb.com>2019-11-19 21:44:48 +0000
commit2810db8896aef992209ba13563104ed4d12c53a0 (patch)
tree6396655d59a2616339b2deb14e7eb5f5d09ccf47 /src/mongo/logv2/text_formatter.h
parentebbc4ed166c5f5aec7700e44b47b1c5879917c61 (diff)
downloadmongo-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.h27
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