mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api)
This commit is contained in:
@@ -131,8 +131,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;
|
||||
}
|
||||
@@ -143,20 +143,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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,14 +262,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 {};
|
||||
@@ -296,8 +296,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 {};
|
||||
}
|
||||
@@ -307,7 +307,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()));
|
||||
|
||||
@@ -580,11 +580,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;
|
||||
}
|
||||
@@ -593,8 +593,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;
|
||||
}
|
||||
}
|
||||
@@ -608,8 +608,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;
|
||||
}
|
||||
@@ -718,15 +718,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.
|
||||
@@ -736,13 +736,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();
|
||||
@@ -751,9 +751,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;
|
||||
}
|
||||
@@ -765,10 +765,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;
|
||||
}
|
||||
@@ -862,9 +862,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
|
||||
@@ -873,15 +873,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
|
||||
@@ -896,13 +896,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
|
||||
{
|
||||
@@ -914,8 +914,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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -923,8 +923,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;
|
||||
}
|
||||
@@ -944,7 +944,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();
|
||||
@@ -969,8 +969,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);
|
||||
@@ -984,7 +984,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.",
|
||||
@@ -1010,8 +1010,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();
|
||||
@@ -1076,8 +1076,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"));
|
||||
}
|
||||
@@ -1098,8 +1098,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);
|
||||
@@ -1154,10 +1154,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();
|
||||
@@ -1171,8 +1171,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;
|
||||
@@ -1180,14 +1180,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;
|
||||
}
|
||||
@@ -1196,16 +1196,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;
|
||||
}
|
||||
@@ -1233,8 +1233,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(
|
||||
@@ -1248,8 +1248,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(
|
||||
@@ -1264,8 +1264,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());
|
||||
@@ -1276,10 +1276,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;
|
||||
}
|
||||
@@ -1288,17 +1288,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;
|
||||
}
|
||||
@@ -1352,9 +1352,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
|
||||
{
|
||||
@@ -1468,7 +1468,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)
|
||||
@@ -1491,18 +1491,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:
|
||||
@@ -1525,13 +1525,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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1541,15 +1541,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))
|
||||
@@ -1575,24 +1575,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:
|
||||
|
||||
Reference in New Issue
Block a user