1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Finished conversion to new logging API

* removed logger streams
* (float3|int3)::operator() -> (float3|int3)::toString(), it was too ugly and confusing.
This commit is contained in:
AlexVinS
2017-08-11 20:03:05 +03:00
parent f2de6d1122
commit 15138c23de
85 changed files with 543 additions and 669 deletions

View File

@ -59,18 +59,16 @@ std::shared_ptr<rett> createAny(const boost::filesystem::path & libpath, const s
getName = (TGetNameFun)dlsym(dll, "GetAiName");
getAI = (TGetAIFun)dlsym(dll, methodName.c_str());
}
else
logGlobal->errorStream() << "Error: " << dlerror();
#endif // VCMI_WINDOWS
if (!dll)
{
logGlobal->errorStream() << "Cannot open dynamic library ("<<libpath<<"). Throwing...";
logGlobal->error("Cannot open dynamic library (%s). Throwing...", libpath.string());
throw std::runtime_error("Cannot open dynamic library");
}
else if(!getName || !getAI)
{
logGlobal->errorStream() << libpath << " does not export method " << methodName;
logGlobal->error("%s does not export method %s", libpath.string(), methodName);
#ifdef VCMI_WINDOWS
FreeLibrary(dll);
#else
@ -80,7 +78,7 @@ std::shared_ptr<rett> createAny(const boost::filesystem::path & libpath, const s
}
getName(temp);
logGlobal->infoStream() << "Loaded " << temp;
logGlobal->info("Loaded %s", temp);
std::shared_ptr<rett> ret;
getAI(ret);
@ -110,7 +108,7 @@ std::shared_ptr<CBattleGameInterface> createAny(const boost::filesystem::path &
template<typename rett>
std::shared_ptr<rett> createAnyAI(std::string dllname, const std::string & methodName)
{
logGlobal->infoStream() << "Opening " << dllname;
logGlobal->info("Opening %s", dllname);
const boost::filesystem::path filePath = VCMIDirs::get().fullLibraryPath("AI", dllname);
auto ret = createAny<rett>(filePath, methodName);