diff options
Diffstat (limited to 'src/mongo/shell/dbshell.cpp')
-rw-r--r-- | src/mongo/shell/dbshell.cpp | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp index 89616e477f5..946e1e10782 100644 --- a/src/mongo/shell/dbshell.cpp +++ b/src/mongo/shell/dbshell.cpp @@ -195,9 +195,8 @@ public: /** * Formatter to provide specialized formatting for logs from javascript engine */ -class ShellFormatter final : private logv2::TextFormatter, private logv2::JSONFormatter { +class ShellFormatter final : private logv2::PlainFormatter, private logv2::JSONFormatter { public: - ShellFormatter(bool isJson) : _isJson(isJson) {} void operator()(boost::log::record_view const& rec, boost::log::formatting_ostream& strm) { using namespace logv2; using boost::log::extract; @@ -205,16 +204,9 @@ public: if (extract<LogTag>(attributes::tags(), rec).get().has(LogTag::kPlainShell)) { PlainFormatter::operator()(rec, strm); } else { - if (_isJson) { - JSONFormatter::operator()(rec, strm); - } else { - TextFormatter::operator()(rec, strm); - } + JSONFormatter::operator()(rec, strm); } } - -private: - bool _isJson; }; } // namespace @@ -792,12 +784,7 @@ int _main(int argc, char* argv[], char** envp) { auto consoleSink = boost::make_shared<boost::log::sinks::synchronous_sink<ShellBackend>>(); consoleSink->set_filter(logv2::ComponentSettingsFilter(lv2Manager.getGlobalDomain(), lv2Manager.getGlobalSettings())); -#if defined(MONGO_CONFIG_TEXT_LOG_DEFAULT) - bool isJson = shellGlobalParams.logFormat == logv2::LogFormat::kJson; -#else - bool isJson = shellGlobalParams.logFormat != logv2::LogFormat::kText; -#endif - consoleSink->set_formatter(ShellFormatter(isJson)); + consoleSink->set_formatter(ShellFormatter()); consoleSink->locked_backend()->add_stream( boost::shared_ptr<std::ostream>(&logv2::Console::out(), boost::null_deleter())); |