예제 #1
0
파일: log.cpp 프로젝트: hanxin1987216/DTL
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);
}
예제 #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();
}
예제 #3
0
파일: log.cpp 프로젝트: hanxin1987216/DTL
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);	
	}
}