mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-02 00:10:22 +02:00
fixed logging after rebase
This commit is contained in:
parent
91fac7755a
commit
c9ef773da0
@ -190,3 +190,4 @@ extern DLL_LINKAGE vstd::CLoggerBase * logBonus;
|
||||
extern DLL_LINKAGE vstd::CLoggerBase * logNetwork;
|
||||
extern DLL_LINKAGE vstd::CLoggerBase * logAi;
|
||||
extern DLL_LINKAGE vstd::CLoggerBase * logAnim;
|
||||
extern DLL_LINKAGE vstd::CLoggerBase * logMod;
|
||||
|
@ -207,7 +207,7 @@ void CIdentifierStorage::registerObject(std::string scope, std::string type, std
|
||||
std::pair<const std::string, ObjectData> mapping = std::make_pair(fullID, data);
|
||||
if(!vstd::containsMapping(registeredObjects, mapping))
|
||||
{
|
||||
CLogger::getLogger(CLoggerDomain("identifier"))->traceStream() << "registered " << fullID << " as " << scope << ":" << identifier;
|
||||
logMod->trace("registered %s as %s:%s", fullID, scope, identifier);
|
||||
registeredObjects.insert(mapping);
|
||||
}
|
||||
}
|
||||
@ -377,7 +377,6 @@ bool CContentHandler::ContentTypeHandler::loadMod(std::string modName, bool vali
|
||||
if (!modInfo.patches.isNull())
|
||||
JsonUtils::merge(modInfo.modData, modInfo.patches);
|
||||
|
||||
CLogger * logger = CLogger::getLogger(CLoggerDomain("mod"));
|
||||
for(auto & entry : modInfo.modData.Struct())
|
||||
{
|
||||
const std::string & name = entry.first;
|
||||
@ -390,7 +389,7 @@ bool CContentHandler::ContentTypeHandler::loadMod(std::string modName, bool vali
|
||||
|
||||
if (originalData.size() > index)
|
||||
{
|
||||
logger->traceStream() << "found original data in loadMod(" << name << ") at index " << index;
|
||||
logMod->trace("found original data in loadMod(%s) at index %d", name, index);
|
||||
JsonUtils::merge(originalData[index], data);
|
||||
performValidate(originalData[index],name);
|
||||
handler->loadObject(modName, name, originalData[index], index);
|
||||
@ -398,14 +397,7 @@ bool CContentHandler::ContentTypeHandler::loadMod(std::string modName, bool vali
|
||||
}
|
||||
else
|
||||
{
|
||||
// trace only name field of original data - I miss list comprehension
|
||||
std::vector<std::string> originalNames;
|
||||
for (const JsonNode & orgElem : originalData)
|
||||
originalNames.push_back(orgElem["name"].String());
|
||||
logger->debugStream() << "no original data in loadMod(" << name << ") at index " << index;
|
||||
logger->traceStream() << "originalData: " << originalNames;
|
||||
logger->traceStream() << "new data: " << data;
|
||||
|
||||
logMod->debug("no original data in loadMod(%s) at index %d", name, index);
|
||||
performValidate(data, name);
|
||||
handler->loadObject(modName, name, data, index);
|
||||
}
|
||||
|
@ -76,12 +76,25 @@ const std::string & CSkill::getDescription(int level) const
|
||||
|
||||
DLL_LINKAGE std::ostream & operator<<(std::ostream &out, const CSkill::LevelInfo &info)
|
||||
{
|
||||
return out << "(\"" << info.description << "\"," << info.effects << ")";
|
||||
out << "(\"" << info.description << "\", [";
|
||||
for(int i=0; i < info.effects.size(); i++)
|
||||
out << (i ? "," : "") << info.effects[i]->Description();
|
||||
return out << "])";
|
||||
}
|
||||
|
||||
DLL_LINKAGE std::ostream & operator<<(std::ostream &out, const CSkill &skill)
|
||||
{
|
||||
return out << "Skill(" << (int)skill.id << "," << skill.identifier << "): " << skill.levels;
|
||||
out << "Skill(" << (int)skill.id << "," << skill.identifier << "): [";
|
||||
for(int i=0; i < skill.levels.size(); i++)
|
||||
out << (i ? "," : "") << skill.levels[i];
|
||||
return out << "]";
|
||||
}
|
||||
|
||||
std::string CSkill::toString() const
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << *this;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
///CSkillHandler
|
||||
@ -123,7 +136,7 @@ CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string &
|
||||
|
||||
if(!skill)
|
||||
{
|
||||
logGlobal->errorStream() << "unknown secondary skill " << identifier;
|
||||
logGlobal->error("unknown secondary skill %s", identifier);
|
||||
throw std::runtime_error("invalid skill");
|
||||
}
|
||||
|
||||
@ -143,9 +156,8 @@ CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string &
|
||||
//CGI->generaltexth->skillInfoTexts[skill->id][level-1] = levelNode["description"].String();
|
||||
skill->setDescription(levelNode["description"].String(), level);
|
||||
}
|
||||
CLogger * logger = CLogger::getLogger(CLoggerDomain(getTypeName()));
|
||||
logger->debugStream() << "loaded secondary skill " << identifier << "(" << (int)skill->id << ")";
|
||||
logger->traceStream() << *skill;
|
||||
logMod->debug("loaded secondary skill %s(%d)", identifier, (int)skill->id);
|
||||
logMod->trace("%s", skill->toString());
|
||||
|
||||
return skill;
|
||||
}
|
||||
@ -180,10 +192,6 @@ void CSkillHandler::loadObject(std::string scope, std::string name, const JsonNo
|
||||
|
||||
void CSkillHandler::afterLoadFinalization()
|
||||
{
|
||||
CLogger * logger = CLogger::getLogger(CLoggerDomain(getTypeName()));
|
||||
logger->traceStream() << "skill handler after load: ";
|
||||
for(auto skill : objects)
|
||||
logger->traceStream() << *skill;
|
||||
}
|
||||
|
||||
void CSkillHandler::beforeValidate(JsonNode & object)
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
void setDescription(const std::string & desc, int level);
|
||||
const std::vector<std::shared_ptr<Bonus>> & getBonus(int level) const;
|
||||
const std::string & getDescription(int level) const;
|
||||
std::string toString() const;
|
||||
|
||||
SecondarySkill id;
|
||||
std::string identifier;
|
||||
|
@ -83,6 +83,7 @@ DLL_LINKAGE vstd::CLoggerBase * logBonus = CLogger::getLogger(CLoggerDomain("bon
|
||||
DLL_LINKAGE vstd::CLoggerBase * logNetwork = CLogger::getLogger(CLoggerDomain("network"));
|
||||
DLL_LINKAGE vstd::CLoggerBase * logAi = CLogger::getLogger(CLoggerDomain("ai"));
|
||||
DLL_LINKAGE vstd::CLoggerBase * logAnim = CLogger::getLogger(CLoggerDomain("animation"));
|
||||
DLL_LINKAGE vstd::CLoggerBase * logMod = CLogger::getLogger(CLoggerDomain("mod"));
|
||||
|
||||
CLogger * CLogger::getLogger(const CLoggerDomain & domain)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user