From c7f41ef10eefdd8abb5a671a0046f55af310705c Mon Sep 17 00:00:00 2001 From: Gabriel Russell Date: Thu, 20 Feb 2020 12:23:12 -0500 Subject: SERVER-45869 more automatically converted structured --- src/mongo/util/processinfo_windows.cpp | 43 ++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'src/mongo/util/processinfo_windows.cpp') diff --git a/src/mongo/util/processinfo_windows.cpp b/src/mongo/util/processinfo_windows.cpp index c8bdb2b633a..dd73eb49f81 100644 --- a/src/mongo/util/processinfo_windows.cpp +++ b/src/mongo/util/processinfo_windows.cpp @@ -37,6 +37,7 @@ #include #include +#include "mongo/logv2/log.h" #include "mongo/util/log.h" #include "mongo/util/processinfo.h" @@ -72,7 +73,9 @@ int ProcessInfo::getVirtualMemorySize() { BOOL status = GlobalMemoryStatusEx(&mse); if (!status) { DWORD gle = GetLastError(); - error() << "GlobalMemoryStatusEx failed with " << errnoWithDescription(gle); + LOGV2_ERROR(23812, + "GlobalMemoryStatusEx failed with {errnoWithDescription_gle}", + "errnoWithDescription_gle"_attr = errnoWithDescription(gle)); fassert(28621, status); } @@ -86,7 +89,9 @@ int ProcessInfo::getResidentSize() { BOOL status = GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); if (!status) { DWORD gle = GetLastError(); - error() << "GetProcessMemoryInfo failed with " << errnoWithDescription(gle); + LOGV2_ERROR(23813, + "GetProcessMemoryInfo failed with {errnoWithDescription_gle}", + "errnoWithDescription_gle"_attr = errnoWithDescription(gle)); fassert(28622, status); } @@ -99,7 +104,9 @@ double ProcessInfo::getSystemMemoryPressurePercentage() { BOOL status = GlobalMemoryStatusEx(&mse); if (!status) { DWORD gle = GetLastError(); - error() << "GlobalMemoryStatusEx failed with " << errnoWithDescription(gle); + LOGV2_ERROR(23814, + "GlobalMemoryStatusEx failed with {errnoWithDescription_gle}", + "errnoWithDescription_gle"_attr = errnoWithDescription(gle)); fassert(28623, status); } @@ -155,16 +162,22 @@ bool getFileVersion(const char* filePath, DWORD& fileVersionMS, DWORD& fileVersi DWORD verSize = GetFileVersionInfoSizeA(filePath, NULL); if (verSize == 0) { DWORD gle = GetLastError(); - warning() << "GetFileVersionInfoSizeA on " << filePath << " failed with " - << errnoWithDescription(gle); + LOGV2_WARNING( + 23807, + "GetFileVersionInfoSizeA on {filePath} failed with {errnoWithDescription_gle}", + "filePath"_attr = filePath, + "errnoWithDescription_gle"_attr = errnoWithDescription(gle)); return false; } std::unique_ptr verData(new char[verSize]); if (GetFileVersionInfoA(filePath, NULL, verSize, verData.get()) == 0) { DWORD gle = GetLastError(); - warning() << "GetFileVersionInfoSizeA on " << filePath << " failed with " - << errnoWithDescription(gle); + LOGV2_WARNING( + 23808, + "GetFileVersionInfoSizeA on {filePath} failed with {errnoWithDescription_gle}", + "filePath"_attr = filePath, + "errnoWithDescription_gle"_attr = errnoWithDescription(gle)); return false; } @@ -172,13 +185,17 @@ bool getFileVersion(const char* filePath, DWORD& fileVersionMS, DWORD& fileVersi VS_FIXEDFILEINFO* verInfo; if (VerQueryValueA(verData.get(), "\\", (LPVOID*)&verInfo, &size) == 0) { DWORD gle = GetLastError(); - warning() << "VerQueryValueA on " << filePath << " failed with " - << errnoWithDescription(gle); + LOGV2_WARNING(23809, + "VerQueryValueA on {filePath} failed with {errnoWithDescription_gle}", + "filePath"_attr = filePath, + "errnoWithDescription_gle"_attr = errnoWithDescription(gle)); return false; } if (size != sizeof(VS_FIXEDFILEINFO)) { - warning() << "VerQueryValueA on " << filePath << " returned structure with unexpected size"; + LOGV2_WARNING(23810, + "VerQueryValueA on {filePath} returned structure with unexpected size", + "filePath"_attr = filePath); return false; } @@ -310,8 +327,10 @@ bool ProcessInfo::checkNumaEnabled() { new BYTE[returnLength])); } else { DWORD gle = GetLastError(); - warning() << "GetLogicalProcessorInformation failed with " - << errnoWithDescription(gle); + LOGV2_WARNING( + 23811, + "GetLogicalProcessorInformation failed with {errnoWithDescription_gle}", + "errnoWithDescription_gle"_attr = errnoWithDescription(gle)); return false; } } -- cgit v1.2.1