mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-11-08 12:50:29 +00:00
Use fmt::format for LOGERROR
The format string can be checked at compile time. It will be easier to transition to `std::format`.
This commit is contained in:
115 files changed
+631
-454
No files matched your search
@@ -66,7 +66,7 @@ bool Exception::CatchPending(const Request& rq)
|
||||
{
|
||||
CStr error;
|
||||
FromJSVal(rq, excn, error);
|
||||
LOGERROR("JavaScript error: %s", error);
|
||||
LOGERROR("JavaScript error: {}", error);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ bool Exception::CatchPending(const Request& rq)
|
||||
{
|
||||
CStr error;
|
||||
FromJSVal(rq, excn, error);
|
||||
LOGERROR("JavaScript error: %s", error);
|
||||
LOGERROR("JavaScript error: {}", error);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ bool Exception::CatchPending(const Request& rq)
|
||||
msg << "\n " << line;
|
||||
}
|
||||
|
||||
LOGERROR("%s", msg.str().c_str());
|
||||
LOGERROR("{}", msg.str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -120,4 +120,4 @@ void Exception::Raise(const Request& rq, const char* format, ...)
|
||||
JS_ReportErrorUTF8(rq.cx, "%s", buffer);
|
||||
}
|
||||
|
||||
} // namespace Script
|
||||
} // namespace Script
|
||||
@@ -214,7 +214,7 @@ bool error(JSContext* cx, unsigned int argc, JS::Value* vp)
|
||||
std::wstring str;
|
||||
if (!Script::FromJSVal(rq, args[0], str))
|
||||
return false;
|
||||
LOGERROR("%s", utf8_from_wstring(str));
|
||||
LOGERROR("{}", utf8_from_wstring(str));
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
@@ -467,7 +467,7 @@ bool Interface::LoadGlobalScripts()
|
||||
for (const VfsPath& path : pathnames)
|
||||
if (!LoadGlobalScriptFile(path))
|
||||
{
|
||||
LOGERROR("LoadGlobalScripts: Failed to load script %s", path.string8());
|
||||
LOGERROR("LoadGlobalScripts: Failed to load script {}", path.string8());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -716,7 +716,7 @@ bool Interface::LoadGlobalScriptFile(const VfsPath& path) const
|
||||
{
|
||||
if (!VfsFileExists(path))
|
||||
{
|
||||
LOGERROR("File '%s' does not exist", path.string8());
|
||||
LOGERROR("File '{}' does not exist", path.string8());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ bool Interface::LoadGlobalScriptFile(const VfsPath& path) const
|
||||
|
||||
if (ret != PSRETURN_OK)
|
||||
{
|
||||
LOGERROR("Failed to load file '%s': %s", path.string8(), GetErrorString(ret));
|
||||
LOGERROR("Failed to load file '{}': {}", path.string8(), GetErrorString(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ void Script::ReadJSONFile(const Script::Request& rq, const VfsPath& path, JS::Mu
|
||||
{
|
||||
if (!VfsFileExists(path))
|
||||
{
|
||||
LOGERROR("File '%s' does not exist", path.string8());
|
||||
LOGERROR("File '{}' does not exist", path.string8());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ void Script::ReadJSONFile(const Script::Request& rq, const VfsPath& path, JS::Mu
|
||||
|
||||
if (ret != PSRETURN_OK)
|
||||
{
|
||||
LOGERROR("Failed to load file '%s': %s", path.string8(), GetErrorString(ret));
|
||||
LOGERROR("Failed to load file '{}': {}", path.string8(), GetErrorString(ret));
|
||||
return;
|
||||
}
|
||||
|
||||
std::string content(file.DecodeUTF8()); // assume it's UTF-8
|
||||
|
||||
if (!ParseJSON(rq, content, out))
|
||||
LOGERROR("Failed to parse '%s'", path.string8());
|
||||
LOGERROR("Failed to parse '{}'", path.string8());
|
||||
}
|
||||
|
||||
namespace
|
||||
|
||||
@@ -532,7 +532,7 @@ ModuleLoader::~ModuleLoader()
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOGERROR("%s", e.what());
|
||||
LOGERROR("{}", e.what());
|
||||
return nullptr;
|
||||
}
|
||||
catch (...)
|
||||
@@ -557,7 +557,7 @@ ModuleLoader::~ModuleLoader()
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOGERROR("%s", e.what());
|
||||
LOGERROR("{}", e.what());
|
||||
return JS::FinishDynamicModuleImport(rq.cx, nullptr, referencingPrivate, moduleRequest,
|
||||
promise);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ void UnhandledRejectedPromise(JSContext* cx, bool, JS::HandleObject promise,
|
||||
Script::Function::Call(rq, reason, "toString", asString);
|
||||
std::string stack;
|
||||
Script::GetProperty(rq, reason, "stack", stack);
|
||||
LOGERROR("An unhandled promise got rejected:\n%s\n%s", asString, stack);
|
||||
LOGERROR("An unhandled promise got rejected:\n{}\n{}", asString, stack);
|
||||
}
|
||||
|
||||
void JobQueue::runJobs(JSContext*)
|
||||
|
||||
Reference in new issue
Block a user