diff --git a/client/clientOnly.cpp b/client/clientOnly.cpp index 5c3b5dbac56..1105eda1103 100644 --- a/client/clientOnly.cpp +++ b/client/clientOnly.cpp @@ -3,6 +3,9 @@ namespace mongo { const char * curNs = "in client mode"; + + bool quiet = false; + // Database* database = 0; void dbexit(int returnCode, const char *whyMsg ) { diff --git a/db/db.cpp b/db/db.cpp index fa069e70706..f03ca04b575 100644 --- a/db/db.cpp +++ b/db/db.cpp @@ -198,7 +198,7 @@ namespace mongo { m.reset(); if ( !dbMsgPort.recv(m) ) { - log() << "end connection " << dbMsgPort.farEnd.toString() << endl; + lognoquiet() << "end connection " << dbMsgPort.farEnd.toString() << endl; dbMsgPort.shutdown(); break; } diff --git a/s/server.cpp b/s/server.cpp index 8b002d76122..4dc758bf370 100644 --- a/s/server.cpp +++ b/s/server.cpp @@ -33,7 +33,7 @@ namespace mongo { const char *curNs = ""; Database *database = 0; string ourHostname; - + bool quiet = false; OID serverID; diff --git a/util/log.h b/util/log.h index 5f8d7589f87..58d43117eeb 100644 --- a/util/log.h +++ b/util/log.h @@ -20,6 +20,8 @@ namespace mongo { + extern bool quiet; + // Utility interface for stringifying object only when val() called. class LazyString { public: @@ -182,8 +184,15 @@ namespace mongo { return logstream.prolog(); } + inline Nullstream& lognoquiet(){ + if ( quiet ) + return nullstream; + return log(); + } + inline ostream& stdcout() { return cout; } + } // namespace mongo diff --git a/util/message.cpp b/util/message.cpp index 533617cd6ff..f560508dae3 100644 --- a/util/message.cpp +++ b/util/message.cpp @@ -83,7 +83,7 @@ namespace mongo { continue; } disableNagle(s); - log() << "connection accepted from " << from.toString() << endl; + lognoquiet() << "connection accepted from " << from.toString() << endl; accepted( new MessagingPort(s, from) ); } }