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

(cherry picked from commit d791afae1d)
This commit is contained in:
Shauren
2023-08-15 20:10:04 +02:00
parent 825c697a76
commit aaa6e73c8c
252 changed files with 4596 additions and 4653 deletions

View File

@@ -287,8 +287,8 @@ public:
{
// See if the script is using the same memory as another script. If this happens, it means that
// someone forgot to allocate new memory for a script.
TC_LOG_ERROR("scripts", "Script '%s' has same memory pointer as '%s'.",
first->GetName().c_str(), second->GetName().c_str());
TC_LOG_ERROR("scripts", "Script '{}' has same memory pointer as '{}'.",
first->GetName(), second->GetName());
}
};
@@ -810,8 +810,8 @@ public:
else
{
// The script uses a script name from database, but isn't assigned to anything.
TC_LOG_ERROR("sql.sql", "Script '%s' exists in the core, but the database does not assign it to any creature.",
script->GetName().c_str());
TC_LOG_ERROR("sql.sql", "Script '{}' exists in the core, but the database does not assign it to any creature.",
script->GetName());
// Avoid calling "delete script;" because we are currently in the script constructor
// In a valid scenario this will not happen because every script has a name assigned in the database
@@ -1076,10 +1076,10 @@ void ScriptMgr::Initialize()
if (scriptName.empty())
continue;
TC_LOG_ERROR("sql.sql", "Script '%s' is referenced by the database, but does not exist in the core!", scriptName.c_str());
TC_LOG_ERROR("sql.sql", "Script '{}' is referenced by the database, but does not exist in the core!", scriptName);
}
TC_LOG_INFO("server.loading", ">> Loaded %u C++ scripts in %u ms",
TC_LOG_INFO("server.loading", ">> Loaded {} C++ scripts in {} ms",
GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
}
@@ -2290,10 +2290,10 @@ WorldMapScript::WorldMapScript(char const* name, uint32 mapId)
: ScriptObject(name), MapScript(sMapStore.LookupEntry(mapId))
{
if (!GetEntry())
TC_LOG_ERROR("scripts", "Invalid WorldMapScript for %u; no such map ID.", mapId);
TC_LOG_ERROR("scripts", "Invalid WorldMapScript for {}; no such map ID.", mapId);
if (GetEntry() && !GetEntry()->IsWorldMap())
TC_LOG_ERROR("scripts", "WorldMapScript for map %u is invalid.", mapId);
TC_LOG_ERROR("scripts", "WorldMapScript for map {} is invalid.", mapId);
ScriptRegistry<WorldMapScript>::Instance()->AddScript(this);
}
@@ -2302,10 +2302,10 @@ InstanceMapScript::InstanceMapScript(char const* name, uint32 mapId)
: ScriptObject(name), MapScript(sMapStore.LookupEntry(mapId))
{
if (!GetEntry())
TC_LOG_ERROR("scripts", "Invalid InstanceMapScript for %u; no such map ID.", mapId);
TC_LOG_ERROR("scripts", "Invalid InstanceMapScript for {}; no such map ID.", mapId);
if (GetEntry() && !GetEntry()->IsDungeon())
TC_LOG_ERROR("scripts", "InstanceMapScript for map %u is invalid.", mapId);
TC_LOG_ERROR("scripts", "InstanceMapScript for map {} is invalid.", mapId);
ScriptRegistry<InstanceMapScript>::Instance()->AddScript(this);
}
@@ -2319,10 +2319,10 @@ BattlegroundMapScript::BattlegroundMapScript(char const* name, uint32 mapId)
: ScriptObject(name), MapScript(sMapStore.LookupEntry(mapId))
{
if (!GetEntry())
TC_LOG_ERROR("scripts", "Invalid BattlegroundMapScript for %u; no such map ID.", mapId);
TC_LOG_ERROR("scripts", "Invalid BattlegroundMapScript for {}; no such map ID.", mapId);
if (GetEntry() && !GetEntry()->IsBattleground())
TC_LOG_ERROR("scripts", "BattlegroundMapScript for map %u is invalid.", mapId);
TC_LOG_ERROR("scripts", "BattlegroundMapScript for map {} is invalid.", mapId);
ScriptRegistry<BattlegroundMapScript>::Instance()->AddScript(this);
}

View File

@@ -136,8 +136,8 @@ public:
if (!success)
{
TC_LOG_ERROR("scripts.hotswap", "Failed to unload (syscall) the shared library \"%s\".",
path_.generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", "Failed to unload (syscall) the shared library \"{}\".",
path_.generic_string());
return;
}
@@ -148,20 +148,20 @@ public:
boost::system::error_code error;
if (!fs::remove(*cache_path_, error))
{
TC_LOG_ERROR("scripts.hotswap", "Failed to delete the cached shared library \"%s\" (%s).",
cache_path_->generic_string().c_str(), error.message().c_str());
TC_LOG_ERROR("scripts.hotswap", "Failed to delete the cached shared library \"{}\" ({}).",
cache_path_->generic_string(), error.message());
return;
}
TC_LOG_TRACE("scripts.hotswap", "Lazy unloaded the shared library \"%s\" "
"and deleted it's cached version at \"%s\"",
path_.generic_string().c_str(), cache_path_->generic_string().c_str());
TC_LOG_TRACE("scripts.hotswap", "Lazy unloaded the shared library \"{}\" "
"and deleted it's cached version at \"{}\"",
path_.generic_string(), cache_path_->generic_string());
}
else
{
TC_LOG_TRACE("scripts.hotswap", "Lazy unloaded the shared library \"%s\".",
path_.generic_string().c_str());
TC_LOG_TRACE("scripts.hotswap", "Lazy unloaded the shared library \"{}\".",
path_.generic_string());
}
}
@@ -267,14 +267,14 @@ Optional<std::shared_ptr<ScriptModule>>
{
if (cache_path)
{
TC_LOG_ERROR("scripts.hotswap", "Could not dynamic load the shared library \"%s\" "
"(the library is cached at %s)",
path.generic_string().c_str(), cache_path->generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", "Could not dynamic load the shared library \"{}\" "
"(the library is cached at {})",
path.generic_string(), cache_path->generic_string());
}
else
{
TC_LOG_ERROR("scripts.hotswap", "Could not dynamic load the shared library \"%s\".",
path.generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", "Could not dynamic load the shared library \"{}\".",
path.generic_string());
}
return {};
@@ -301,8 +301,8 @@ Optional<std::shared_ptr<ScriptModule>>
}
else
{
TC_LOG_ERROR("scripts.hotswap", "Could not extract all required functions from the shared library \"%s\"!",
path.generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", "Could not extract all required functions from the shared library \"{}\"!",
path.generic_string());
return {};
}
@@ -312,7 +312,7 @@ static bool HasValidScriptModuleName(std::string const& name)
{
// Detects scripts_NAME.dll's / .so's
static Trinity::regex const regex(
Trinity::StringFormat("^%s[sS]cripts_[a-zA-Z0-9_]+\\.%s$",
Trinity::StringFormat("^{}[sS]cripts_[a-zA-Z0-9_]+\\.{}$",
GetSharedLibraryPrefix(),
GetSharedLibraryExtension()));
@@ -585,11 +585,11 @@ public:
if (BuiltInConfig::GetBuildDirectory().find(" ") != std::string::npos)
{
TC_LOG_ERROR("scripts.hotswap", "Your build directory path \"%s\" "
TC_LOG_ERROR("scripts.hotswap", "Your build directory path \"{}\" "
"contains spaces, which isn't allowed for compatibility reasons! "
"You need to create a build directory which doesn't contain any space character "
"in it's path!",
BuiltInConfig::GetBuildDirectory().c_str());
BuiltInConfig::GetBuildDirectory());
return;
}
@@ -598,8 +598,8 @@ public:
auto const library_directory = GetLibraryDirectory();
if (!fs::exists(library_directory) || !fs::is_directory(library_directory))
{
TC_LOG_ERROR("scripts.hotswap", "Library directory \"%s\" doesn't exist!.",
library_directory.generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", "Library directory \"{}\" doesn't exist!.",
library_directory.generic_string());
return;
}
}
@@ -613,8 +613,8 @@ public:
|| (fs::remove_all(temporary_cache_path_, code) > 0)) &&
!fs::create_directories(temporary_cache_path_, code))
{
TC_LOG_ERROR("scripts.hotswap", "Couldn't create the cache directory at \"%s\".",
temporary_cache_path_.generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", "Couldn't create the cache directory at \"{}\".",
temporary_cache_path_.generic_string());
return;
}
@@ -723,15 +723,15 @@ private:
for (fs::directory_iterator dir_itr(libraryDirectory); dir_itr != dir_end ; ++dir_itr)
if (fs::is_regular_file(dir_itr->path()) && HasValidScriptModuleName(dir_itr->path().filename().generic_string()))
{
TC_LOG_INFO("scripts.hotswap", "Loading script module \"%s\"...",
dir_itr->path().filename().generic_string().c_str());
TC_LOG_INFO("scripts.hotswap", "Loading script module \"{}\"...",
dir_itr->path().filename().generic_string());
// Don't swap the script context to do bulk loading
ProcessLoadScriptModule(dir_itr->path(), false);
++count;
}
TC_LOG_INFO("scripts.hotswap", ">> Loaded %u script modules.", count);
TC_LOG_INFO("scripts.hotswap", ">> Loaded {} script modules.", count);
}
// Initialize all enabled file watchers.
@@ -741,13 +741,13 @@ private:
_libraryWatcher = _fileWatcher.addWatch(GetLibraryDirectory().generic_string(), &libraryUpdateListener, false);
if (_libraryWatcher >= 0)
{
TC_LOG_INFO("scripts.hotswap", ">> Library reloader is listening on \"%s\".",
GetLibraryDirectory().generic_string().c_str());
TC_LOG_INFO("scripts.hotswap", ">> Library reloader is listening on \"{}\".",
GetLibraryDirectory().generic_string());
}
else
{
TC_LOG_ERROR("scripts.hotswap", "Failed to initialize the library reloader on \"%s\".",
GetLibraryDirectory().generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", "Failed to initialize the library reloader on \"{}\".",
GetLibraryDirectory().generic_string());
}
_fileWatcher.watch();
@@ -756,9 +756,9 @@ private:
static fs::path CalculateTemporaryCachePath()
{
auto path = fs::temp_directory_path();
path /= Trinity::StringFormat("tc_script_cache_%s_%s",
path /= Trinity::StringFormat("tc_script_cache_{}_{}",
GitRevision::GetBranch(),
ByteArrayToHexStr(Trinity::Crypto::SHA1::GetDigestOf(sConfigMgr->GetFilename())).c_str());
ByteArrayToHexStr(Trinity::Crypto::SHA1::GetDigestOf(sConfigMgr->GetFilename())));
return path;
}
@@ -770,10 +770,10 @@ private:
// Create the cache path and increment the library counter to use an unique name for each library
auto cache_path = temporary_cache_path_;
cache_path /= Trinity::StringFormat("%s.%u%s",
path.stem().generic_string().c_str(),
cache_path /= Trinity::StringFormat("{}.{}{}",
path.stem().generic_string(),
_unique_library_name_counter++,
path.extension().generic_string().c_str());
path.extension().generic_string());
return cache_path;
}
@@ -867,9 +867,9 @@ private:
if (code)
{
TC_LOG_FATAL("scripts.hotswap", ">> Failed to create cache entry for module "
"\"%s\" at \"%s\" with reason (\"%s\")!",
path.filename().generic_string().c_str(), cache_path.generic_string().c_str(),
code.message().c_str());
"\"{}\" at \"{}\" with reason (\"{}\")!",
path.filename().generic_string(), cache_path.generic_string(),
code.message());
// Find a better solution for this but it's much better
// to start the core without scripts
@@ -878,15 +878,15 @@ private:
return;
}
TC_LOG_TRACE("scripts.hotswap", ">> Copied the shared library \"%s\" to \"%s\" for caching.",
path.filename().generic_string().c_str(), cache_path.generic_string().c_str());
TC_LOG_TRACE("scripts.hotswap", ">> Copied the shared library \"{}\" to \"{}\" for caching.",
path.filename().generic_string(), cache_path.generic_string());
}
auto module = ScriptModule::CreateFromPath(path, cache_path);
if (!module)
{
TC_LOG_FATAL("scripts.hotswap", ">> Failed to load script module \"%s\"!",
path.filename().generic_string().c_str());
TC_LOG_FATAL("scripts.hotswap", ">> Failed to load script module \"{}\"!",
path.filename().generic_string());
// Find a better solution for this but it's much better
// to start the core without scripts
@@ -901,13 +901,13 @@ private:
module_revision = module_revision.substr(0, 7);
std::string const module_name = (*module)->GetScriptModule();
TC_LOG_INFO("scripts.hotswap", ">> Loaded script module \"%s\" (\"%s\" - %s).",
path.filename().generic_string().c_str(), module_name.c_str(), module_revision.c_str());
TC_LOG_INFO("scripts.hotswap", ">> Loaded script module \"{}\" (\"{}\" - {}).",
path.filename().generic_string(), module_name, module_revision);
if (module_revision.empty())
{
TC_LOG_WARN("scripts.hotswap", ">> Script module \"%s\" has an empty revision hash!",
path.filename().generic_string().c_str());
TC_LOG_WARN("scripts.hotswap", ">> Script module \"{}\" has an empty revision hash!",
path.filename().generic_string());
}
else
{
@@ -919,8 +919,8 @@ private:
if (my_revision_hash != module_revision)
{
TC_LOG_WARN("scripts.hotswap", ">> Script module \"%s\" has a different revision hash! "
"Binary incompatibility could lead to unknown behaviour!", path.filename().generic_string().c_str());
TC_LOG_WARN("scripts.hotswap", ">> Script module \"{}\" has a different revision hash! "
"Binary incompatibility could lead to unknown behaviour!", path.filename().generic_string());
}
}
@@ -928,8 +928,8 @@ private:
auto const itr = _running_script_modules.find(module_name);
if (itr != _running_script_modules.end())
{
TC_LOG_ERROR("scripts.hotswap", ">> Attempt to load a module twice \"%s\" (loaded module is at %s)!",
path.generic_string().c_str(), itr->second.first->GetModulePath().generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", ">> Attempt to load a module twice \"{}\" (loaded module is at {})!",
path.generic_string(), itr->second.first->GetModulePath().generic_string());
return;
}
@@ -949,7 +949,7 @@ private:
// Process the script loading after the module was registered correctly (#17557).
sScriptMgr->SetScriptContext(module_name);
(*module)->AddScripts();
TC_LOG_TRACE("scripts.hotswap", ">> Registered all scripts of module %s.", module_name.c_str());
TC_LOG_TRACE("scripts.hotswap", ">> Registered all scripts of module {}.", module_name);
if (swap_context)
sScriptMgr->SwapScriptContext();
@@ -974,8 +974,8 @@ private:
if (finish)
sScriptMgr->SwapScriptContext();
TC_LOG_INFO("scripts.hotswap", "Released script module \"%s\" (\"%s\")...",
path.filename().generic_string().c_str(), itr->second.c_str());
TC_LOG_INFO("scripts.hotswap", "Released script module \"{}\" (\"{}\")...",
path.filename().generic_string(), itr->second);
// Unload the script module
auto ref = _running_script_modules.find(itr->second);
@@ -989,7 +989,7 @@ private:
if (ref->second.first.use_count() != 1)
{
TC_LOG_INFO("scripts.hotswap",
"Script module %s is still used by %lu spell, aura or instance scripts. "
"Script module {} is still used by {} spell, aura or instance scripts. "
"Will lazy unload the module once all scripts stopped using it, "
"to use the latest version of an edited script unbind yourself from "
"the instance or re-cast the spell.",
@@ -1015,8 +1015,8 @@ private:
{
/*
FIXME: Currently crashes the server
TC_LOG_INFO("scripts.hotswap", "Terminating the running build of module \"%s\"...",
_build_job->GetModuleName().c_str());
TC_LOG_INFO("scripts.hotswap", "Terminating the running build of module \"{}\"...",
_build_job->GetModuleName());
_build_job->GetProcess()->Terminate();
_build_job.reset();
@@ -1081,8 +1081,8 @@ private:
if (sLog->ShouldLog("scripts.hotswap", LogLevel::LOG_LEVEL_TRACE))
for (auto const& entry : itr->second)
{
TC_LOG_TRACE("scripts.hotswap", "Source file %s was %s.",
entry.first.generic_string().c_str(),
TC_LOG_TRACE("scripts.hotswap", "Source file {} was {}.",
entry.first.generic_string(),
((entry.second == ChangeStateRequest::CHANGE_REQUEST_ADDED) ?
"added" : "removed"));
}
@@ -1103,8 +1103,8 @@ private:
ASSERT(!module_name.empty(),
"The current module name is invalid!");
TC_LOG_INFO("scripts.hotswap", "Recompiling Module \"%s\"...",
module_name.c_str());
TC_LOG_INFO("scripts.hotswap", "Recompiling Module \"{}\"...",
module_name);
// Calculate the project name of the script module
auto project_name = CalculateScriptModuleProjectName(module_name);
@@ -1159,10 +1159,10 @@ private:
}
else
{
TC_LOG_INFO("scripts.hotswap", ">> Failed to update the build files at \"%s\", "
TC_LOG_INFO("scripts.hotswap", ">> Failed to update the build files at \"{}\", "
"it's possible that recently added sources are not included "
"in your next builds, rerun CMake manually.",
BuiltInConfig::GetBuildDirectory().c_str());
BuiltInConfig::GetBuildDirectory());
}
// Continue with building the changes sources
DoCompileCurrentProcessedModule();
@@ -1176,8 +1176,8 @@ private:
{
// Continue with the installation when it's enabled
TC_LOG_INFO("scripts.hotswap",
">> Successfully build module %s, continue with installing...",
_build_job->GetModuleName().c_str());
">> Successfully build module {}, continue with installing...",
_build_job->GetModuleName());
DoInstallCurrentProcessedModule();
return;
@@ -1185,14 +1185,14 @@ private:
// Skip the installation because it's disabled in config
TC_LOG_INFO("scripts.hotswap",
">> Successfully build module %s, skipped the installation.",
_build_job->GetModuleName().c_str());
">> Successfully build module {}, skipped the installation.",
_build_job->GetModuleName());
}
else // Build wasn't successful
{
TC_LOG_ERROR("scripts.hotswap",
">> The build of module %s failed! See the log for details.",
_build_job->GetModuleName().c_str());
">> The build of module {} failed! See the log for details.",
_build_job->GetModuleName());
}
break;
}
@@ -1201,16 +1201,16 @@ private:
if (!error)
{
// Installation was successful
TC_LOG_INFO("scripts.hotswap", ">> Successfully installed module %s in %us",
_build_job->GetModuleName().c_str(),
TC_LOG_INFO("scripts.hotswap", ">> Successfully installed module {} in {}s",
_build_job->GetModuleName(),
_build_job->GetTimeFromStart() / IN_MILLISECONDS);
}
else
{
// Installation wasn't successful
TC_LOG_INFO("scripts.hotswap",
">> The installation of module %s failed! See the log for details.",
_build_job->GetModuleName().c_str());
">> The installation of module {} failed! See the log for details.",
_build_job->GetModuleName());
}
break;
}
@@ -1238,8 +1238,8 @@ private:
{
ASSERT(_build_job, "There isn't any active build job!");
TC_LOG_INFO("scripts.hotswap", "Starting asynchronous build job for module %s...",
_build_job->GetModuleName().c_str());
TC_LOG_INFO("scripts.hotswap", "Starting asynchronous build job for module {}...",
_build_job->GetModuleName());
_build_job->UpdateCurrentJob(BuildJobType::BUILD_JOB_COMPILE,
InvokeAsyncCMakeCommand(
@@ -1253,8 +1253,8 @@ private:
{
ASSERT(_build_job, "There isn't any active build job!");
TC_LOG_INFO("scripts.hotswap", "Starting asynchronous install job for module %s...",
_build_job->GetModuleName().c_str());
TC_LOG_INFO("scripts.hotswap", "Starting asynchronous install job for module {}...",
_build_job->GetModuleName());
_build_job->UpdateCurrentJob(BuildJobType::BUILD_JOB_INSTALL,
InvokeAsyncCMakeCommand(
@@ -1269,8 +1269,8 @@ private:
/// since most users will forget this.
void DoCMakePrefixCorrectionIfNeeded()
{
TC_LOG_INFO("scripts.hotswap", "Correcting your CMAKE_INSTALL_PREFIX in \"%s\"...",
BuiltInConfig::GetBuildDirectory().c_str());
TC_LOG_INFO("scripts.hotswap", "Correcting your CMAKE_INSTALL_PREFIX in \"{}\"...",
BuiltInConfig::GetBuildDirectory());
auto const cmake_cache_path = fs::absolute("CMakeCache.txt",
BuiltInConfig::GetBuildDirectory());
@@ -1281,10 +1281,10 @@ private:
boost::system::error_code error;
if (!fs::exists(cmake_cache_path, error))
{
TC_LOG_ERROR("scripts.hotswap", ">> CMake cache \"%s\" doesn't exist, "
TC_LOG_ERROR("scripts.hotswap", ">> CMake cache \"{}\" doesn't exist, "
"set the \"BuildDirectory\" option in your worldserver.conf to point"
"to your build directory!",
cmake_cache_path.generic_string().c_str());
cmake_cache_path.generic_string());
return false;
}
@@ -1293,17 +1293,17 @@ private:
}())
return;
TC_LOG_TRACE("scripts.hotswap", "Checking CMake cache (\"%s\") "
TC_LOG_TRACE("scripts.hotswap", "Checking CMake cache (\"{}\") "
"for the correct CMAKE_INSTALL_PREFIX location...",
cmake_cache_path.generic_string().c_str());
cmake_cache_path.generic_string());
std::string cmake_cache_content;
{
std::ifstream in(cmake_cache_path.generic_string());
if (!in.is_open())
{
TC_LOG_ERROR("scripts.hotswap", ">> Failed to read the CMake cache at \"%s\"!",
cmake_cache_path.generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", ">> Failed to read the CMake cache at \"{}\"!",
cmake_cache_path.generic_string());
return;
}
@@ -1357,9 +1357,9 @@ private:
if (is_in_path)
return;
TC_LOG_INFO("scripts.hotswap", ">> Found outdated CMAKE_INSTALL_PREFIX (\"%s\"), "
"worldserver is currently installed at %s",
value.generic_string().c_str(), current_path.generic_string().c_str());
TC_LOG_INFO("scripts.hotswap", ">> Found outdated CMAKE_INSTALL_PREFIX (\"{}\"), "
"worldserver is currently installed at {}",
value.generic_string(), current_path.generic_string());
}
else
{
@@ -1473,7 +1473,7 @@ static char const* ActionToString(efsw::Action action)
void LibraryUpdateListener::handleFileAction(efsw::WatchID watchid, std::string const& dir,
std::string const& filename, efsw::Action action, std::string oldFilename)
{
// TC_LOG_TRACE("scripts.hotswap", "Library listener detected change on possible module \"%s\ (%s)".", filename.c_str(), ActionToString(action));
// TC_LOG_TRACE("scripts.hotswap", "Library listener detected change on possible module \"{}\ ({})".", filename, ActionToString(action));
// Split moved actions into a delete and an add action
if (action == efsw::Action::Moved)
@@ -1496,18 +1496,18 @@ void LibraryUpdateListener::handleFileAction(efsw::WatchID watchid, std::string
switch (action)
{
case efsw::Actions::Add:
TC_LOG_TRACE("scripts.hotswap", ">> Loading \"%s\" (%s)...",
path.generic_string().c_str(), ActionToString(action));
TC_LOG_TRACE("scripts.hotswap", ">> Loading \"{}\" ({})...",
path.generic_string(), ActionToString(action));
reloader->QueueSharedLibraryChanged(path);
break;
case efsw::Actions::Delete:
TC_LOG_TRACE("scripts.hotswap", ">> Unloading \"%s\" (%s)...",
path.generic_string().c_str(), ActionToString(action));
TC_LOG_TRACE("scripts.hotswap", ">> Unloading \"{}\" ({})...",
path.generic_string(), ActionToString(action));
reloader->QueueSharedLibraryChanged(path);
break;
case efsw::Actions::Modified:
TC_LOG_TRACE("scripts.hotswap", ">> Reloading \"%s\" (%s)...",
path.generic_string().c_str(), ActionToString(action));
TC_LOG_TRACE("scripts.hotswap", ">> Reloading \"{}\" ({})...",
path.generic_string(), ActionToString(action));
reloader->QueueSharedLibraryChanged(path);
break;
default:
@@ -1530,13 +1530,13 @@ SourceUpdateListener::SourceUpdateListener(fs::path path, std::string script_mod
{
if (watcher_id_ >= 0)
{
TC_LOG_TRACE("scripts.hotswap", ">> Attached the source recompiler to \"%s\".",
path_.generic_string().c_str());
TC_LOG_TRACE("scripts.hotswap", ">> Attached the source recompiler to \"{}\".",
path_.generic_string());
}
else
{
TC_LOG_ERROR("scripts.hotswap", "Failed to initialize thesource recompiler on \"%s\".",
path_.generic_string().c_str());
TC_LOG_ERROR("scripts.hotswap", "Failed to initialize thesource recompiler on \"{}\".",
path_.generic_string());
}
}
@@ -1546,15 +1546,15 @@ SourceUpdateListener::~SourceUpdateListener()
{
sScriptReloadMgr->_fileWatcher.removeWatch(watcher_id_);
TC_LOG_TRACE("scripts.hotswap", ">> Detached the source recompiler from \"%s\".",
path_.generic_string().c_str());
TC_LOG_TRACE("scripts.hotswap", ">> Detached the source recompiler from \"{}\".",
path_.generic_string());
}
}
void SourceUpdateListener::handleFileAction(efsw::WatchID watchid, std::string const& dir,
std::string const& filename, efsw::Action action, std::string oldFilename)
{
// TC_LOG_TRACE("scripts.hotswap", "Source listener detected change on possible file \"%s/%s\" (%s).", dir.c_str(), filename.c_str(), ActionToString(action));
// TC_LOG_TRACE("scripts.hotswap", "Source listener detected change on possible file \"{}/{}\" ({}).", dir, filename, ActionToString(action));
// Skip the file change notification if the recompiler is disabled
if (!sWorld->getBoolConfig(CONFIG_HOTSWAP_RECOMPILER_ENABLED))
@@ -1580,24 +1580,24 @@ void SourceUpdateListener::handleFileAction(efsw::WatchID watchid, std::string c
/// Thread safe part
sScriptReloadMgr->QueueMessage([=, this, path = std::move(path)](HotSwapScriptReloadMgr* reloader)
{
TC_LOG_TRACE("scripts.hotswap", "Detected source change on module \"%s\", "
"queued for recompilation...", script_module_name_.c_str());
TC_LOG_TRACE("scripts.hotswap", "Detected source change on module \"{}\", "
"queued for recompilation...", script_module_name_);
switch (action)
{
case efsw::Actions::Add:
TC_LOG_TRACE("scripts.hotswap", "Source file %s of module %s was added.",
path.generic_string().c_str(), script_module_name_.c_str());
TC_LOG_TRACE("scripts.hotswap", "Source file {} of module {} was added.",
path.generic_string(), script_module_name_);
reloader->QueueAddSourceFile(script_module_name_, path);
break;
case efsw::Actions::Delete:
TC_LOG_TRACE("scripts.hotswap", "Source file %s of module %s was deleted.",
path.generic_string().c_str(), script_module_name_.c_str());
TC_LOG_TRACE("scripts.hotswap", "Source file {} of module {} was deleted.",
path.generic_string(), script_module_name_);
reloader->QueueRemoveSourceFile(script_module_name_, path);
break;
case efsw::Actions::Modified:
TC_LOG_TRACE("scripts.hotswap", "Source file %s of module %s was modified.",
path.generic_string().c_str(), script_module_name_.c_str());
TC_LOG_TRACE("scripts.hotswap", "Source file {} of module {} was modified.",
path.generic_string(), script_module_name_);
reloader->QueueModifySourceFile(script_module_name_, path);
break;
default:

View File

@@ -46,7 +46,7 @@ void SystemMgr::LoadScriptWaypoints()
if (result)
entryCount = result->GetRowCount();
TC_LOG_INFO("server.loading", "Loading Script Waypoints for " UI64FMTD " creature(s)...", entryCount);
TC_LOG_INFO("server.loading", "Loading Script Waypoints for {} creature(s)...", entryCount);
// 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
@@ -71,12 +71,12 @@ void SystemMgr::LoadScriptWaypoints()
CreatureTemplate const* info = sObjectMgr->GetCreatureTemplate(entry);
if (!info)
{
TC_LOG_ERROR("sql.sql", "SystemMgr: DB table script_waypoint has waypoint for non-existant creature entry %u", entry);
TC_LOG_ERROR("sql.sql", "SystemMgr: DB table script_waypoint has waypoint for non-existant creature entry {}", entry);
continue;
}
if (!info->ScriptID)
TC_LOG_ERROR("sql.sql", "SystemMgr: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", entry);
TC_LOG_ERROR("sql.sql", "SystemMgr: DB table script_waypoint has waypoint for creature entry {}, but creature does not have ScriptName defined and then useless.", entry);
WaypointPath& path = _waypointStore[entry];
path.id = entry;
@@ -85,7 +85,7 @@ void SystemMgr::LoadScriptWaypoints()
++count;
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded {} Script Waypoint nodes in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SystemMgr::LoadScriptSplineChains()
@@ -115,7 +115,7 @@ void SystemMgr::LoadScriptSplineChains()
if (splineId != chain.size())
{
TC_LOG_WARN("server.loading", "Creature #%u: Chain %u has orphaned spline %u, skipped.", entry, chainId, splineId);
TC_LOG_WARN("server.loading", "Creature #{}: Chain {} has orphaned spline {}, skipped.", entry, chainId, splineId);
continue;
}
@@ -139,26 +139,26 @@ void SystemMgr::LoadScriptSplineChains()
auto it = m_mSplineChainsMap.find({entry,chainId});
if (it == m_mSplineChainsMap.end())
{
TC_LOG_WARN("server.loading", "Creature #%u has waypoint data for spline chain %u. No such chain exists - entry skipped.", entry, chainId);
TC_LOG_WARN("server.loading", "Creature #{} has waypoint data for spline chain {}. No such chain exists - entry skipped.", entry, chainId);
continue;
}
std::vector<SplineChainLink>& chain = it->second;
if (splineId >= chain.size())
{
TC_LOG_WARN("server.loading", "Creature #%u has waypoint data for spline (%u,%u). The specified chain does not have a spline with this index - entry skipped.", entry, chainId, splineId);
TC_LOG_WARN("server.loading", "Creature #{} has waypoint data for spline ({},{}). The specified chain does not have a spline with this index - entry skipped.", entry, chainId, splineId);
continue;
}
SplineChainLink& spline = chain[splineId];
if (wpId != spline.Points.size())
{
TC_LOG_WARN("server.loading", "Creature #%u has orphaned waypoint data in spline (%u,%u) at index %u. Skipped.", entry, chainId, splineId, wpId);
TC_LOG_WARN("server.loading", "Creature #{} has orphaned waypoint data in spline ({},{}) at index {}. Skipped.", entry, chainId, splineId, wpId);
continue;
}
spline.Points.emplace_back(posX, posY, posZ);
++wpCount;
} while (resultWP->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded spline chain data for %u chains, consisting of %u splines with %u waypoints in %u ms", chainCount, splineCount, wpCount, GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded spline chain data for {} chains, consisting of {} splines with {} waypoints in {} ms", chainCount, splineCount, wpCount, GetMSTimeDiffToNow(oldMSTime));
}
}