Example #1
0
void 
TraceLog::createModule  (const String& moduleName, const String& path, int level)
{
	Poco::FormattingChannel* pFCFile = new Poco::FormattingChannel(new Poco::PatternFormatter("%Y-%m-%d %H:%M:%S.%c %N[%P]:%s:%p:%t"));
	pFCFile->setChannel(new Poco::FileChannel(path.getCStr()));
	pFCFile->open();
	
	Poco::Logger& fileLogger = Poco::Logger::create(moduleName.getCStr(), pFCFile, level);
}
Example #2
0
CTraceLogger::~CTraceLogger()
{
    Poco::Logger& logger = Poco::Logger::root();
    if (logger.getChannel() != NULL)
    {
        Poco::FormattingChannel *channel = static_cast<Poco::FormattingChannel*>(logger.getChannel());
        channel->close();
        channel->setFormatter(NULL);
        channel->setChannel(NULL);
    }
    Poco::Logger::shutdown();
}
Example #3
0
void
TraceLog::createConsoleLogger(int level)
{
	if (Poco::Logger::has("console") == NULL) {
		// set up two channel chains - one to the
		// console and the other one to a log file.
		Poco::FormattingChannel* pFCConsole = new Poco::FormattingChannel(new Poco::PatternFormatter("%Y-%m-%d %H:%M:%S.%c %N[%P]:%s:%p:%t"));
		pFCConsole->setChannel(new Poco::ConsoleChannel);
		pFCConsole->open();
		
		Poco::Logger& consoleLogger = Poco::Logger::create("console", pFCConsole, level);	
	}
}