Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api)
This commit is contained in:
@@ -96,8 +96,8 @@ uint32 DatabaseWorkerPool<T>::Open()
|
||||
{
|
||||
WPFatal(_connectionInfo.get(), "Connection info was not set!");
|
||||
|
||||
TC_LOG_INFO("sql.driver", "Opening DatabasePool '%s'. "
|
||||
"Asynchronous connections: %u, synchronous connections: %u.",
|
||||
TC_LOG_INFO("sql.driver", "Opening DatabasePool '{}'. "
|
||||
"Asynchronous connections: {}, synchronous connections: {}.",
|
||||
GetDatabaseName(), _async_threads, _synch_threads);
|
||||
|
||||
uint32 error = OpenConnections(IDX_ASYNC, _async_threads);
|
||||
@@ -109,7 +109,7 @@ uint32 DatabaseWorkerPool<T>::Open()
|
||||
|
||||
if (!error)
|
||||
{
|
||||
TC_LOG_INFO("sql.driver", "DatabasePool '%s' opened successfully. " SZFMTD
|
||||
TC_LOG_INFO("sql.driver", "DatabasePool '{}' opened successfully. " SZFMTD
|
||||
" total connections running.", GetDatabaseName(),
|
||||
(_connections[IDX_SYNCH].size() + _connections[IDX_ASYNC].size()));
|
||||
}
|
||||
@@ -120,12 +120,12 @@ uint32 DatabaseWorkerPool<T>::Open()
|
||||
template <class T>
|
||||
void DatabaseWorkerPool<T>::Close()
|
||||
{
|
||||
TC_LOG_INFO("sql.driver", "Closing down DatabasePool '%s'.", GetDatabaseName());
|
||||
TC_LOG_INFO("sql.driver", "Closing down DatabasePool '{}'.", GetDatabaseName());
|
||||
|
||||
//! Closes the actualy MySQL connection.
|
||||
_connections[IDX_ASYNC].clear();
|
||||
|
||||
TC_LOG_INFO("sql.driver", "Asynchronous connections on DatabasePool '%s' terminated. "
|
||||
TC_LOG_INFO("sql.driver", "Asynchronous connections on DatabasePool '{}' terminated. "
|
||||
"Proceeding with synchronous connections.",
|
||||
GetDatabaseName());
|
||||
|
||||
@@ -135,7 +135,7 @@ void DatabaseWorkerPool<T>::Close()
|
||||
//! meaning there can be no concurrent access at this point.
|
||||
_connections[IDX_SYNCH].clear();
|
||||
|
||||
TC_LOG_INFO("sql.driver", "All connections on DatabasePool '%s' closed.", GetDatabaseName());
|
||||
TC_LOG_INFO("sql.driver", "All connections on DatabasePool '{}' closed.", GetDatabaseName());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -403,9 +403,9 @@ uint32 DatabaseWorkerPool<T>::OpenConnections(InternalIndex type, uint8 numConne
|
||||
#endif
|
||||
{
|
||||
#ifndef LIBMARIADB
|
||||
TC_LOG_ERROR("sql.driver", "TrinityCore does not support MySQL versions below " MIN_MYSQL_SERVER_VERSION_STRING " (found id %u, need id >= %u), please update your MySQL server", connection->GetServerVersion(), MIN_MYSQL_SERVER_VERSION);
|
||||
TC_LOG_ERROR("sql.driver", "TrinityCore does not support MySQL versions below " MIN_MYSQL_SERVER_VERSION_STRING " (found id {}, need id >= {}), please update your MySQL server", connection->GetServerVersion(), MIN_MYSQL_SERVER_VERSION);
|
||||
#else
|
||||
TC_LOG_ERROR("sql.driver", "TrinityCore does not support MariaDB versions below " MIN_MARIADB_SERVER_VERSION_STRING " (found id %u, need id >= %u), please update your MySQL server", connection->GetServerVersion(), MIN_MARIADB_SERVER_VERSION);
|
||||
TC_LOG_ERROR("sql.driver", "TrinityCore does not support MariaDB versions below " MIN_MARIADB_SERVER_VERSION_STRING " (found id {}, need id >= {}), please update your MySQL server", connection->GetServerVersion(), MIN_MARIADB_SERVER_VERSION);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
@@ -449,7 +449,7 @@ T* DatabaseWorkerPool<T>::GetFreeConnection()
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << boost::stacktrace::stacktrace();
|
||||
TC_LOG_WARN("sql.performances", "Sync query at:\n%s", ss.str().c_str());
|
||||
TC_LOG_WARN("sql.performances", "Sync query at:\n{}", ss.str());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -477,7 +477,7 @@ char const* DatabaseWorkerPool<T>::GetDatabaseName() const
|
||||
template <class T>
|
||||
void DatabaseWorkerPool<T>::Execute(char const* sql)
|
||||
{
|
||||
if (Trinity::IsFormatEmptyOrNull(sql))
|
||||
if (!sql)
|
||||
return;
|
||||
|
||||
BasicStatementTask* task = new BasicStatementTask(sql);
|
||||
@@ -494,7 +494,7 @@ void DatabaseWorkerPool<T>::Execute(PreparedStatement<T>* stmt)
|
||||
template <class T>
|
||||
void DatabaseWorkerPool<T>::DirectExecute(char const* sql)
|
||||
{
|
||||
if (Trinity::IsFormatEmptyOrNull(sql))
|
||||
if (!sql)
|
||||
return;
|
||||
|
||||
T* connection = GetFreeConnection();
|
||||
|
||||
Reference in New Issue
Block a user