virtual void run() { NLMISC::CLog taskLog; CStrDisplayer taskDisplayer(&(Query->Result)); taskLog.addDisplayer(&taskDisplayer); ICommand::execute(Query->Query, taskLog); Query->Timeout = NLMISC::CTime::getLocalTime(); Query->Finished = true; Query = NULL; }
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; }
//-------------------------------------------------------------- // init // //-------------------------------------------------------------- void CTickProxy::init( void (*updateFunc)(), void (*syncFunc)() ) { // set the callbacks onTick = updateFunc; onSync = syncFunc; nlassert( updateFunc ); nlassert( syncFunc ); // Hide tick messages to avoid flooding DebugLog->addNegativeFilter ("TICK"); DebugLog->addNegativeFilter ("TOCK"); DebugLog->addNegativeFilter ("14+5"); CUnifiedNetwork::getInstance()->addCallbackArray(cbTickProxyArray,sizeof(cbTickProxyArray)/sizeof(cbTickProxyArray[0])); CUnifiedNetwork::getInstance()->setServiceUpCallback ("TICKS", cbTPTicksUp, NULL); CUnifiedNetwork::getInstance()->setServiceDownCallback ("TICKS", cbTPTicksDown, NULL); RecentHistory.setParam( 100 ); _QuickLog.addDisplayer( &RecentHistory, false ); } // init