1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Change logging style

This commit is contained in:
Vadim Markovtsev 2016-10-03 20:32:01 +02:00
parent eac5aab396
commit 34cf92cb9b
7 changed files with 19 additions and 18 deletions

View File

@ -655,7 +655,7 @@ void CClient::handlePack( CPack * pack )
{
if (pack == nullptr)
{
logNetwork->errorStream() << "Dropping nullptr CPack! You should check whether client and server ABI matches.";
logNetwork->error("Dropping nullptr CPack! You should check whether client and server ABI matches.");
return;
}
CBaseForCLApply *apply = applier->apps[typeList.getTypeID(pack)]; //find the applier
@ -663,16 +663,16 @@ void CClient::handlePack( CPack * pack )
{
boost::unique_lock<boost::recursive_mutex> guiLock(*LOCPLINT->pim);
apply->applyOnClBefore(this, pack);
logNetwork->traceStream() << "\tMade first apply on cl";
logNetwork->trace("\tMade first apply on cl");
gs->apply(pack);
logNetwork->traceStream() << "\tApplied on gs";
logNetwork->trace("\tApplied on gs");
apply->applyOnClAfter(this, pack);
logNetwork->traceStream() << "\tMade second apply on cl";
logNetwork->trace("\tMade second apply on cl");
}
else
{
logNetwork->errorStream() << "Message cannot be applied, cannot find applier! type "
<< pack->type << " - " << typeList.getTypeInfo(pack)->name();
logNetwork->error("Message cannot be applied, cannot find applier! type %d - %s",
pack->type, typeList.getTypeInfo(pack)->name());
}
delete pack;
}

View File

@ -472,7 +472,7 @@ CAdvMapInt::CAdvMapInt():
else
{
bgWorldView = nullptr;
logGlobal->warnStream() << "ADVOPT.worldViewGraphic is empty => bitmap not loaded";
logGlobal->warn("ADVOPT.worldViewGraphic is empty => bitmap not loaded");
}
scrollingDir = 0;
updateScreen = false;

View File

@ -599,7 +599,8 @@ int CLoadIntegrityValidator::read( void * data, unsigned size )
controlFile->read(controlData.data(), size);
if(std::memcmp(data, controlData.data(), size))
{
logGlobal->errorStream() << "Desync found! Position: " << primaryFile->sfile->tellg();
logGlobal->error("Save game format mismatch detected! Position: %d",
primaryFile->sfile->tellg());
foundDesync = true;
//throw std::runtime_error("Savegame dsynchronized!");
}

View File

@ -1311,7 +1311,7 @@ public:
auto loader = loaders[tid];
if (loader == nullptr)
{
logGlobal->errorStream() << "loadPointerHlp " << tid << " " << pid << " - no loader exists";
logGlobal->error("loadPointerHlp %d %d - no loader exists", tid, pid);
data = nullptr;
return;
}

View File

@ -34,7 +34,7 @@ void CBasicLogConfigurator::configure()
// Set log level
std::string level = loggerNode["level"].String();
logger->setLevel(getLogLevel(level));
logGlobal->debugStream() << "Set log level " << name << " => " << level;
logGlobal->debug("Set log level %s => %d", name, level);
}
}
CLogger::getGlobalLogger()->clearTargets();
@ -80,15 +80,15 @@ void CBasicLogConfigurator::configure()
}
catch(const std::exception & e)
{
logGlobal->errorStream() << "Could not initialize the logging system due to configuration error/s."
<< "The logging system can be in a corrupted state. " << e.what();
logGlobal->error("Could not initialize the logging system due to configuration error/s."
"The logging system can be in a corrupted state. %s", e.what());
}
logGlobal->infoStream() << "Initialized logging system based on settings successfully.";
logGlobal->info("Initialized logging system based on settings successfully.");
for (auto& domain : CLogManager::get().getRegisteredDomains())
{
logGlobal->infoStream() << "[log level] " << domain << " => " <<
ELogLevel::to_string(CLogger::getLogger(CLoggerDomain(domain))->getLevel());
logGlobal->info("[log level] %s => %s", domain,
ELogLevel::to_string(CLogger::getLogger(CLoggerDomain(domain))->getLevel()));
}
}

View File

@ -82,7 +82,7 @@ CLogger * CLogger::getLogger(const CLoggerDomain & domain)
CLogManager::get().addLogger(logger);
if (logGlobal != nullptr)
{
logGlobal->debugStream() << "Created logger " << domain.getName();
logGlobal->debug("Created logger %s", domain.getName());
}
}
return logger;

View File

@ -943,7 +943,7 @@ void CGameHandler::handleConnection(std::set<PlayerColor> players, CConnection &
packType = typeList.getTypeID(pack); //get the id of type
logGlobal->trace("Received client message (request %d by player %d (%s)) of type with ID=%d (%s).\n",
requestID, player, player.getStr(), packType, typeid(*pack).name());
requestID, player, player.getStr(), packType, typeid(*pack).name());
}
//prepare struct informing that action was applied
@ -967,7 +967,7 @@ void CGameHandler::handleConnection(std::set<PlayerColor> players, CConnection &
{
const bool result = apply->applyOnGH(this, &c, pack, player);
if(result)
logGlobal->traceStream() << "Message " << typeid(*pack).name() << " successfully applied!";
logGlobal->trace("Message %s successfully applied!", typeid(*pack).name());
else
complain((boost::format("Got false in applying %s... that request must have been fishy!")
% typeid(*pack).name()).str());