summaryrefslogtreecommitdiff
path: root/src/mongo/platform
diff options
context:
space:
mode:
authorGabriel Russell <gabriel.russell@mongodb.com>2020-02-20 12:23:12 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-20 21:25:37 +0000
commitc7f41ef10eefdd8abb5a671a0046f55af310705c (patch)
treeaf697623e733b153d3d190f8f1fc90fccb3f54c2 /src/mongo/platform
parent11bfeda8152267fa95bc63b4e93723845737217f (diff)
downloadmongo-c7f41ef10eefdd8abb5a671a0046f55af310705c.tar.gz
SERVER-45869 more automatically converted structured
Diffstat (limited to 'src/mongo/platform')
-rw-r--r--src/mongo/platform/random.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/mongo/platform/random.cpp b/src/mongo/platform/random.cpp
index 9ed392adf1c..fafb8f9d8ea 100644
--- a/src/mongo/platform/random.cpp
+++ b/src/mongo/platform/random.cpp
@@ -51,6 +51,7 @@
#include <memory>
#include <random>
+#include "mongo/logv2/log.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
@@ -95,9 +96,10 @@ public:
auto ntstatus = ::BCryptOpenAlgorithmProvider(
&_algHandle, BCRYPT_RNG_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
if (ntstatus != STATUS_SUCCESS) {
- error() << "Failed to open crypto algorithm provider while creating secure random "
- "object; NTSTATUS: "
- << ntstatus;
+ LOGV2_ERROR(23822,
+ "Failed to open crypto algorithm provider while creating secure random "
+ "object; NTSTATUS: {ntstatus}",
+ "ntstatus"_attr = ntstatus);
fassertFailed(28815);
}
}
@@ -105,17 +107,20 @@ public:
~Source() {
auto ntstatus = ::BCryptCloseAlgorithmProvider(_algHandle, 0);
if (ntstatus != STATUS_SUCCESS) {
- warning() << "Failed to close crypto algorithm provider destroying secure random "
- "object; NTSTATUS: "
- << ntstatus;
+ LOGV2_WARNING(23821,
+ "Failed to close crypto algorithm provider destroying secure random "
+ "object; NTSTATUS: {ntstatus}",
+ "ntstatus"_attr = ntstatus);
}
}
size_t refill(uint8_t* buf, size_t n) {
auto ntstatus = ::BCryptGenRandom(_algHandle, reinterpret_cast<PUCHAR>(buf), n, 0);
if (ntstatus != STATUS_SUCCESS) {
- error() << "Failed to generate random number from secure random object; NTSTATUS: "
- << ntstatus;
+ LOGV2_ERROR(
+ 23823,
+ "Failed to generate random number from secure random object; NTSTATUS: {ntstatus}",
+ "ntstatus"_attr = ntstatus);
fassertFailed(28814);
}
return n;
@@ -138,7 +143,10 @@ public:
continue;
} else {
auto errSave = errno;
- error() << "SecureRandom: read `" << kFn << "`: " << strerror(errSave);
+ LOGV2_ERROR(23824,
+ "SecureRandom: read `{kFn}`: {strerror_errSave}",
+ "kFn"_attr = kFn,
+ "strerror_errSave"_attr = strerror(errSave));
fassertFailed(28840);
}
}
@@ -160,7 +168,10 @@ private:
continue;
} else {
auto errSave = errno;
- error() << "SecureRandom: open `" << kFn << "`: " << strerror(errSave);
+ LOGV2_ERROR(23825,
+ "SecureRandom: open `{kFn}`: {strerror_errSave}",
+ "kFn"_attr = kFn,
+ "strerror_errSave"_attr = strerror(errSave));
fassertFailed(28839);
}
}