summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/framework.cpp2
-rw-r--r--src/mongo/dbtests/jsobjtests.cpp2
-rw-r--r--src/mongo/dbtests/jstests.cpp16
-rw-r--r--src/mongo/dbtests/repltests.cpp6
-rw-r--r--src/mongo/dbtests/threadedtests.cpp2
5 files changed, 13 insertions, 15 deletions
diff --git a/src/mongo/dbtests/framework.cpp b/src/mongo/dbtests/framework.cpp
index 4af0488ad20..4c457fc1072 100644
--- a/src/mongo/dbtests/framework.cpp
+++ b/src/mongo/dbtests/framework.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
#include "mongo/platform/basic.h"
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp
index 091a950c1bb..d7bbac71c8e 100644
--- a/src/mongo/dbtests/jsobjtests.cpp
+++ b/src/mongo/dbtests/jsobjtests.cpp
@@ -31,7 +31,7 @@
* Tests for jsobj.{h,cpp} code
*/
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
#include "mongo/platform/basic.h"
diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp
index 7955260d03d..4244b9bb4dc 100644
--- a/src/mongo/dbtests/jstests.cpp
+++ b/src/mongo/dbtests/jstests.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
#include "mongo/platform/basic.h"
@@ -168,9 +168,7 @@ public:
class LogRecordingScope {
public:
LogRecordingScope()
- : _logged(false),
- _threadName(mongo::getThreadName().toString()),
- _handle(mongo::logger::globalLogDomain()->attachAppender(std::make_unique<Tee>(this))) {}
+ : _handle(mongo::logger::globalLogDomain()->attachAppender(std::make_unique<Tee>(this))) {}
~LogRecordingScope() {
mongo::logger::globalLogDomain()->detachAppender(_handle);
}
@@ -180,11 +178,10 @@ public:
}
private:
- class Tee : public mongo::logger::MessageLogDomain::EventAppender {
+ class Tee : public mongo::logger::Appender<mongo::logger::MessageEventEphemeral> {
public:
Tee(LogRecordingScope* scope) : _scope(scope) {}
- virtual ~Tee() {}
- virtual Status append(const logger::MessageEventEphemeral& event) {
+ Status append(const logger::MessageEventEphemeral& event) override {
// Don't want to consider logging by background threads.
if (mongo::getThreadName() == _scope->_threadName) {
_scope->_logged = true;
@@ -195,8 +192,9 @@ private:
private:
LogRecordingScope* _scope;
};
- bool _logged;
- const string _threadName;
+
+ bool _logged = false;
+ const string _threadName = mongo::getThreadName().toString();
mongo::logger::MessageLogDomain::AppenderHandle _handle;
};
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index b552398ef83..218f819c68d 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
#include "mongo/platform/basic.h"
@@ -56,8 +56,8 @@ using namespace mongo::repl;
namespace ReplTests {
using mongo::logger::globalLogDomain;
-using mongo::logger::LogComponent;
-using mongo::logger::LogSeverity;
+using mongo::logv2::LogComponent;
+using mongo::logv2::LogSeverity;
using std::endl;
using std::string;
using std::stringstream;
diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp
index 6afeb2283a9..27cdfc95df7 100644
--- a/src/mongo/dbtests/threadedtests.cpp
+++ b/src/mongo/dbtests/threadedtests.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
#include "mongo/platform/basic.h"