3
AutoPtr<SplitterChannel> splitterChannel(new SplitterChannel());
AutoPtr<Channel> consoleChannel(new ConsoleChannel());
AutoPtr<Channel> fileChannel(new FileChannel("Arcanite.log"));
AutoPtr<FileChannel> rotatedFileChannel(new FileChannel("Arcanite_R.log"));
rotatedFileChannel->setProperty("rotation", "100");
rotatedFileChannel->setProperty("archive", "timestamp");
splitterChannel->addChannel(consoleChannel);
splitterChannel->addChannel(fileChannel);
splitterChannel->addChannel(rotatedFileChannel);
//"%d-%m-%Y %H:%M:%S: %t"
AutoPtr<Formatter> formatter(new PatternFormatter("%d-%m-%Y %H:%M:%S %s: %t"));
AutoPtr<Channel> formattingChannel(new FormattingChannel(formatter, splitterChannel));
Logger& sLog = Logger::create("LogChan", formattingChannel, Message::PRIO_TRACE);
필자의 서버에 여러 클래스로 사용하려는 로거를 작성했습니다. 어떻게 이렇게 적응할 수 있습니까? 이것은 아마 기본 C + +하지만 몇 가지 수업을 놓친 것 : P전체 프로젝트에 Poco :: Logger 사용