本文整理汇总了C++中nlmisc::CLog类的典型用法代码示例。如果您正苦于以下问题:C++ CLog类的具体用法?C++ CLog怎么用?C++ CLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CDirectoryRateStat::display(NLMISC::CLog& log)
{
uint pathsize = 0;
TDirectoryMap::iterator first = _DirectoryMap.begin(), last = _DirectoryMap.end();
for (; first != last; ++first)
if ((*first).first.size() > pathsize)
pathsize = (uint)(*first).first.size();
NLMISC::TTime limit = NLMISC::CTime::getLocalTime()-60*1000;
std::string format = "%-"+NLMISC::toString(pathsize)+"s %6s %10s %6s %10s";
log.displayNL(format.c_str(), "directory", "rdfile", "read", "wrfile", "write");
for (first=_DirectoryMap.begin(); first != last; ++first)
{
(*first).second.updateTime(limit);
uint64 rdrate = (*first).second.ReadBytes/60;
uint64 wrrate = (*first).second.WrittenBytes/60;
log.displayNL(format.c_str(),
(*first).first.c_str(),
NLMISC::toString((*first).second.ReadFiles).c_str(),
(NLMISC::bytesToHumanReadable(uint32(rdrate))+"/s").c_str(),
NLMISC::toString((*first).second.WrittenFiles).c_str(),
(NLMISC::bytesToHumanReadable(uint32(wrrate))+"/s").c_str());
}
}
示例2: dump
void CFileReceiver::dump(NLMISC::CLog& log) const
{
log.displayNL("-----------------------------------");
log.displayNL("File requests");
log.displayNL("-----------------------------------");
for (TFileRequests::const_iterator fit= _FileRequests.begin(); fit!= _FileRequests.end(); ++fit)
{
SFileRequest& request= *(*fit);
log.displayNL("- File: '%s' %s (%d..%d/%d)",
request.FileName.c_str(),
(request.Emitter==NULL)? "No emitter": request.Emitter->getModuleName().c_str(),
request.DataSoFar.size(),
request.TotalDataRequested,
request.ExpectedFileSize );
}
log.displayNL("-----------------------------------");
log.displayNL("Connected proxies");
log.displayNL("-----------------------------------");
for (TProxies::const_iterator pit= _Proxies.begin(); pit!= _Proxies.end(); ++pit)
{
log.displayNL("- Repository %s (%d files): Current Request: %s",
pit->second.Proxy->getModuleName().c_str(),
pit->second.FileInfo.size(),
(pit->second.CurrentRequest==NULL)? "None": pit->second.CurrentRequest->FileName.c_str());
}
log.displayNL("-----------------------------------");
}
示例3: dumpBuilding
//----------------------------------------------------------------------------
void CBuildingPhysicalPlayer::dumpBuilding(NLMISC::CLog & log) const
{
log.displayNL("<BUILDING_DUMP> CBuildingPhysicalPlayer");
log.displayNL("Name: %s, alias: %s", _Name.c_str(), CPrimitivesParser::aliasToString( _Alias ).c_str());
for (uint i = 0; i < _UsersInside.size(); i++)
{
const TDataSetRow rowId = _UsersInside[i];
CCharacter * c = PlayerManager.getChar( rowId );
if ( !c )
{
log.displayNL("\tError: cannot find character with row id: %s", rowId.toString().c_str());
continue;
}
const string charName = c->getName().toUtf8();
const string charEId = c->getId().toString();
CMirrorPropValueRO<TYPE_CELL> mirrorCell(TheDataset, rowId, DSPropertyCELL);
const sint32 cell = mirrorCell;
IRoomInstance * room = CBuildingManager::getInstance()->getRoomInstanceFromCell( cell );
if ( !room )
{
log.displayNL("\tError: character %s %s is in cell %d but no room was found", charName.c_str(), charEId.c_str(), cell);
continue;
}
CRoomInstancePlayer * playerRoom = dynamic_cast<CRoomInstancePlayer *>(room);
if ( !playerRoom )
{
log.displayNL("\tError: character %s %s is in cell %d but room is not a player room but a %s",
charName.c_str(), charEId.c_str(), cell, room->getRoomDescription().c_str()
);
continue;
}
log.displayNL("\tCharacter %s %s is in cell %d, room desc: %s",
charName.c_str(), charEId.c_str(), cell, room->getRoomDescription().c_str()
);
}
for (uint i = 0; i < _Players.size(); i++)
{
CEntityId id = _Players[i];
CCharacter * c = PlayerManager.getChar( id );
if ( !c )
{
log.displayNL("\tError: cannot find character with eid: %s", id.toString().c_str());
continue;
}
const string charName = c->getName().toUtf8();
const string charEId = c->getId().toString();
log.displayNL("\t> Player registered in building at index %u: %s %s", i, charName.c_str(), charEId.c_str());
}
}
示例4: dumpFileInfo
void CFileReceiver::dumpFileInfo(const std::string &fileSpec,NLMISC::CLog& log) const
{
// setup a vector to hold fileInfo results and call getFileInfo() to fill it in
TFileInfoVector result;
getFileInfo(fileSpec,result);
// display a summary info message
log.displayNL("Result of info request '%s': %d matches",fileSpec.c_str(),result.size());
log.displayNL("- %-32s %10s %10s %s","checksum","time","size","name");
// iterate over results, displaying the info
for (TFileInfoVector::iterator it= result.begin(); it!=result.end(); ++it)
{
log.displayNL("- %-32s %10u %10u %s",it->Checksum.toString().c_str(),it->FileTime,it->FileSize,it->FileName.c_str());
}
}
示例5: dumpUnaffectedFaunaGroups
//---------------------------------------------------
// dumpUnaffectedFaunaDesc
//---------------------------------------------------
void CCreatureManager::dumpUnaffectedFaunaGroups(NLMISC::CLog & log)
{
for (uint i = 0; i < _UnaffectedFaunaGroups.size(); i++ )
{
log.displayNL("row %d, group %d",_UnaffectedFaunaGroups[i].EntityIndex.getIndex(),_UnaffectedFaunaGroups[i].GroupAlias);
}
} // dumpUnaffectedFaunaDesc
示例6: displayAllLevelCaps
void CInterShardExchangeValidator::displayAllLevelCaps(NLMISC::CLog& log) const
{
log.displayNL("Level Caps:");
// iterate over the set of level caps in our singleton
TLevelCaps::const_iterator it= LevelCaps.begin();
TLevelCaps::const_iterator itEnd= LevelCaps.end();
for (;it!=itEnd;++it)
{
log.displayNL("- shard: %3u levelCap: %3u",it->first,it->second);
}
if (CInterShardExchangeValidator::getInstance()->LevelCaps.empty())
{
log.displayNL("- none");
}
}
示例7:
// display stacked accesses
void CFileAccessManager::displayFileAccesses(NLMISC::CLog& log)
{
uint i;
for (i=0; i<_Accesses.size(); ++i)
{
log.displayRawNL("%2d %08p %s %s %s", i, _Accesses[i], _Accesses[i]->Requester.toString().c_str(), _Accesses[i]->Filename.c_str(), _Accesses[i]->FailureReason.c_str());
}
}
示例8: dumpOutpostList
//----------------------------------------------------------------------------
void COutpostManager::dumpOutpostList(NLMISC::CLog & log) const
{
for (uint i = 0; i < _Outposts.size(); i++)
{
const CSmartPtr<COutpost> & outpost = _Outposts[i];
if (outpost != NULL)
log.displayNL("%u: %s", i, outpost->toString().c_str());
}
}
示例9:
/// Display contents
void display( NLMISC::CLog& log = *NLMISC::DebugLog )
{
CInstances::const_iterator ici;
for ( ici=_Instances.begin(); ici!=_Instances.end(); ++ici )
{
log.displayNL( "%s: %s (%u expected, %u running)",
(*ici).first.c_str(),
(*ici).second.Expected ? ((*ici).second.isOnlineAsExpected() ? "ONLINE" : "MISSING") : "OPTIONAL",
(*ici).second.Expected, (*ici).second.Running );
}
}
示例10: doAnalyse
LOG_ANALYSER_PLUGIN_API bool doAnalyse( const std::vector<const char *>& vec, std::string& res, std::string& log )
{
// ---
// Optional: Demo of how to get NeL logs (1/2)
// Outside this function, include <nel/misc/debug.h> and use namespace NLMISC.
//NLMISC::createDebug();
//CMemDisplayer memdisp;
//NLMISC::DebugLog->addDisplayer( &memdisp );
//NLMISC::InfoLog->addDisplayer( &memdisp );
//NLMISC::WarningLog->addDisplayer( &memdisp );
// ErrorLog and AssertLog not needed, they stop the application.
// ---
// Analyse warnings from vec
CLogReport MainLogReport;
MainLogReport.reset();
int nb = 0;
string line;
vector<const char *>::const_iterator iv;
for ( iv=vec.begin(); iv!=vec.end(); ++iv )
{
line = string(*iv);
MainLogReport.pushLine( line );
}
log = "Log report done.\nUse Right-Click > Select All then Copy (Ctrl+C) to copy the report from the top window.\n \n";
// Fill report to res
NLMISC::CLightMemDisplayer disp;
NLMISC::CLog reportLog;
reportLog.addDisplayer( &disp );
MainLogReport.report( &reportLog, true );
disp.write( res, true );
disp.write( log, false );
// ---
// Optional: Demo of how to get all NeL logs (2/2)
//memdisp.write( log );
// ---
return true;
}
示例11: dumpInventory
// ****************************************************************************
void CInventoryBase::dumpInventory(NLMISC::CLog & log, bool dumpItems) const
{
// inventory description
log.displayNL("Inventory: %s", INVENTORIES::toString(_InventoryId).c_str());
log.displayRawNL("Slots: max=%u, count=%u, free=%u", getMaxSlot(), _SlotCount, _FreeSlotCount);
log.displayRawNL("Weight: %u", _InventoryWeight);
log.displayRawNL("Bulk: %u", _InventoryBulk);
log.displayRawNL("Nb views: %u", _InventoryViews.size());
log.displayNL("(DEBUG) _Items.size() = %u", _Items.size());
if (dumpItems)
{
for (uint i = 0; i < _Items.size(); i++)
{
CGameItemPtr item = _Items[i];
if (item == NULL)
continue;
// short display of the item description
log.displayRawNL( "%u: ", i );
item->displayInLog( log );
}
}
}
示例12: forageTestDoExtract
bool forageTestDoExtract(
NLMISC::CLog& log,
uint nbIterations,
float reqPeriod,
float reqA,
float reqQ,
float absorption,
float successFactor )
{
CHarvestSource *testSource = CHarvestSourceManager::getInstance()->getEntity( TestSourceRow );
if ( ! testSource )
{
log.displayNL( "Call forageTestBegin first" );
return true;
}
// Request and output results
FILE *f = fopen( std::string(getLogDirectory() + "forage_test.csv").c_str(), "at" );
FILE *f2 = fopen( std::string(getLogDirectory() + "forage_test.log").c_str(), "at" );
float reqS = 1.0f / (reqPeriod * 10.0f);
float req [CHarvestSource::NbPosRTProps];
float abs [CHarvestSource::NbPosRTProps];
float res [CHarvestSource::NbPosRTProps];
static bool FirstTime = true;
req[CHarvestSource::S] = reqS;
req[CHarvestSource::A] = reqA;
req[CHarvestSource::Q] = reqQ;
abs[CHarvestSource::S] = absorption;
abs[CHarvestSource::A] = absorption;
abs[CHarvestSource::Q] = absorption;
res[CHarvestSource::S] = 0.025f;
res[CHarvestSource::A] = 0.0f;
res[CHarvestSource::Q] = 0.0f;
if ( FirstTime )
{
FirstTime = false;
fprintf( f, "A;Q;D;E;C;reqS;reqA;reqQ;qty;scheme;limit;\n" );
}
testSource->beginExtraction( TDataSetRow::createFromRawIndex( INVALID_DATASET_INDEX ), false );
bool eventD = false, eventE = false, eventC = false;
for ( uint i=0; i!=nbIterations; ++i )
{
TDataSetRow row;
CHarvestSource::TRealTimeProp propDrop;
testSource->extractMaterial( req, abs, ForageQualityCeilingFactor.get(), ForageQualitySlowFactor.get(), res, successFactor, 0, row, propDrop );
fprintf( f, "%g;%g;%g;%g;%g;%g;%g;%g;%g;%u;%u;\n",
res[CHarvestSource::A], res[CHarvestSource::Q],
testSource->getD(), testSource->getE(), 0.f /*testSource->getC()*/,
reqS, reqA, reqQ,
testSource->quantity(), testSource->getImpactScheme()*5, 127 );
if ( (!eventD) && (testSource->getD() > 127) )
{
fprintf( f2, "D: %u\n", i );
eventD = true;
}
if ( (!eventE) && (testSource->getE() > 127) )
{
fprintf( f2, "E: %u\n", i );
eventE = true;
}
/*if ( (!eventC) && (testSource->getC() > 127) )
{
fprintf( f2, "C: %u\n", i );
eventC = true;
}*/
}
if ( !eventD )
fprintf( f2, "D---\n" );
if ( !eventE )
fprintf( f2, "E---\n" );
if ( !eventC )
fprintf( f2, "C---\n" );
fclose( f );
fclose( f2 );
return true;
}
示例13: receiveTockFromClient
void CTickProxy::receiveTockFromClient( CMessage& msgin, TServiceId senderId, bool real )
{
// Receive measures of client service
TimeMeasures.ServiceMeasures.push_back( CServiceGameCycleTimeMeasure() );
CServiceGameCycleTimeMeasure& stm = TimeMeasures.ServiceMeasures.back();
stm.ClientServiceId = senderId;
if ( real )
{
stm.ServiceMeasure[TickTockInterval] = accTimeToMs( getAccurateTime() - _BeginOfTickTime );
msgin.serial( stm.ServiceMeasure[TickUpdateDuration] );
msgin.serial( stm.ServiceMeasure[PrevProcessMirrorUpdateDuration] );
msgin.serial( stm.ServiceMeasure[PrevReceiveMsgsViaMirrorDuration] );
msgin.serial( stm.ServiceMeasure[PrevTotalGameCycleDuration] );
}
else
{
for ( uint i=0; i!=NbServiceTimeMeasureTypes; ++i )
stm.ServiceMeasure[i] = 0;
}
//nldebug( "TCK-%u: %hu tocking", getGameCycle(), senderId );
//time_t t; time( &t );
_QuickLog.displayNL( "%"NL_I64"u: TCK-%u: %hu tocking", getPerfTime() /*IDisplayer::dateToHumanString( t )*/, getGameCycle(), senderId.get() );
++_NbTocked;
_TockedServices.push_back( senderId );
cbDoNextTask();
}
示例14: sendSyncToClient
void CTickProxy::sendSyncToClient( TServiceId serviceId )
{
CMessage msgout( "REGISTERED" );
msgout.serial( _GameTime );
msgout.serial( _GameTimeStep );
msgout.serial( _GameCycle );
CUnifiedNetwork::getInstance()->send( serviceId, msgout );
//nldebug( "TCK-%u: Sync %hu", getGameCycle(), serviceId );
//time_t t; time( &t );
_QuickLog.displayNL( "%"NL_I64"u: TCK-%u: Sync %hu", getPerfTime() /*IDisplayer::dateToHumanString( t )*/, getGameCycle(), serviceId.get() );
}
示例15: sendSyncs
void CTickProxy::sendSyncs()
{
vector<TServiceId>::const_iterator its;
for ( its=_Services.begin(); its!=_Services.end(); ++its )
{
CMessage msgout( "REGISTERED" );
msgout.serial( _GameTime );
msgout.serial( _GameTimeStep );
msgout.serial( _GameCycle );
CUnifiedNetwork::getInstance()->send( (*its), msgout );
//nldebug( "TCK-%u: Sync %hu", getGameCycle(), *its );
//time_t t; time( &t );
_QuickLog.displayNL( "%"NL_I64"u: TCK-%u: Sync %hu", getPerfTime() /*IDisplayer::dateToHumanString( t )*/, getGameCycle(), its->get());
}
}