Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api)

This commit is contained in:
Shauren
2023-01-08 21:16:53 +01:00
parent b6820a706f
commit d791afae1d
294 changed files with 4921 additions and 4944 deletions

View File

@@ -61,7 +61,7 @@ public:
}
catch (boost::system::system_error const& err)
{
TC_LOG_INFO("network", "Failed to initialize client's socket %s", err.what());
TC_LOG_INFO("network", "Failed to initialize client's socket {}", err.what());
}
}
@@ -76,7 +76,7 @@ public:
_acceptor.open(_endpoint.protocol(), errorCode);
if (errorCode)
{
TC_LOG_INFO("network", "Failed to open acceptor %s", errorCode.message().c_str());
TC_LOG_INFO("network", "Failed to open acceptor {}", errorCode.message());
return false;
}
@@ -84,7 +84,7 @@ public:
_acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true), errorCode);
if (errorCode)
{
TC_LOG_INFO("network", "Failed to set reuse_address option on acceptor %s", errorCode.message().c_str());
TC_LOG_INFO("network", "Failed to set reuse_address option on acceptor {}", errorCode.message());
return false;
}
#endif
@@ -92,14 +92,14 @@ public:
_acceptor.bind(_endpoint, errorCode);
if (errorCode)
{
TC_LOG_INFO("network", "Could not bind to %s:%u %s", _endpoint.address().to_string().c_str(), _endpoint.port(), errorCode.message().c_str());
TC_LOG_INFO("network", "Could not bind to {}:{} {}", _endpoint.address().to_string(), _endpoint.port(), errorCode.message());
return false;
}
_acceptor.listen(TRINITY_MAX_LISTEN_CONNECTIONS, errorCode);
if (errorCode)
{
TC_LOG_INFO("network", "Failed to start listening on %s:%u %s", _endpoint.address().to_string().c_str(), _endpoint.port(), errorCode.message().c_str());
TC_LOG_INFO("network", "Failed to start listening on {}:{} {}", _endpoint.address().to_string(), _endpoint.port(), errorCode.message());
return false;
}
@@ -141,7 +141,7 @@ void AsyncAcceptor::AsyncAccept()
}
catch (boost::system::system_error const& err)
{
TC_LOG_INFO("network", "Failed to retrieve client's remote address %s", err.what());
TC_LOG_INFO("network", "Failed to retrieve client's remote address {}", err.what());
}
}

View File

@@ -147,8 +147,8 @@ public:
boost::system::error_code shutdownError;
_socket.shutdown(boost::asio::socket_base::shutdown_send, shutdownError);
if (shutdownError)
TC_LOG_DEBUG("network", "Socket::CloseSocket: %s errored when shutting down socket: %i (%s)", GetRemoteIpAddress().to_string().c_str(),
shutdownError.value(), shutdownError.message().c_str());
TC_LOG_DEBUG("network", "Socket::CloseSocket: {} errored when shutting down socket: {} ({})", GetRemoteIpAddress().to_string(),
shutdownError.value(), shutdownError.message());
OnClose();
}
@@ -187,8 +187,8 @@ protected:
boost::system::error_code err;
_socket.set_option(tcp::no_delay(enable), err);
if (err)
TC_LOG_DEBUG("network", "Socket::SetNoDelay: failed to set_option(boost::asio::ip::tcp::no_delay) for %s - %d (%s)",
GetRemoteIpAddress().to_string().c_str(), err.value(), err.message().c_str());
TC_LOG_DEBUG("network", "Socket::SetNoDelay: failed to set_option(boost::asio::ip::tcp::no_delay) for {} - {} ({})",
GetRemoteIpAddress().to_string(), err.value(), err.message());
}
Stream& underlying_stream()

View File

@@ -46,7 +46,7 @@ public:
}
catch (boost::system::system_error const& err)
{
TC_LOG_ERROR("network", "Exception caught in SocketMgr.StartNetwork (%s:%u): %s", bindIp.c_str(), port, err.what());
TC_LOG_ERROR("network", "Exception caught in SocketMgr.StartNetwork ({}:{}): {}", bindIp, port, err.what());
return false;
}
@@ -106,7 +106,7 @@ public:
}
catch (boost::system::system_error const& err)
{
TC_LOG_WARN("network", "Failed to retrieve client's remote address %s", err.what());
TC_LOG_WARN("network", "Failed to retrieve client's remote address {}", err.what());
}
}