summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2021-02-16 01:15:53 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-18 04:03:22 +0000
commitfad9de4ece9f5399acc804f206e40621930be5af (patch)
tree0a1dd3202e0d8ad0cc93a58c03d3519fba2abd23
parent61df6d3c9a0a6658613d2ef9bcfb28bd14224acf (diff)
downloadmongo-fad9de4ece9f5399acc804f206e40621930be5af.tar.gz
SERVER-54596 remove 1-arg shouldLog function (an ODR violation)
-rw-r--r--src/mongo/db/matcher/schema/json_schema_parser.cpp3
-rw-r--r--src/mongo/db/repl/isself.cpp4
-rw-r--r--src/mongo/db/service_entry_point_common.cpp2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp2
-rw-r--r--src/mongo/logv2/log.h5
-rw-r--r--src/mongo/scripting/mozjs/engine.cpp4
-rw-r--r--src/mongo/scripting/mozjs/implscope.cpp2
-rw-r--r--src/mongo/util/net/sock.cpp3
8 files changed, 11 insertions, 14 deletions
diff --git a/src/mongo/db/matcher/schema/json_schema_parser.cpp b/src/mongo/db/matcher/schema/json_schema_parser.cpp
index c972c05c602..df73cced7a7 100644
--- a/src/mongo/db/matcher/schema/json_schema_parser.cpp
+++ b/src/mongo/db/matcher/schema/json_schema_parser.cpp
@@ -1870,7 +1870,8 @@ StatusWithMatchExpression JSONSchemaParser::parse(
"schema"_attr = schema.jsonString(JsonStringFormat::LegacyStrict));
try {
auto translation = _parse(expCtx, ""_sd, schema, allowedFeatures, ignoreUnknownKeywords);
- if (shouldLog(logv2::LogSeverity::Debug(5)) && translation.isOK()) {
+ if (shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, logv2::LogSeverity::Debug(5)) &&
+ translation.isOK()) {
LOGV2_DEBUG(20729,
5,
"Translated schema match expression: {expression}",
diff --git a/src/mongo/db/repl/isself.cpp b/src/mongo/db/repl/isself.cpp
index 98d4f1cef78..adb93ac45a9 100644
--- a/src/mongo/db/repl/isself.cpp
+++ b/src/mongo/db/repl/isself.cpp
@@ -149,7 +149,7 @@ std::vector<std::string> getAddrsForHost(const std::string& iporhost,
}
}
- if (shouldLog(logv2::LogSeverity::Debug(2))) {
+ if (shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, logv2::LogSeverity::Debug(2))) {
LOGV2_DEBUG(21205,
2,
"getAddrsForHost()",
@@ -397,7 +397,7 @@ std::vector<std::string> getBoundAddrs(const bool ipv6enabled) {
#endif // defined(_WIN32)
- if (shouldLog(logv2::LogSeverity::Debug(2))) {
+ if (shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, logv2::LogSeverity::Debug(2))) {
LOGV2_DEBUG(21206, 2, "getBoundAddrs()", "result"_attr = out);
}
return out;
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 164a07dbb2d..0abb6b54bc9 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -1958,7 +1958,7 @@ void receivedKillCursors(OperationContext* opCtx, const Message& m) {
const char* cursorArray = dbmessage.getArray(n);
int found = runOpKillCursors(opCtx, static_cast<size_t>(n), cursorArray);
- if (shouldLog(logv2::LogSeverity::Debug(1)) || found != n) {
+ if (shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, logv2::LogSeverity::Debug(1)) || found != n) {
LOGV2_DEBUG(21967,
found == n ? 1 : 0,
"killCursors: found {found} of {numCursors}",
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
index 738c2d432e8..6e47bba47fc 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
@@ -565,7 +565,7 @@ void WiredTigerRecoveryUnit::_txnOpen() {
_ensureSession();
// Only start a timer for transaction's lifetime if we're going to log it.
- if (shouldLog(kSlowTransactionSeverity)) {
+ if (shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, kSlowTransactionSeverity)) {
_timer.reset(new Timer());
}
WT_SESSION* session = _session->getSession();
diff --git a/src/mongo/logv2/log.h b/src/mongo/logv2/log.h
index 38bc39cfda3..7cfe6aa4ec3 100644
--- a/src/mongo/logv2/log.h
+++ b/src/mongo/logv2/log.h
@@ -299,11 +299,6 @@ namespace mongo {
FMTSTR_MESSAGE, \
##__VA_ARGS__)
-inline bool shouldLog(logv2::LogSeverity severity) {
- return logv2::LogManager::global().getGlobalSettings().shouldLog(
- MongoLogV2DefaultComponent_component, severity);
-}
-
inline bool shouldLog(logv2::LogComponent logComponent, logv2::LogSeverity severity) {
return logv2::LogManager::global().getGlobalSettings().shouldLog(logComponent, severity);
}
diff --git a/src/mongo/scripting/mozjs/engine.cpp b/src/mongo/scripting/mozjs/engine.cpp
index faad11b70ae..b4069e76ca2 100644
--- a/src/mongo/scripting/mozjs/engine.cpp
+++ b/src/mongo/scripting/mozjs/engine.cpp
@@ -93,7 +93,7 @@ void MozJSScriptEngine::interrupt(unsigned opId) {
OpIdToScopeMap::iterator iScope = _opToScopeMap.find(opId);
if (iScope == _opToScopeMap.end()) {
// got interrupt request for a scope that no longer exists
- if (shouldLog(logv2::LogSeverity::Debug(3))) {
+ if (shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, logv2::LogSeverity::Debug(3))) {
// This log record gets extra attributes when the log severity is at Debug(3)
// but we still log the record at log severity Debug(2). Simplify this if SERVER-48671
// gets done
@@ -107,7 +107,7 @@ void MozJSScriptEngine::interrupt(unsigned opId) {
}
return;
}
- if (shouldLog(logv2::LogSeverity::Debug(3))) {
+ if (shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, logv2::LogSeverity::Debug(3))) {
// Like above, this log record gets extra attributes when the log severity is at Debug(3)
LOGV2_DEBUG(22809, 2, "Interrupting op", "opId"_attr = opId, "knownOps"_attr = knownOps());
} else {
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp
index 3834fff7629..097ecd1304a 100644
--- a/src/mongo/scripting/mozjs/implscope.cpp
+++ b/src/mongo/scripting/mozjs/implscope.cpp
@@ -233,7 +233,7 @@ bool MozJSImplScope::_interruptCallback(JSContext* cx) {
}
void MozJSImplScope::_gcCallback(JSContext* rt, JSGCStatus status, void* data) {
- if (!shouldLog(logv2::LogSeverity::Debug(1))) {
+ if (!shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, logv2::LogSeverity::Debug(1))) {
// don't collect stats unless verbose
return;
}
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index d299512f48a..e4fecc5b23c 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -116,7 +116,8 @@ void networkWarnWithDescription(const Socket& socket, StringData call, int error
const double kMaxConnectTimeoutMS = 5000;
void setSockTimeouts(int sock, double secs) {
- bool report = shouldLog(logv2::LogSeverity::Debug(4)) || kDebugBuild;
+ bool report =
+ shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, logv2::LogSeverity::Debug(4)) || kDebugBuild;
#if defined(_WIN32)
DWORD timeout = secs * 1000; // Windows timeout is a DWORD, in milliseconds.
int status =