1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Logging cleanup 3

This commit is contained in:
AlexVinS
2017-08-10 20:17:10 +03:00
parent 61e241308d
commit 85e952f25f
13 changed files with 26 additions and 27 deletions

View File

@@ -1154,7 +1154,7 @@ void CGTownInstance::setVisitingHero(CGHeroInstance *h)
{
//if (!(!!visitingHero == !h))
//{
// logGlobal->warnStream() << boost::format("Hero visiting town %s is %s ") % name % (visitingHero.get() ? visitingHero->name : "NULL");
// logGlobal->warn("Hero visiting town %s is %s ", name, (visitingHero.get() ? visitingHero->name : "NULL"));
// logGlobal->warn("New hero will be %s ", (h ? h->name : "NULL"));
//
//}

View File

@@ -1049,7 +1049,7 @@ void CGKeys::setPropertyDer (ui8 what, ui32 val) //101-108 - enable key for play
playerKeyMap[player].insert((ui8)val);
}
else
logGlobal->errorStream() << boost::format("Unexpected properties requested to set: what=%d, val=%d") % (int)what % val;
logGlobal->error("Unexpected properties requested to set: what=%d, val=%d", (int)what, val);
}
bool CGKeys::wasMyColorVisited (PlayerColor player) const

View File

@@ -575,14 +575,14 @@ void CDrawTerrainOperation::updateTerrainTypes()
{
const auto & centerPos = *(positions.begin());
auto centerTile = map->getTile(centerPos);
//logGlobal->debugStream() << boost::format("Set terrain tile at pos '%s' to type '%s'") % centerPos % centerTile.terType;
//logGlobal->debug("Set terrain tile at pos '%s' to type '%s'", centerPos, centerTile.terType);
auto tiles = getInvalidTiles(centerPos);
auto updateTerrainType = [&](const int3 & pos)
{
map->getTile(pos).terType = centerTile.terType;
positions.insert(pos);
invalidateTerrainViews(pos);
//logGlobal->debugStream() << boost::format("Set additional terrain tile at pos '%s' to type '%s'") % pos % centerTile.terType;
//logGlobal->debug("Set additional terrain tile at pos '%s' to type '%s'", pos, centerTile.terType);
};
// Fill foreign invalid tiles

View File

@@ -810,7 +810,7 @@ void CMapLoaderH3M::loadArtifactsOfHero(CGHeroInstance * hero)
{
if(hero->artifactsWorn.size() || hero->artifactsInBackpack.size())
{
logGlobal->warnStream() << boost::format("Hero %s at %s has set artifacts twice (in map properties and on adventure map instance). Using the latter set...") % hero->name % hero->pos;
logGlobal->warn("Hero %s at %s has set artifacts twice (in map properties and on adventure map instance). Using the latter set...", hero->name, hero->pos);
hero->artifactsInBackpack.clear();
while(hero->artifactsWorn.size())
hero->eraseArtSlot(hero->artifactsWorn.begin()->first);
@@ -1622,7 +1622,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven, const i
if(nhi->secSkills.size())
{
nhi->secSkills.clear();
//logGlobal->warnStream() << boost::format("Hero %s subID=%d has set secondary skills twice (in map properties and on adventure map instance). Using the latter set...") % nhi->name % nhi->subID;
//logGlobal->warn("Hero %s subID=%d has set secondary skills twice (in map properties and on adventure map instance). Using the latter set...", nhi->name, nhi->subID);
}
int howMany = reader.readUInt32();
@@ -1680,7 +1680,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven, const i
if(nhi->spells.size())
{
nhi->clear();
logGlobal->warnStream() << boost::format("Hero %s subID=%d has spells set twice (in map properties and on adventure map instance). Using the latter set...") % nhi->name % nhi->subID;
logGlobal->warn("Hero %s subID=%d has spells set twice (in map properties and on adventure map instance). Using the latter set...", nhi->name, nhi->subID);
}
if(hasCustomSpells)
@@ -1713,7 +1713,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven, const i
.And(Selector::sourceType(Bonus::HERO_BASE_SKILL)), nullptr);
if(ps->size())
{
logGlobal->warnStream() << boost::format("Hero %s subID=%d has set primary skills twice (in map properties and on adventure map instance). Using the latter set...") % nhi->name % nhi->subID;
logGlobal->warn("Hero %s subID=%d has set primary skills twice (in map properties and on adventure map instance). Using the latter set...", nhi->name, nhi->subID);
for(auto b : *ps)
nhi->removeBonus(b);
}

View File

@@ -292,10 +292,10 @@ void CMapGenOptions::finalize(CRandomGenerator & rand)
default:
assert(false);
}
logGlobal->traceStream() << boost::format("Player %d: %s") % player.second.getColor() % playerType;
logGlobal->trace("Player %d: %s", player.second.getColor(), playerType);
}
setCompOnlyPlayerCount(cpuOnlyPlayers); //human players are set automaticlaly (?)
logGlobal->infoStream() << boost::format("Final player config: %d total, %d cpu-only") % players.size() % (int)getCompOnlyPlayerCount();
logGlobal->info("Final player config: %d total, %d cpu-only", players.size(), (int)getCompOnlyPlayerCount());
}
void CMapGenOptions::updatePlayers()
@@ -340,7 +340,7 @@ void CMapGenOptions::updateCompOnlyPlayers()
if (compOnlyPlayersToAdd < 0)
{
logGlobal->errorStream() << boost::format("Incorrect number of players to add. Requested players %d, current players %d") % playerCount % players.size();
logGlobal->error("Incorrect number of players to add. Requested players %d, current players %d", playerCount, players.size());
assert (compOnlyPlayersToAdd < 0);
}
for(int i = 0; i < compOnlyPlayersToAdd; ++i)

View File

@@ -461,7 +461,7 @@ void CMapGenerator::createObstaclesCommon2()
}
}
}
logGlobal->traceStream() << boost::format("Set %d tiles to BLOCKED and %d tiles to FREE") % blockedTiles % freeTiles;
logGlobal->trace("Set %d tiles to BLOCKED and %d tiles to FREE", blockedTiles, freeTiles);
}
}

View File

@@ -228,7 +228,7 @@ void CRmgTemplateStorage::loadObject(std::string scope, std::string name, const
}
catch(const std::exception & e)
{
logGlobal->errorStream() << boost::format("Template %s has errors. Message: %s.") % tpl->getName() % std::string(e.what());
logGlobal->error("Template %s has errors. Message: %s.", tpl->getName(), std::string(e.what()));
}
}

View File

@@ -839,7 +839,7 @@ bool CRmgTemplateZone::createRoad(CMapGenerator* gen, const int3& src, const int
}
}
logGlobal->warnStream() << boost::format("Failed to create road from %s to %s") % src %dst;
logGlobal->warn("Failed to create road from %s to %s", src, dst);
return false;
}
@@ -1927,7 +1927,7 @@ bool CRmgTemplateZone::findPlaceForTreasurePile(CMapGenerator* gen, float min_di
bool needsGuard = value > minGuardedValue;
//logGlobal->infoStream() << boost::format("Min dist for density %f is %d") % density % min_dist;
//logGlobal->info("Min dist for density %f is %d", density, min_dist);
for(auto tile : possibleTiles)
{
auto dist = gen->getNearestObjectDistance(tile);
@@ -2099,7 +2099,7 @@ void CRmgTemplateZone::checkAndPlaceObject(CMapGenerator* gen, CGObjectInstance*
void CRmgTemplateZone::placeObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos, bool updateDistance)
{
//logGlobal->traceStream() << boost::format("Inserting object at %d %d") % pos.x % pos.y;
//logGlobal->trace("Inserting object at %d %d", pos.x, pos.y);
checkAndPlaceObject (gen, object, pos);

View File

@@ -147,7 +147,7 @@ void CZonePlacer::placeZones(const CMapGenOptions * mapGenOptions, CRandomGenera
}
}
logGlobal->traceStream() << boost::format("Best fitness reached: total distance %2.4f, total overlap %2.4f") % bestTotalDistance % bestTotalOverlap;
logGlobal->trace("Best fitness reached: total distance %2.4f, total overlap %2.4f", bestTotalDistance, bestTotalOverlap);
for (auto zone : zones) //finalize zone positions
{
zone.second->setPos (cords (bestSolution[zone.second]));