From 03b7da93e260865b98e5346cbb7bd340832945f6 Mon Sep 17 00:00:00 2001 From: Henning Koehler Date: Thu, 31 Aug 2017 09:23:19 +1200 Subject: [PATCH] use logMod for all mod-related logging --- lib/CArtHandler.cpp | 14 +++--- lib/CHeroHandler.cpp | 2 +- lib/CModHandler.cpp | 90 ++++++++++++++++++------------------ lib/CSkillHandler.cpp | 2 +- lib/CTownHandler.cpp | 8 ++-- lib/IHandlerBase.h | 2 +- lib/JsonDetail.cpp | 4 +- lib/JsonNode.cpp | 24 +++++----- lib/spells/CSpellHandler.cpp | 8 ++-- 9 files changed, 77 insertions(+), 77 deletions(-) diff --git a/lib/CArtHandler.cpp b/lib/CArtHandler.cpp index af146dd6a..6aade4fd9 100644 --- a/lib/CArtHandler.cpp +++ b/lib/CArtHandler.cpp @@ -360,7 +360,7 @@ ArtifactPosition CArtHandler::stringToSlot(std::string slotName) if (it != artifactPositionMap.end()) return it->second; - logGlobal->warn("Warning! Artifact slot %s not recognized!", slotName); + logMod->warn("Warning! Artifact slot %s not recognized!", slotName); return ArtifactPosition::PRE_FIRST; } @@ -421,7 +421,7 @@ CArtifact::EartClass CArtHandler::stringToClass(std::string className) if (it != artifactClassMap.end()) return it->second; - logGlobal->warn("Warning! Artifact rarity %s not recognized!", className); + logMod->warn("Warning! Artifact rarity %s not recognized!", className); return CArtifact::ART_SPECIAL; } @@ -455,7 +455,7 @@ void CArtHandler::loadType(CArtifact * art, const JsonNode & node) } } else - logGlobal->warn("Warning! Artifact type %s not recognized!", b.String()); + logMod->warn("Warning! Artifact type %s not recognized!", b.String()); } } @@ -679,11 +679,11 @@ void CArtHandler::erasePickedArt(ArtifactID id) artifactList->erase(itr); } else - logGlobal->warn("Problem: cannot erase artifact %s from list, it was not present", art->Name()); + logMod->warn("Problem: cannot erase artifact %s from list, it was not present", art->Name()); } else - logGlobal->warn("Problem: cannot find list for artifact %s, strange class. (special?)", art->Name()); + logMod->warn("Problem: cannot find list for artifact %s, strange class. (special?)", art->Name()); } boost::optional&> CArtHandler::listFromClass( CArtifact::EartClass artifactClass ) @@ -869,7 +869,7 @@ bool CArtifactInstance::canBePutAt(const CArtifactSet *artSet, ArtifactPosition auto possibleSlots = artType->possibleSlots.find(artSet->bearerType()); if(possibleSlots == artType->possibleSlots.end()) { - logGlobal->warn("Warning: artifact %s doesn't have defined allowed slots for bearer of type %s", artType->Name(), artSet->bearerType()); + logMod->warn("Warning: artifact %s doesn't have defined allowed slots for bearer of type %s", artType->Name(), artSet->bearerType()); return false; } @@ -1007,7 +1007,7 @@ SpellID CArtifactInstance::getGivenSpellID() const const auto b = getBonusLocalFirst(Selector::type(Bonus::SPELL)); if(!b) { - logGlobal->warn("Warning: %s doesn't bear any spell!", nodeName()); + logMod->warn("Warning: %s doesn't bear any spell!", nodeName()); return SpellID::NONE; } return SpellID(b->subtype); diff --git a/lib/CHeroHandler.cpp b/lib/CHeroHandler.cpp index cdaf9ab44..301f31d7d 100644 --- a/lib/CHeroHandler.cpp +++ b/lib/CHeroHandler.cpp @@ -362,7 +362,7 @@ void CHeroHandler::loadHeroSkills(CHero * hero, const JsonNode & node) } else { - logGlobal->error("Unknown skill level: %s", set["level"].String()); + logMod->error("Unknown skill level: %s", set["level"].String()); } } diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index c3e0018ff..c83e1c72b 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -37,7 +37,7 @@ CIdentifierStorage::~CIdentifierStorage() void CIdentifierStorage::checkIdentifier(std::string & ID) { if (boost::algorithm::ends_with(ID, ".")) - logGlobal->warn("BIG WARNING: identifier %s seems to be broken!", ID); + logMod->warn("BIG WARNING: identifier %s seems to be broken!", ID); else { size_t pos = 0; @@ -45,7 +45,7 @@ void CIdentifierStorage::checkIdentifier(std::string & ID) { if (std::tolower(ID[pos]) != ID[pos] ) //Not in camelCase { - logGlobal->warn("Warning: identifier %s is not in camelCase!", ID); + logMod->warn("Warning: identifier %s is not in camelCase!", ID); ID[pos] = std::tolower(ID[pos]);// Try to fix the ID } pos = ID.find('.', pos); @@ -149,7 +149,7 @@ boost::optional CIdentifierStorage::getIdentifier(std::string scope, std:: if (idList.size() == 1) return idList.front().id; if (!silent) - logGlobal->error("Failed to resolve identifier %s of type %s from mod %s", name , type ,scope); + logMod->error("Failed to resolve identifier %s of type %s from mod %s", name , type ,scope); return boost::optional(); } @@ -162,7 +162,7 @@ boost::optional CIdentifierStorage::getIdentifier(std::string type, const if (idList.size() == 1) return idList.front().id; if (!silent) - logGlobal->error("Failed to resolve identifier %s of type %s from mod %s", name.String(), type, name.meta); + logMod->error("Failed to resolve identifier %s of type %s from mod %s", name.String(), type, name.meta); return boost::optional(); } @@ -176,7 +176,7 @@ boost::optional CIdentifierStorage::getIdentifier(const JsonNode & name, b if (idList.size() == 1) return idList.front().id; if (!silent) - logGlobal->error("Failed to resolve identifier %s of type %s from mod %s", name.String(), pair2.first, name.meta); + logMod->error("Failed to resolve identifier %s of type %s from mod %s", name.String(), pair2.first, name.meta); return boost::optional(); } @@ -190,7 +190,7 @@ boost::optional CIdentifierStorage::getIdentifier(std::string scope, std:: if (idList.size() == 1) return idList.front().id; if (!silent) - logGlobal->error("Failed to resolve identifier %s of type %s from mod %s", fullName, pair2.first, scope); + logMod->error("Failed to resolve identifier %s of type %s from mod %s", fullName, pair2.first, scope); return boost::optional(); } @@ -280,15 +280,15 @@ bool CIdentifierStorage::resolveIdentifier(const ObjectCallback & request) // error found. Try to generate some debug info if (identifiers.size() == 0) - logGlobal->error("Unknown identifier!"); + logMod->error("Unknown identifier!"); else - logGlobal->error("Ambiguous identifier request!"); + logMod->error("Ambiguous identifier request!"); - logGlobal->error("Request for %s.%s from mod %s", request.type, request.name, request.localScope); + logMod->error("Request for %s.%s from mod %s", request.type, request.name, request.localScope); for (auto id : identifiers) { - logGlobal->error("\tID is available in mod %s", id.scope); + logMod->error("\tID is available in mod %s", id.scope); } return false; } @@ -308,9 +308,9 @@ void CIdentifierStorage::finalize() { for(auto object : registeredObjects) { - logGlobal->trace("%s : %s -> %d", object.second.scope, object.first, object.second.id); + logMod->trace("%s : %s -> %d", object.second.scope, object.first, object.second.id); } - logGlobal->error("All known identifiers were dumped into log file"); + logMod->error("All known identifiers were dumped into log file"); } assert(errorsFound == false); state = FINISHED; @@ -351,9 +351,9 @@ bool CContentHandler::ContentTypeHandler::preloadModData(std::string modName, st // patching this mod? Send warning and continue - this situation can be handled normally if (remoteName == modName) - logGlobal->warn("Redundant namespace definition for %s", objectName); + logMod->warn("Redundant namespace definition for %s", objectName); - logGlobal->trace("Patching object %s (%s) from %s", objectName, remoteName, modName); + logMod->trace("Patching object %s (%s) from %s", objectName, remoteName, modName); JsonNode & remoteConf = modData[remoteName].patches[objectName]; JsonUtils::merge(remoteConf, entry.second); @@ -477,7 +477,7 @@ void CContentHandler::preloadData(CModInfo & mod) bool validate = (mod.validation != CModInfo::PASSED); // print message in format [<8-symbols checksum>] - logGlobal->info("\t\t[%08x]%s", mod.checksum, mod.name); + logMod->info("\t\t[%08x]%s", mod.checksum, mod.name); if (validate && mod.identifier != "core") { @@ -498,12 +498,12 @@ void CContentHandler::load(CModInfo & mod) if (validate) { if (mod.validation != CModInfo::FAILED) - logGlobal->info("\t\t[DONE] %s", mod.name); + logMod->info("\t\t[DONE] %s", mod.name); else - logGlobal->error("\t\t[FAIL] %s", mod.name); + logMod->error("\t\t[FAIL] %s", mod.name); } else - logGlobal->info("\t\t[SKIP] %s", mod.name); + logMod->info("\t\t[SKIP] %s", mod.name); } static JsonNode loadModSettings(std::string path) @@ -629,39 +629,39 @@ void CModHandler::loadConfigFromFile (std::string name) paths += p.string() + ", "; } paths = paths.substr(0, paths.size() - 2); - logGlobal->debug("Loading hardcoded features settings from [%s], result:", paths); + logMod->debug("Loading hardcoded features settings from [%s], result:", paths); settings.data = JsonUtils::assembleFromFiles("config/" + name); const JsonNode & hardcodedFeatures = settings.data["hardcodedFeatures"]; settings.MAX_HEROES_AVAILABLE_PER_PLAYER = hardcodedFeatures["MAX_HEROES_AVAILABLE_PER_PLAYER"].Integer(); - logGlobal->debug("\tMAX_HEROES_AVAILABLE_PER_PLAYER\t%d", settings.MAX_HEROES_AVAILABLE_PER_PLAYER); + logMod->debug("\tMAX_HEROES_AVAILABLE_PER_PLAYER\t%d", settings.MAX_HEROES_AVAILABLE_PER_PLAYER); settings.MAX_HEROES_ON_MAP_PER_PLAYER = hardcodedFeatures["MAX_HEROES_ON_MAP_PER_PLAYER"].Integer(); - logGlobal->debug("\tMAX_HEROES_ON_MAP_PER_PLAYER\t%d", settings.MAX_HEROES_ON_MAP_PER_PLAYER); + logMod->debug("\tMAX_HEROES_ON_MAP_PER_PLAYER\t%d", settings.MAX_HEROES_ON_MAP_PER_PLAYER); settings.CREEP_SIZE = hardcodedFeatures["CREEP_SIZE"].Integer(); - logGlobal->debug("\tCREEP_SIZE\t%d", settings.CREEP_SIZE); + logMod->debug("\tCREEP_SIZE\t%d", settings.CREEP_SIZE); settings.WEEKLY_GROWTH = hardcodedFeatures["WEEKLY_GROWTH_PERCENT"].Integer(); - logGlobal->debug("\tWEEKLY_GROWTH\t%d", settings.WEEKLY_GROWTH); + logMod->debug("\tWEEKLY_GROWTH\t%d", settings.WEEKLY_GROWTH); settings.NEUTRAL_STACK_EXP = hardcodedFeatures["NEUTRAL_STACK_EXP_DAILY"].Integer(); - logGlobal->debug("\tNEUTRAL_STACK_EXP\t%d", settings.NEUTRAL_STACK_EXP); + logMod->debug("\tNEUTRAL_STACK_EXP\t%d", settings.NEUTRAL_STACK_EXP); settings.MAX_BUILDING_PER_TURN = hardcodedFeatures["MAX_BUILDING_PER_TURN"].Integer(); - logGlobal->debug("\tMAX_BUILDING_PER_TURN\t%d", settings.MAX_BUILDING_PER_TURN); + logMod->debug("\tMAX_BUILDING_PER_TURN\t%d", settings.MAX_BUILDING_PER_TURN); settings.DWELLINGS_ACCUMULATE_CREATURES = hardcodedFeatures["DWELLINGS_ACCUMULATE_CREATURES"].Bool(); - logGlobal->debug("\tDWELLINGS_ACCUMULATE_CREATURES\t%d", static_cast(settings.DWELLINGS_ACCUMULATE_CREATURES)); + logMod->debug("\tDWELLINGS_ACCUMULATE_CREATURES\t%d", static_cast(settings.DWELLINGS_ACCUMULATE_CREATURES)); settings.ALL_CREATURES_GET_DOUBLE_MONTHS = hardcodedFeatures["ALL_CREATURES_GET_DOUBLE_MONTHS"].Bool(); - logGlobal->debug("\tALL_CREATURES_GET_DOUBLE_MONTHS\t%d", static_cast(settings.ALL_CREATURES_GET_DOUBLE_MONTHS)); + logMod->debug("\tALL_CREATURES_GET_DOUBLE_MONTHS\t%d", static_cast(settings.ALL_CREATURES_GET_DOUBLE_MONTHS)); settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS = hardcodedFeatures["WINNING_HERO_WITH_NO_TROOPS_RETREATS"].Bool(); - logGlobal->debug("\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t%d", static_cast(settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS)); + logMod->debug("\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t%d", static_cast(settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS)); settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = hardcodedFeatures["BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE"].Bool(); - logGlobal->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", static_cast(settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE)); + logMod->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", static_cast(settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE)); const JsonNode & gameModules = settings.data["modules"]; modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool(); - logGlobal->debug("\tSTACK_EXP\t%d", static_cast(modules.STACK_EXP)); + logMod->debug("\tSTACK_EXP\t%d", static_cast(modules.STACK_EXP)); modules.STACK_ARTIFACT = gameModules["STACK_ARTIFACTS"].Bool(); - logGlobal->debug("\tSTACK_ARTIFACT\t%d", static_cast(modules.STACK_ARTIFACT)); + logMod->debug("\tSTACK_ARTIFACT\t%d", static_cast(modules.STACK_ARTIFACT)); modules.COMMANDERS = gameModules["COMMANDERS"].Bool(); - logGlobal->debug("\tCOMMANDERS\t%d", static_cast(modules.COMMANDERS)); + logMod->debug("\tCOMMANDERS\t%d", static_cast(modules.COMMANDERS)); modules.MITHRIL = gameModules["MITHRIL"].Bool(); - logGlobal->debug("\tMITHRIL\t%d", static_cast(modules.MITHRIL)); + logMod->debug("\tMITHRIL\t%d", static_cast(modules.MITHRIL)); } // currentList is passed by value to get current list of depending mods @@ -672,8 +672,8 @@ bool CModHandler::hasCircularDependency(TModID modID, std::set currentL // Mod already present? We found a loop if (vstd::contains(currentList, modID)) { - logGlobal->error("Error: Circular dependency detected! Printing dependency list:"); - logGlobal->error("\t%s -> ", mod.name); + logMod->error("Error: Circular dependency detected! Printing dependency list:"); + logMod->error("\t%s -> ", mod.name); return true; } @@ -684,7 +684,7 @@ bool CModHandler::hasCircularDependency(TModID modID, std::set currentL { if (hasCircularDependency(dependency, currentList)) { - logGlobal->error("\t%s ->\n", mod.name); // conflict detected, print dependency list + logMod->error("\t%s ->\n", mod.name); // conflict detected, print dependency list return true; } } @@ -701,7 +701,7 @@ bool CModHandler::checkDependencies(const std::vector & input) const { if (!vstd::contains(input, dep)) { - logGlobal->error("Error: Mod %s requires missing %s!", mod.name, dep); + logMod->error("Error: Mod %s requires missing %s!", mod.name, dep); return false; } } @@ -710,7 +710,7 @@ bool CModHandler::checkDependencies(const std::vector & input) const { if (vstd::contains(input, conflicting)) { - logGlobal->error("Error: Mod %s conflicts with %s!", mod.name, allMods.at(conflicting).name); + logMod->error("Error: Mod %s conflicts with %s!", mod.name, allMods.at(conflicting).name); return false; } } @@ -941,11 +941,11 @@ void CModHandler::load() CStopWatch totalTime, timer; CContentHandler content; - logGlobal->info("\tInitializing content handler: %d ms", timer.getDiff()); + logMod->info("\tInitializing content handler: %d ms", timer.getDiff()); for(const TModID & modName : activeMods) { - logGlobal->trace("Generating checksum for %s", modName); + logMod->trace("Generating checksum for %s", modName); allMods[modName].updateChecksum(calculateModChecksum(modName, CResourceHandler::get(modName))); } @@ -954,7 +954,7 @@ void CModHandler::load() content.preloadData(coreMod); for(const TModID & modName : activeMods) content.preloadData(allMods[modName]); - logGlobal->info("\tParsing mod data: %d ms", timer.getDiff()); + logMod->info("\tParsing mod data: %d ms", timer.getDiff()); content.load(coreMod); for(const TModID & modName : activeMods) @@ -962,17 +962,17 @@ void CModHandler::load() content.loadCustom(); - logGlobal->info("\tLoading mod data: %d ms", timer.getDiff()); + logMod->info("\tLoading mod data: %d ms", timer.getDiff()); VLC->creh->loadCrExpBon(); VLC->creh->buildBonusTreeForTiers(); //do that after all new creatures are loaded identifiers.finalize(); - logGlobal->info("\tResolving identifiers: %d ms", timer.getDiff()); + logMod->info("\tResolving identifiers: %d ms", timer.getDiff()); content.afterLoadFinalization(); - logGlobal->info("\tHandlers post-load finalization: %d ms ", timer.getDiff()); - logGlobal->info("\tAll game content loaded in %d ms", totalTime.getDiff()); + logMod->info("\tHandlers post-load finalization: %d ms ", timer.getDiff()); + logMod->info("\tAll game content loaded in %d ms", totalTime.getDiff()); } void CModHandler::afterLoad() diff --git a/lib/CSkillHandler.cpp b/lib/CSkillHandler.cpp index 4e73967cb..1fe1e1adf 100644 --- a/lib/CSkillHandler.cpp +++ b/lib/CSkillHandler.cpp @@ -183,7 +183,7 @@ CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string & if(!skill) { - logGlobal->error("unknown secondary skill %s", identifier); + logMod->error("unknown secondary skill %s", identifier); throw std::runtime_error("invalid skill"); } diff --git a/lib/CTownHandler.cpp b/lib/CTownHandler.cpp index d71d3bb3a..40e389435 100644 --- a/lib/CTownHandler.cpp +++ b/lib/CTownHandler.cpp @@ -748,7 +748,7 @@ void CTownHandler::loadObject(std::string scope, std::string name, const JsonNod auto & advMap = data["town"]["adventureMap"]; if (!advMap.isNull()) { - logGlobal->warn("Outdated town mod. Will try to generate valid templates out of fort"); + logMod->warn("Outdated town mod. Will try to generate valid templates out of fort"); JsonNode config; config["animation"] = advMap["castle"]; VLC->objtypeh->getHandlerFor(index, object->index)->addTemplate(config); @@ -818,9 +818,9 @@ void CTownHandler::initializeRequirements() { if (node.Vector().size() > 1) { - logGlobal->warn("Unexpected length of town buildings requirements: %d", node.Vector().size()); - logGlobal->warn("Entry contains: "); - logGlobal->warn(node.toJson()); + logMod->warn("Unexpected length of town buildings requirements: %d", node.Vector().size()); + logMod->warn("Entry contains: "); + logMod->warn(node.toJson()); } return BuildingID(VLC->modh->identifiers.getIdentifier(requirement.town->getBuildingScope(), node.Vector()[0]).get()); }); diff --git a/lib/IHandlerBase.h b/lib/IHandlerBase.h index 5e6125e69..024e7968f 100644 --- a/lib/IHandlerBase.h +++ b/lib/IHandlerBase.h @@ -94,7 +94,7 @@ public: if (raw_id < 0 || raw_id >= objects.size()) { - logGlobal->error("%s id %d is invalid", getTypeName(), static_cast(raw_id)); + logMod->error("%s id %d is invalid", getTypeName(), static_cast(raw_id)); throw std::runtime_error("internal error"); } diff --git a/lib/JsonDetail.cpp b/lib/JsonDetail.cpp index bd7de69f4..b56b8d4b9 100644 --- a/lib/JsonDetail.cpp +++ b/lib/JsonDetail.cpp @@ -163,8 +163,8 @@ JsonNode JsonParser::parse(std::string fileName) if (!errors.empty()) { - logGlobal->warn("File %s is not a valid JSON file!", fileName); - logGlobal->warn(errors); + logMod->warn("File %s is not a valid JSON file!", fileName); + logMod->warn(errors); } return root; } diff --git a/lib/JsonNode.cpp b/lib/JsonNode.cpp index b16d7d385..e00453ed4 100644 --- a/lib/JsonNode.cpp +++ b/lib/JsonNode.cpp @@ -395,7 +395,7 @@ std::shared_ptr JsonUtils::parseBonus (const JsonVector &ability_vec) //T auto it = bonusNameMap.find(type); if (it == bonusNameMap.end()) { - logGlobal->error("Error: invalid ability type %s", type); + logMod->error("Error: invalid ability type %s", type); return b; } b->type = it->second; @@ -413,7 +413,7 @@ const T & parseByMap(const std::map & map, const JsonNode * val, auto it = map.find(type); if (it == map.end()) { - logGlobal->error("Error: invalid %s%s", err, type); + logMod->error("Error: invalid %s%s", err, type); return defaultValue; } else @@ -445,7 +445,7 @@ void JsonUtils::resolveIdentifier(si32 &var, const JsonNode &node, std::string n }); break; default: - logGlobal->error("Error! Wrong identifier used for value of %s", name); + logMod->error("Error! Wrong identifier used for value of %s", name); } } } @@ -467,7 +467,7 @@ void JsonUtils::resolveIdentifier(const JsonNode &node, si32 &var) }); break; default: - logGlobal->error("Error! Wrong identifier used for identifier!"); + logMod->error("Error! Wrong identifier used for identifier!"); } } @@ -489,7 +489,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b) auto it = bonusNameMap.find(type); if (it == bonusNameMap.end()) { - logGlobal->error("Error: invalid ability type %s", type); + logMod->error("Error: invalid ability type %s", type); return false; } b->type = it->second; @@ -533,7 +533,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b) } break; default: - logGlobal->error("Error! Wrong bonus duration format."); + logMod->error("Error! Wrong bonus duration format."); } } @@ -580,7 +580,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b) auto it = bonusNameMap.find(anotherBonusType); if (it == bonusNameMap.end()) { - logGlobal->error("Error: invalid ability type %s", anotherBonusType); + logMod->error("Error: invalid ability type %s", anotherBonusType); continue; } l2->type = it->second; @@ -723,8 +723,8 @@ bool JsonUtils::validate(const JsonNode &node, std::string schemaName, std::stri std::string log = Validation::check(schemaName, node); if (!log.empty()) { - logGlobal->warn("Data in %s is invalid!", dataName); - logGlobal->warn(log); + logMod->warn("Data in %s is invalid!", dataName); + logMod->warn(log); } return log.empty(); } @@ -745,7 +745,7 @@ const JsonNode & getSchemaByName(std::string name) return loadedSchemas[name]; } - logGlobal->error("Error: missing schema with name %s!", name); + logMod->error("Error: missing schema with name %s!", name); assert(0); return nullNode; } @@ -756,7 +756,7 @@ const JsonNode & JsonUtils::getSchema(std::string URI) size_t posHash = URI.find('#'); if(posColon == std::string::npos) { - logGlobal->error("Invalid schema URI:%s", URI); + logMod->error("Invalid schema URI:%s", URI); return nullNode; } @@ -765,7 +765,7 @@ const JsonNode & JsonUtils::getSchema(std::string URI) if(protocolName != "vcmi") { - logGlobal->error("Error: unsupported URI protocol for schema: %s", URI); + logMod->error("Error: unsupported URI protocol for schema: %s", URI); return nullNode; } diff --git a/lib/spells/CSpellHandler.cpp b/lib/spells/CSpellHandler.cpp index db85e254e..bd0b72ed4 100644 --- a/lib/spells/CSpellHandler.cpp +++ b/lib/spells/CSpellHandler.cpp @@ -819,7 +819,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode & json, const std::string & spell->name = json["name"].String(); - logGlobal->trace("%s: loading spell %s", __FUNCTION__, spell->name); + logMod->trace("%s: loading spell %s", __FUNCTION__, spell->name); const auto schoolNames = json["school"]; @@ -854,7 +854,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode & json, const std::string & else if(targetType == "LOCATION") spell->targetType = CSpell::LOCATION; else - logGlobal->warn("Spell %s: target type %s - assumed NO_TARGET.", spell->name, (targetType.empty() ? "empty" : "unknown ("+targetType+")")); + logMod->warn("Spell %s: target type %s - assumed NO_TARGET.", spell->name, (targetType.empty() ? "empty" : "unknown ("+targetType+")")); for(const auto & counteredSpell: json["counters"].Struct()) if (counteredSpell.second.Bool()) @@ -899,7 +899,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode & json, const std::string & else if(!implicitPositiveness) { spell->positiveness = CSpell::NEUTRAL; //duplicates constructor but, just in case - logGlobal->error("Spell %s: no positiveness specified, assumed NEUTRAL.", spell->name); + logMod->error("Spell %s: no positiveness specified, assumed NEUTRAL.", spell->name); } spell->isSpecial = flags["special"].Bool(); @@ -909,7 +909,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode & json, const std::string & auto it = bonusNameMap.find(name); if(it == bonusNameMap.end()) { - logGlobal->error("Spell %s: invalid bonus name %s", spell->name, name); + logMod->error("Spell %s: invalid bonus name %s", spell->name, name); } else {