diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2020-05-21 12:06:47 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-02 22:09:56 +0000 |
commit | 451dcf99afb7a67e9a5b849e846391402b5928c9 (patch) | |
tree | 9ca45d512d6489e84a0e334cda3fe9303c6bf6ad /src/mongo/util/net | |
parent | 3bef557cab5c17de9374f602c743b87808af590e (diff) | |
download | mongo-451dcf99afb7a67e9a5b849e846391402b5928c9.tar.gz |
SERVER-47075 Clean up some log lines
* all logs under mongo/transport and mongo/util/net were reviewed and
many were cleaned up
* all "status"_attr were reviewed and most changed to "error"_attr
Diffstat (limited to 'src/mongo/util/net')
-rw-r--r-- | src/mongo/util/net/hostname_canonicalization.cpp | 31 | ||||
-rw-r--r-- | src/mongo/util/net/http_client_curl.cpp | 2 | ||||
-rw-r--r-- | src/mongo/util/net/http_client_winhttp.cpp | 2 | ||||
-rw-r--r-- | src/mongo/util/net/ssl_manager_openssl.cpp | 4 | ||||
-rw-r--r-- | src/mongo/util/net/ssl_options.cpp | 2 |
5 files changed, 15 insertions, 26 deletions
diff --git a/src/mongo/util/net/hostname_canonicalization.cpp b/src/mongo/util/net/hostname_canonicalization.cpp index 3f5b939cb18..b329d0f6149 100644 --- a/src/mongo/util/net/hostname_canonicalization.cpp +++ b/src/mongo/util/net/hostname_canonicalization.cpp @@ -92,10 +92,10 @@ std::vector<std::string> getHostFQDNs(std::string hostName, HostnameCanonicaliza if ((err = shim_getaddrinfo(nativeHostName.c_str(), nullptr, &hints, &info)) != 0) { LOGV2_DEBUG(23170, 3, - "Failed to obtain address information for hostname {hostName}: " - "{getAddrInfoStrError_err}", + "Failed to obtain address information for host {hostName}: {error}", + "Failed to obtain address information for host", "hostName"_attr = hostName, - "getAddrInfoStrError_err"_attr = getAddrInfoStrError(err)); + "error"_attr = getAddrInfoStrError(err)); return results; } const auto guard = makeGuard(shim_freeaddrinfo); @@ -105,20 +105,14 @@ std::vector<std::string> getHostFQDNs(std::string hostName, HostnameCanonicaliza return results; } - bool encounteredErrors = false; - std::stringstream getNameInfoErrors; - getNameInfoErrors << "Failed to obtain name info for: [ "; + std::vector<std::string> getNameInfoErrors; for (shim_addrinfo* p = info; p; p = p->ai_next) { + std::stringstream getNameInfoError; shim_char host[NI_MAXHOST] = {}; if ((err = shim_getnameinfo( p->ai_addr, p->ai_addrlen, host, sizeof(host), nullptr, 0, NI_NAMEREQD)) == 0) { results.emplace_back(shim_fromNativeString(host)); } else { - if (encounteredErrors) { - getNameInfoErrors << ", "; - } - encounteredErrors = true; - // Format the addrinfo structure we have into a string for reporting char ip_str[INET6_ADDRSTRLEN]; struct sockaddr* addr = p->ai_addr; @@ -132,23 +126,24 @@ std::vector<std::string> getHostFQDNs(std::string hostName, HostnameCanonicaliza sin_addr = reinterpret_cast<void*>(&addr_in6->sin6_addr); } - getNameInfoErrors << "("; if (sin_addr) { invariant(inet_ntop(p->ai_family, sin_addr, ip_str, sizeof(ip_str)) != nullptr); - getNameInfoErrors << ip_str; + getNameInfoError << ip_str; } else { - getNameInfoErrors << "Unknown address family: " << p->ai_family; + getNameInfoError << "Unknown address family: " << p->ai_family; } - getNameInfoErrors << ", \"" << getAddrInfoStrError(err) << "\")"; + getNameInfoError << ": \"" << getAddrInfoStrError(err); } + getNameInfoErrors.push_back(getNameInfoError.str()); } - if (encounteredErrors) { + if (!getNameInfoErrors.empty()) { LOGV2_DEBUG(23171, 3, - "{getNameInfoErrors_str} ]", - "getNameInfoErrors_str"_attr = getNameInfoErrors.str()); + "Failed to obtain name info: {errors}", + "Failed to obtain name info", + "errors"_attr = getNameInfoErrors); } // Deduplicate the results list diff --git a/src/mongo/util/net/http_client_curl.cpp b/src/mongo/util/net/http_client_curl.cpp index c3002d4f062..ca8263595d9 100644 --- a/src/mongo/util/net/http_client_curl.cpp +++ b/src/mongo/util/net/http_client_curl.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kNetwork - #include "mongo/platform/basic.h" #include <cstddef> diff --git a/src/mongo/util/net/http_client_winhttp.cpp b/src/mongo/util/net/http_client_winhttp.cpp index 45e3bcbd205..2368f2826c0 100644 --- a/src/mongo/util/net/http_client_winhttp.cpp +++ b/src/mongo/util/net/http_client_winhttp.cpp @@ -34,8 +34,6 @@ #error This file assumes a UNICODE WIN32 build #endif -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kNetwork - #include "mongo/platform/basic.h" #include <string> diff --git a/src/mongo/util/net/ssl_manager_openssl.cpp b/src/mongo/util/net/ssl_manager_openssl.cpp index ae9e68a1c23..829311cb692 100644 --- a/src/mongo/util/net/ssl_manager_openssl.cpp +++ b/src/mongo/util/net/ssl_manager_openssl.cpp @@ -1393,9 +1393,9 @@ int SSLManagerOpenSSL::password_cb(char* buf, int num, int rwflag, void* userdat auto swPassword = pwFetcher->fetchPassword(); if (!swPassword.isOK()) { LOGV2_ERROR(23239, - "Unable to fetch password: {status}", + "Unable to fetch password: {error}", "Unable to fetch password", - "status"_attr = swPassword.getStatus()); + "error"_attr = swPassword.getStatus()); return -1; } StringData password = std::move(swPassword.getValue()); diff --git a/src/mongo/util/net/ssl_options.cpp b/src/mongo/util/net/ssl_options.cpp index 08e135b0cb6..607d4a6a9e8 100644 --- a/src/mongo/util/net/ssl_options.cpp +++ b/src/mongo/util/net/ssl_options.cpp @@ -27,8 +27,6 @@ * it in the license file. */ -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kControl - #include "mongo/platform/basic.h" #include "mongo/util/net/ssl_options.h" |