XTOOLS_NAMESPACE_BEGIN void LogNative(::XTools::LogSeverity severity, const char* file, int line, const char* message) { char logEntryBuffer[1024]; switch (severity) { case Warning: case Error: sprintf_s(logEntryBuffer, sizeof(logEntryBuffer), "SharingService [%s (%i)]: %s", file, line, message); break; case Info: default: sprintf_s(logEntryBuffer, sizeof(logEntryBuffer), "SharingService: %s", message); break; } LoggerPtr mgr = Logger::GetInstance(); if (mgr) { mgr->Log(severity, logEntryBuffer); } }
int main(int argc, char ** argv) { LoggerPtr logger = Logger::getLogger("main"); Memkeys * app = NULL; int rc = EXIT_SUCCESS; logger->setLevel(Level::INFO); // configure and initialize the app try { app = Memkeys::getInstance(argc, argv); } catch(...) { return handleConfigurationError(logger, argv[0]); } // run the app try { app->run(); } catch (const exception &ex) { logger->fatal(CONTEXT, "Error running application: %s", ex.what()); rc = EXIT_FAILURE; } logger->info(CONTEXT, "Shutting down"); // handle cleanup delete logger; delete app; delete Config::getInstance(); delete Logger::getRootLogger(); return rc; }
virtual LoggerPtr getLogger(const std::string& name) { #if 1 thread_local LoggerPtr lastResult = nullptr; if (lastResult) { if (lastResult->getName() == name) { return lastResult; } } #endif LoggerPtr result; mutex.lock_shared(); auto findIt = loggers.find(name); if (findIt != loggers.end()) { result = findIt->second; } mutex.unlock_shared(); if (!result) { throw std::runtime_error("Logger not found"); } #if 1 lastResult = result; #endif return result; }
/** * Tests non-blocking behavior. */ void testLocationInfoTrue() { BlockableVectorAppenderPtr blockableAppender = new BlockableVectorAppender(); AsyncAppenderPtr async = new AsyncAppender(); async->addAppender(blockableAppender); async->setBufferSize(5); async->setLocationInfo(true); async->setBlocking(false); Pool p; async->activateOptions(p); LoggerPtr rootLogger = Logger::getRootLogger(); rootLogger->addAppender(async); { synchronized sync(blockableAppender->getBlocker()); for (int i = 0; i < 100; i++) { LOG4CXX_INFO(rootLogger, "Hello, World"); Thread::sleep(1); } LOG4CXX_ERROR(rootLogger, "That's all folks."); } async->close(); const std::vector<spi::LoggingEventPtr>& events = blockableAppender->getVector(); LOGUNIT_ASSERT(events.size() > 0); LoggingEventPtr initialEvent = events[0]; LoggingEventPtr discardEvent = events[events.size() - 1]; LOGUNIT_ASSERT(initialEvent->getMessage() == LOG4CXX_STR("Hello, World")); LOGUNIT_ASSERT(discardEvent->getMessage().substr(0,10) == LOG4CXX_STR("Discarded ")); LOGUNIT_ASSERT_EQUAL(log4cxx::spi::LocationInfo::getLocationUnavailable().getClassName(), discardEvent->getLocationInformation().getClassName()); }
void *TPZParFrontStructMatrix<front>::ElementAssemble(void *t){ TPZParFrontStructMatrix<front> *parfront = (TPZParFrontStructMatrix<front> *) t; TPZAdmChunkVector<TPZCompEl *> &elementvec = parfront->fMesh->ElementVec(); while(parfront->fCurrentElement < parfront->fNElements) { /** *Lock mutex and search for an avilable element *A global variable to be updated whenever a element is processed */ //Lock a mutex and get an element number PZ_PTHREAD_MUTEX_LOCK(&mutex_element_assemble, "TPZParFrontStructMatrix<front>::ElementAssemble()"); //Stack is full and process must wait here! if(parfront->felnum.NElements()==parfront->fMaxStackSize) { /* cout << " Stack full" << endl; cout << " Waiting" << endl; cout.flush();*/ //cout << "Mutex unlocked on Condwait" << endl; #ifdef LOG4CXX if (logger->isDebugEnabled()) { std::stringstream sout; sout << "Entering cond_wait because of stack overflow "; LOGPZ_DEBUG(logger,sout.str()) } #endif PZ_PTHREAD_COND_WAIT(&stackfull,&mutex_element_assemble,"TPZParFrontStructMatrix<front>::ElementAssemble()"); //cout << "Mutex LOCKED leaving Condwait" << endl; } //cout << "Locking mutex_element_assemble" << endl; //cout.flush(); int64_t local_element = parfront->fCurrentElement; if(local_element==parfront->fNElements) { PZ_PTHREAD_MUTEX_UNLOCK(&mutex_element_assemble, "TPZParFrontStructMatrix<front>::ElementAssemble()"); return 0; } /* cout << "All element matrices assembled" << endl; return 0; } */ #ifdef LOG4CXX if (logger->isDebugEnabled()) { std::stringstream sout; sout << "Computing element " << local_element; LOGPZ_DEBUG(logger,sout.str()) }
void LoggerUtil::configure() { #ifdef HAVE_LOG4CXX LoggerPtr rootLogger = Logger::getRootLogger(); rootLogger->removeAllAppenders(); rootLogger->addAppender(new ConsoleAppender(new PatternLayout("%d [%t] %-5p %c - %m%n"))); #endif }
void BasicConfigurator::configure() { LogManager::getLoggerRepository()->setConfigured(true); LoggerPtr root = Logger::getRootLogger(); static const LogString TTCC_CONVERSION_PATTERN(LOG4CXX_STR("%r [%t] %p %c %x - %m%n")); LayoutPtr layout(new PatternLayout(TTCC_CONVERSION_PATTERN)); AppenderPtr appender(new ConsoleAppender(layout)); root->addAppender(appender); }
void combinedTest() { LoggerPtr root = Logger::getRootLogger(); bool rootIsConfigured = !root->getAllAppenders().empty(); CPPUNIT_ASSERT(rootIsConfigured); AppenderList list = root->getAllAppenders(); AppenderPtr appender = list.front(); CPPUNIT_ASSERT(appender->getName() == _T("D1")); CPPUNIT_ASSERT(list.size() == 1); }
LoggerPtr Logger::getRootLogger() { Loggers::iterator it = loggers.find(ROOT_LOGGER_NAME); if (it != loggers.end()) { return it->second; } else { LoggerPtr logger = new Logger(ROOT_LOGGER_NAME); logger->setParent(NULL); logger->setUseParent(false); loggers.insert(it, Loggers::value_type(ROOT_LOGGER_NAME, logger)); return logger; } }
void TPZMatRed<TVar,TSideMatrix>::SetF(const TPZFMatrix<TVar> & F) { int64_t FCols=F.Cols(),c,r,r1; fF0.Redim(fDim0,FCols); fF1.Redim(fDim1,FCols); for(c=0; c<FCols; c++){ r1=0; for(r=0; r<fDim0; r++){ fF0.PutVal( r,c,F.GetVal(r,c) ) ; } //aqui r=fDim0 for( ;r<fDim0+fDim1; r++){ fF1.PutVal( r1++,c,F.GetVal(r,c) ); } } #ifdef LOG4CXX if (logger->isDebugEnabled()) { std::stringstream sout; F.Print("F Input",sout); fF0.Print("fF0 Initialized",sout); fF1.Print("fF1 Initialized",sout); LOGPZ_DEBUG(logger, sout.str()) }
Log::Level Logger::GetLoggerLevel() { Log::Level enLoggerLevel = m_enLevel; if (enLoggerLevel == none) { LoggerPtr spParent = m_spParent; do { ATLASSERT(spParent.get() != NULL); enLoggerLevel = spParent->Level(); spParent = spParent->Parent(); } while(enLoggerLevel == none); } return enLoggerLevel; }
bool TryIax2FullVoiceFrame(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader, UdpHeaderStruct* udpHeader, u_char* udpPayload) { struct Iax2FullHeader *fh = (struct Iax2FullHeader *)udpPayload; int data_len = 0, codec = 0, pt = 0, udp_act_payload_len = 0; Iax2PacketInfoRef info(new Iax2PacketInfo()); if(!DLLCONFIG.m_iax2Support) return false; udp_act_payload_len = (ntohs(udpHeader->len)-sizeof(UdpHeaderStruct)); if(udp_act_payload_len < (int)sizeof(*fh)) return false; /* Frame too small */ if(!(ntohs(fh->scallno) & 0x8000)) return false; /* Not a full frame */ if(fh->type != IAX2_FRAME_VOICE) return false; /* Frame type must be VOICE */ codec = get_uncompressed_subclass(fh->c_sub); if((pt = iax2_codec_to_rtp_payloadtype(codec)) < 0) { CStdString logmsg; logmsg.Format("Invalid payload type %d received for " "IAX_FRAME_VOICE, IAX2 codec %d", pt, codec); LOG4CXX_INFO(s_iax2parsersLog, logmsg); return false; /* Invalid codec type received */ } data_len = ((u_char*)ipHeader+ntohs(ipHeader->ip_len))-(udpPayload+sizeof(*fh)); if(data_len == 0) return false; /* Empty packet? */ /* We have a full VOICE frame */ info->m_sourceIp = ipHeader->ip_src; info->m_destIp = ipHeader->ip_dest; info->m_sourcecallno = (ntohs(fh->scallno) & ~0x8000); info->m_destcallno = (ntohs(fh->dcallno) & ~0x8000); info->m_payloadSize = data_len; info->m_payload = udpPayload+sizeof(*fh); info->m_payloadType = pt; info->m_timestamp = ntohl(fh->ts); info->m_arrivalTimestamp = time(NULL); info->m_frame_type = IAX2_FRAME_FULL; Iax2SessionsSingleton::instance()->ReportIax2Packet(info); CStdString logmsg, packetInfo; info->ToString(packetInfo); logmsg.Format("Processed IAX2 FULL VOICE frame pt:%d", pt); LOG4CXX_INFO(s_iax2parsersLog, logmsg); if(s_iax2parsersLog->isDebugEnabled()) { LOG4CXX_DEBUG(s_iax2parsersLog, packetInfo); } return true; }
void locationInfo() { XMLLayoutPtr xmlLayout = new XMLLayout(); xmlLayout->setLocationInfo(true); root->addAppender(new FileAppender(xmlLayout, TEMP, false)); common(); XMLTimestampFilter xmlTimestampFilter; XMLLineAttributeFilter xmlLineAttributeFilter; XMLThreadFilter xmlThreadFilter; std::vector<Filter *> filters; filters.push_back(&xmlTimestampFilter); filters.push_back(&xmlLineAttributeFilter); filters.push_back(&xmlThreadFilter); try { Transformer::transform(TEMP, FILTERED, filters); } catch(UnexpectedFormatException& e) { tcout << _T("UnexpectedFormatException :") << e.getMessage() << std::endl; throw; } CPPUNIT_ASSERT(Compare::compare(FILTERED, _T("witness/xmlLayout.2"))); }
// not incuded in the tests for the moment ! void holdTestMDCEscaped() { XMLLayoutPtr xmlLayout = new XMLLayout(); root->addAppender(new FileAppender(xmlLayout, TEMP, false)); MDC::clear(); MDC::put(_T("blahAttribute"), _T("<blah value=\"blah\">")); MDC::put(_T("<blahKey value=\"blah\"/>"), _T("blahValue")); LOG4CXX_DEBUG(logger, _T("Hello")); MDC::clear(); XMLTimestampFilter xmlTimestampFilter; XMLThreadFilter xmlThreadFilter; std::vector<Filter *> filters; filters.push_back(&xmlTimestampFilter); filters.push_back(&xmlThreadFilter); try { Transformer::transform(TEMP, FILTERED, filters); } catch(UnexpectedFormatException& e) { tcout << _T("UnexpectedFormatException :") << e.getMessage() << std::endl; throw; } CPPUNIT_ASSERT(Compare::compare(FILTERED, _T("witness/xmlLayout.mdc.2"))); }
void ScanAllSkinnyMessages(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader, TcpHeaderStruct* tcpHeader, u_char* ipPacketEnd) { u_char* startTcpPayload = (u_char*)tcpHeader + (tcpHeader->off * 4); SkinnyHeaderStruct* skinnyHeader = (SkinnyHeaderStruct*)(startTcpPayload); // Scan all skinny messages in this TCP packet while( ipPacketEnd > (u_char*)skinnyHeader && (u_char*)skinnyHeader>=startTcpPayload && (ipPacketEnd - (u_char*)skinnyHeader) > SKINNY_MIN_MESSAGE_SIZE && skinnyHeader->len > 1 && skinnyHeader->len < 2048 && skinnyHeader->messageType >= 0x0 && skinnyHeader->messageType <= 0x200 ) // Last known skinny message by ethereal is 0x13F, but seen higher message ids in the field. { if(s_skinnyParsersLog->isDebugEnabled()) { CStdString dbg; unsigned int offset = (u_char*)skinnyHeader - startTcpPayload; dbg.Format("Offset:%x Len:%u Type:%x %s", offset, skinnyHeader->len, skinnyHeader->messageType, SkinnyMessageToString(skinnyHeader->messageType)); LOG4CXX_DEBUG(s_skinnyParsersLog, dbg); } HandleSkinnyMessage(skinnyHeader, ipHeader, ipPacketEnd, tcpHeader); // Point to next skinny message within this TCP packet skinnyHeader = (SkinnyHeaderStruct*)((u_char*)skinnyHeader + SKINNY_HEADER_LENGTH + skinnyHeader->len); } }
int handleConfigurationError(LoggerPtr logger, const char *progname) { try { throw; } catch (const MemkeysConfigurationError &er) { logger->fatal(CONTEXT, "Error configuring %s: %s", PACKAGE_NAME, er.what()); cout << Cli::help(progname); return EXIT_FAILURE; } catch (const MemkeysException &ex) { logger->fatal(CONTEXT, "Error setting up application: %s", ex.what()); return EXIT_FAILURE; } catch (...) { logger->fatal("Unexpected failure"); throw; } }
TPZCompElHDivFull<TSHAPE>::TPZCompElHDivFull(TPZCompMesh &mesh, TPZGeoEl *gel, int64_t &index) : TPZRegisterClassId(&TPZCompElHDivFull::ClassId), TPZCompElHDiv<TSHAPE>(mesh,gel,index) { int i; int nconflux= TPZCompElHDiv<TSHAPE>::NConnects(); this->fConnectIndexes.Resize(nconflux); gel->SetReference(this); for(i=0;i< nconflux;i++) { int sideaux= i + TSHAPE::NCornerNodes; this->fConnectIndexes[i] = this->CreateMidSideConnect(sideaux); #ifdef LOG4CXX if (logger->isDebugEnabled()) { std::stringstream sout; sout << "After creating last flux connect " << i << std::endl; // this->Print(sout); LOGPZ_DEBUG(logger,sout.str()) } #endif mesh.ConnectVec()[this->fConnectIndexes[i]].IncrementElConnected(); this->IdentifySideOrder(sideaux); }
void testNULL() { XMLLayoutPtr xmlLayout = new XMLLayout(); root->addAppender(new FileAppender(xmlLayout, TEMP, false)); LOG4CXX_DEBUG(logger, _T("hi")); LOG4CXX_DEBUG(logger, _T("")); XMLTimestampFilter xmlTimestampFilter; XMLThreadFilter xmlThreadFilter; std::vector<Filter *> filters; filters.push_back(&xmlTimestampFilter); filters.push_back(&xmlThreadFilter); try { Transformer::transform(TEMP, FILTERED, filters); } catch(UnexpectedFormatException& e) { tcout << _T("UnexpectedFormatException :") << e.getMessage() << std::endl; throw; } CPPUNIT_ASSERT(Compare::compare(FILTERED, _T("witness/xmlLayout.null"))); }
TPZMatrix<STATE> * TPZSpStructMatrix::Create(){ int64_t neq = fEquationFilter.NActiveEquations(); /* if(fMesh->FatherMesh()) { TPZSubCompMesh *smesh = (TPZSubCompMesh *) fMesh; neq = smesh->NumInternalEquations(); }*/ TPZFYsmpMatrix<STATE> * mat = new TPZFYsmpMatrix<STATE>(neq,neq); /** *Longhin implementation */ TPZStack<int64_t> elgraph; TPZVec<int64_t> elgraphindex; // int nnodes = 0; fMesh->ComputeElGraph(elgraph,elgraphindex); /**Creates a element graph*/ TPZMetis metis; metis.SetElementsNodes(elgraphindex.NElements() -1 ,fMesh->NIndependentConnects()); metis.SetElementGraph(elgraph,elgraphindex); TPZManVector<int64_t> nodegraph; TPZManVector<int64_t> nodegraphindex; /** *converts an element graph structure into a node graph structure *those vectors have size ZERO !!! */ metis.ConvertGraph(elgraph,elgraphindex,nodegraph,nodegraphindex); #ifdef LOG4CXX2 if(logger->isDebugEnabled()){ std::stringstream sout; sout << "Node graph \n"; metis.TPZRenumbering::Print(nodegraph, nodegraphindex); LOGPZ_DEBUG(logger, sout.str()) }
void Logger::log(const Level &level, const Record &record) { if (level >= getLevel()) { // TODO this should support writing via an appender so users can log to a // file while seeing stats on their display string out = format(record); _writeMutex.lock(); getHandler() << out << endl; getHandler().flush(); _writeMutex.unlock(); LoggerPtr logger = getParent(); if (logger != NULL && logger->getUseParent()) { logger->log(level, record); } } }
void TPZSkylParMatrix<TVar>::ColumnToWork(int64_t &lcol) { int64_t neq = this->Dim(); int64_t lcolentry = lcol; #ifdef PZDEBUG if(lcolentry < 0 || lcolentry >= neq) { LOGPZ_ERROR(logger,"ColumnToWork called with wrong lcol argument") DebugStop(); } #endif lcol++; lcol = lcol%neq; while(lcol != lcolentry) { if(fColUsed.find(lcol) != fColUsed.end() || fDec[lcol] == lcol) { lcol++; lcol = lcol%neq; continue; } int decomposeduntil = fDec[lcol]+1; if(fDec[decomposeduntil] == decomposeduntil) { #ifdef LOG4CXX if (logger->isDebugEnabled()) { std::stringstream sout; sout << "Will work column " << lcol; LOGPZ_DEBUG(logger,sout.str()) } #endif return; } lcol++; if(lcol == neq) lcol = 0; }
void IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast<BasicStream&>(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; s << heading; printHeader(s, stream); int batchRequestNum; stream.read(batchRequestNum); s << "\nnumber of requests = " << batchRequestNum; for(int i = 0; i < batchRequestNum; ++i) { s << "\nrequest #" << i << ':'; printRequestHeader(s, stream); stream.skipEncaps(); } logger->trace(tl->protocolCat, s.str()); stream.i = p; } }
void IceInternal::traceRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast<BasicStream&>(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; s << heading; printHeader(s, stream); Int requestId; stream.read(requestId); s << "\nrequest id = " << requestId; if(requestId == 0) { s << " (oneway)"; } printRequestHeader(s, stream); logger->trace(tl->protocolCat, s.str()); stream.i = p; } }
double DelayedLoop(LoggerPtr logger, const String& msg) { int64_t before = System::currentTimeMillis(); int j = 0; for(int i = 0; i < runLength; i++) { logger->info(msg); if(j++ == burstLen) { j = 0; try { Thread::sleep(delay); } catch(Exception&) { } } } double actualTime = ((System::currentTimeMillis()-before)*1000.0/runLength); tcout << "actual time: " << actualTime << std::endl; return (actualTime - delay*DELAY_MULT); }
void ErrorH1(TPZCompMesh *l2mesh, std::ostream &out) { int64_t nel = l2mesh->NElements(); int dim = l2mesh->Dimension(); TPZManVector<STATE,10> globerrors(10,0.); for (int64_t el=0; el<nel; el++) { TPZCompEl *cel = l2mesh->ElementVec()[el]; if (!cel) { continue; } TPZGeoEl *gel = cel->Reference(); if (!gel || gel->Dimension() != dim) { continue; } TPZManVector<STATE,10> elerror(10,0.); elerror.Fill(0.); cel->EvaluateError(SolSuave, elerror, NULL); int nerr = elerror.size(); //globerrors.resize(nerr); #ifdef LOG4CXX if (logger->isDebugEnabled()) { std::stringstream sout; sout << "L2 Error sq of element " << el << elerror[0]*elerror[0]; LOGPZ_DEBUG(logger, sout.str()) } #endif for (int i=0; i<nerr; i++) { globerrors[i] += elerror[i]*elerror[i]; } }
void testCDATA() { XMLLayoutPtr xmlLayout = new XMLLayout(); xmlLayout->setLocationInfo(true); root->addAppender(new FileAppender(xmlLayout, TEMP, false)); LOG4CXX_DEBUG(logger, _T("Message with embedded <![CDATA[<hello>hi</hello>]]>.")); XMLTimestampFilter xmlTimestampFilter; XMLLineAttributeFilter xmlLineAttributeFilter; XMLThreadFilter xmlThreadFilter; std::vector<Filter *> filters; filters.push_back(&xmlTimestampFilter); filters.push_back(&xmlLineAttributeFilter); filters.push_back(&xmlThreadFilter); try { Transformer::transform(TEMP, FILTERED, filters); } catch(UnexpectedFormatException& e) { tcout << _T("UnexpectedFormatException :") << e.getMessage() << std::endl; throw; } CPPUNIT_ASSERT(Compare::compare(FILTERED, _T("witness/xmlLayout.3"))); }
// Used for initializing app main() Memkeys * Memkeys::getInstance(int argc, char ** argv) { Config * cfg = Config::getInstance(); LoggerPtr mainLogger = Logger::getLogger("main"); try { Cli::parse(argc, argv, cfg); } catch (const exception &ex) { throw MemkeysConfigurationError(ex.what()); } mainLogger->setLevel(Level::INFO); mainLogger->info(CONTEXT, "Starting application %s. PID %d", argv[0], getpid()); Logger::getRootLogger()->setLevel(cfg->verbosity()); mainLogger->debug("Configuration\n" + cfg->toString()); return Memkeys::getInstance(cfg); }
void IterativeProcess(TPZAnalysis *an, std::ostream &out, int numiter) { int iter = 0; REAL error = 1.e10, NormResLambdaLast = 1.e10;; const REAL tol = 1.e-5; int numeq = an->Mesh()->NEquations(); TPZFMatrix<STATE> Uatk0(an->Solution()); TPZFMatrix<STATE> Uatk(Uatk0),DeltaU(Uatk0); if(Uatk0.Rows() != numeq) Uatk0.Redim(numeq,1); an->Assemble(); an->Rhs() *= -1.0; //- [R(U0)]; TPZAutoPointer< TPZMatrix<STATE> > matK; // getting X(Uatn) bool converged = false; while(!converged && iter < numiter) { #ifdef LOG4CXX if(logger->isDebugEnabled()) { std::stringstream sout; matK=an->Solver().Matrix(); matK->Print("matK = ", sout,EMathematicaInput); an->Rhs().Print("Rhs = ", sout, EMathematicaInput); LOGPZ_DEBUG(logger,sout.str()) } #endif // Computing Uatk = Uatn + DeltaU; an->Solve(); DeltaU= an->Solution(); Uatk = Uatk0 + DeltaU; //Computing ||DeltaU|| REAL NormOfDeltaU = Norm(DeltaU); #ifdef LOG4CXX if(logger->isDebugEnabled()) { std::stringstream sout; DeltaU.Print("DeltaU = ", sout,EMathematicaInput); Uatk.Print("Uatk = ", sout,EMathematicaInput); LOGPZ_DEBUG(logger,sout.str()) }
/** * Tests that a bad appender will switch async back to sync. */ void testBadAppender() { AppenderPtr nullPointerAppender = new NullPointerAppender(); AsyncAppenderPtr asyncAppender = new AsyncAppender(); asyncAppender->addAppender(nullPointerAppender); asyncAppender->setBufferSize(5); Pool p; asyncAppender->activateOptions(p); LoggerPtr root = Logger::getRootLogger(); root->addAppender(asyncAppender); LOG4CXX_INFO(root, "Message"); Thread::sleep(10); try { LOG4CXX_INFO(root, "Message"); LOGUNIT_FAIL("Should have thrown exception"); } catch(NullPointerException& ex) { } }
virtual void log(const std::string& file, int line, LogLevel level, const std::string& msg) { LocationInfo loc(file.c_str(), "", line); switch(level) { case INFO : m_logger->info(msg,loc); break; case DEBUG : m_logger->debug(msg,loc); break; case WARN : m_logger->warn(msg,loc); break; case ERROR : m_logger->error(msg,loc); break; } }