diff options
Diffstat (limited to 'src/mongo/util/net/socket_utils.cpp')
-rw-r--r-- | src/mongo/util/net/socket_utils.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/mongo/util/net/socket_utils.cpp b/src/mongo/util/net/socket_utils.cpp index f58ff484ec7..42c2e38eac8 100644 --- a/src/mongo/util/net/socket_utils.cpp +++ b/src/mongo/util/net/socket_utils.cpp @@ -54,6 +54,7 @@ #endif #include "mongo/db/server_options.h" +#include "mongo/logv2/log.h" #include "mongo/util/concurrency/value.h" #include "mongo/util/errno_util.h" #include "mongo/util/log.h" @@ -69,7 +70,9 @@ const struct WinsockInit { WinsockInit() { WSADATA d; if (WSAStartup(MAKEWORD(2, 2), &d) != 0) { - log() << "ERROR: wsastartup failed " << errnoWithDescription(); + LOGV2(23201, + "ERROR: wsastartup failed {errnoWithDescription}", + "errnoWithDescription"_attr = errnoWithDescription()); quickExit(EXIT_NTSERVICE_ERROR); } } @@ -114,7 +117,9 @@ void setSocketKeepAliveParams(int sock, // Return seconds return val ? (val.get() / 1000) : default_value; } - error() << "can't get KeepAlive parameter: " << withval.getStatus(); + LOGV2_ERROR(23203, + "can't get KeepAlive parameter: {withval_getStatus}", + "withval_getStatus"_attr = withval.getStatus()); return default_value; }; @@ -136,7 +141,9 @@ void setSocketKeepAliveParams(int sock, &sent, nullptr, nullptr)) { - error() << "failed setting keepalive values: " << WSAGetLastError(); + LOGV2_ERROR(23204, + "failed setting keepalive values: {WSAGetLastError}", + "WSAGetLastError"_attr = WSAGetLastError()); } } #elif defined(__APPLE__) || defined(__linux__) @@ -146,13 +153,19 @@ void setSocketKeepAliveParams(int sock, socklen_t len = sizeof(optval); if (getsockopt(sock, level, optnum, (char*)&optval, &len)) { - error() << "can't get " << optname << ": " << errnoWithDescription(); + LOGV2_ERROR(23205, + "can't get {optname}: {errnoWithDescription}", + "optname"_attr = optname, + "errnoWithDescription"_attr = errnoWithDescription()); } if (optval > maxval) { optval = maxval; if (setsockopt(sock, level, optnum, (char*)&optval, sizeof(optval))) { - error() << "can't set " << optname << ": " << errnoWithDescription(); + LOGV2_ERROR(23206, + "can't set {optname}: {errnoWithDescription}", + "optname"_attr = optname, + "errnoWithDescription"_attr = errnoWithDescription()); } } }; @@ -196,7 +209,9 @@ std::string getHostName() { char buf[256]; int ec = gethostname(buf, 127); if (ec || *buf == 0) { - log() << "can't get this server's hostname " << errnoWithDescription(); + LOGV2(23202, + "can't get this server's hostname {errnoWithDescription}", + "errnoWithDescription"_attr = errnoWithDescription()); return ""; } return buf; |