summaryrefslogtreecommitdiff
path: root/src/third_party/s2/base
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-08-05 14:32:45 -0400
committerBenety Goh <benety@mongodb.com>2014-08-12 18:56:41 -0400
commita3845092f26955e6cbfca868fd136b7d5eefed9b (patch)
treedfb566b50a00b8c64002e6107d9fcbdb1443c6cf /src/third_party/s2/base
parent0ea8cf462b48a1aeefb10fd4bba0b1e93b0e661e (diff)
downloadmongo-a3845092f26955e6cbfca868fd136b7d5eefed9b.tar.gz
SERVER-14729 logging cleanup - removed mongo/util/log.h from headers, de-inlining functions that use logging where applicable.
de-inlined BSONElement::_asCode() de-inlined BSONObjBuilder::appendDate() de-inlined DBClientCursor::nextSafe() de-inlined IndexDescriptor::_checkOk() de-inlined LastErrorHolder::getSafe() de-inlined UpdateResult constructor de-inlined QueryPlannerCommon::reverseScans() de-inlined repl::ScopedConn::connect() de-inlined repl::_MultiCommand::run() de-inlined OplogReader::tailCheck() de-inlined repl::StateBox::change() de-inlined repl::SyncSourceFeedback::_resetConnection() de-inlined DiskLoc56Bit::operator=() de-inlined DurableInterface::~DurableInterface() de-inlined ListeningSockets::closeAll() de-inlined RelativePath::fromFullPath() and getPartition() de-inlined V8Scope::checkV8ErrorState and removed debug log message from ObjTracker destructor (v8-3.25) de-inlined V8Scope::checkV8ErrorState and removed debug log message from ObjTracker destructor removed log message from List1::orphan() - this should have no user-facing impact because List1::orphan() is used in tests only removed log message from RWLockRecursiveNongreedy::Lock() removed log message from RSBase destructor removed log.h dependency from DESTRUCTOR_GUARD macro removed mongo/util/log.h dependency from qlog.h removed mongo/util/log.h dependency from stacktrace.h removed mongo/util/log.h dependency from s2 logging header removed mongo/util/log.h dependency from chunk_diff-inl.cpp removed mongo/util/log.h from pch.h removed unused mongo/util/log.h include from inlined file sorter.cpp convert HashTable<K,V> to non-template NamespaceHashTable. De-inlined NamespaceHashTable::_find() and constructor convert isself getMyAddrs()and getallIPs() debug log to use LOG() macro assign default log component MONGO_LOG_DEFAULT_COMPONENT removed unused macros LOGATMOST and LOGSOME removed unused FLOG() macro from goodies.h
Diffstat (limited to 'src/third_party/s2/base')
-rwxr-xr-xsrc/third_party/s2/base/logging.cc3
-rwxr-xr-xsrc/third_party/s2/base/logging.h22
2 files changed, 22 insertions, 3 deletions
diff --git a/src/third_party/s2/base/logging.cc b/src/third_party/s2/base/logging.cc
index e8382e9711b..0c918bd5406 100755
--- a/src/third_party/s2/base/logging.cc
+++ b/src/third_party/s2/base/logging.cc
@@ -14,8 +14,11 @@
#include "logging.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
+LogMessageInfo::LogMessageInfo() : _lsb(mongo::log()) { }
+
LogMessageFatal::LogMessageFatal(const char* file, int line) :
_lsb(mongo::severe()) {
_lsb.setBaseMessage(mongoutils::str::stream() << file << ':' << line << ": ");
diff --git a/src/third_party/s2/base/logging.h b/src/third_party/s2/base/logging.h
index b237090b3f1..19b4913855b 100755
--- a/src/third_party/s2/base/logging.h
+++ b/src/third_party/s2/base/logging.h
@@ -16,7 +16,10 @@
#include <iosfwd>
-#include "mongo/util/log.h"
+#include "mongo/logger/log_severity.h"
+#include "mongo/logger/logger.h"
+#include "mongo/logger/logstream_builder.h"
+#include "mongo/util/concurrency/thread_name.h"
#include "macros.h"
@@ -50,13 +53,26 @@
#endif
#include "base/port.h"
-#define INFO mongo::log().stream()
+#define INFO LogMessageInfo().stream()
#define FATAL LogMessageFatal(__FILE__, __LINE__).stream()
#define DFATAL LogMessageFatal(__FILE__, __LINE__).stream()
// VLOG messages will be logged at debug level 5 with the S2 log component.
#define S2LOG(x) x
-#define VLOG(x) MONGO_LOG_COMPONENT(::mongo::logger::LogSeverity::Debug(5), ::mongo::logger::LogComponent::kS2)
+// Expansion of MONGO_LOG_COMPONENT defined in mongo/util/log.h
+#define VLOG(x) \
+ if (!(::mongo::logger::globalLogDomain())->shouldLog(::mongo::logger::LogComponent::kS2, ::mongo::logger::LogSeverity::Debug(5))) {} \
+ else ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), ::mongo::getThreadName(), ::mongo::logger::LogSeverity::Debug(5), ::mongo::logger::LogComponent::kS2)
+
+class LogMessageInfo {
+ public:
+ LogMessageInfo();
+ std::ostream& stream() { return _lsb.stream(); }
+
+ private:
+ mongo::logger::LogstreamBuilder _lsb;
+ DISALLOW_COPY_AND_ASSIGN(LogMessageInfo);
+};
class LogMessageFatal {
public: