I'm pretty much following the logger sample except that I'm only using the file logger and some of the setup is spread out:
- Code: Select all
Partial AgentLogger class:
AgentLogger::AgentLogger() : pFCFile(new FormattingChannel(new PatternFormatter("%Y-%m-%d %H:%M:%S.%c %q:[%P]:%t"))),
fileLogger(Logger::create("AgentLogger", pFCFile, Message::PRIO_INFORMATION))
// set up a channel chain to a log file.
void AgentLogger::Log(const std::string &msg )
The reason for wrapping the logger rather than using it directly was because I wanted additional information automatically appended to a log message. I took this out when I realized that this additional information was not const.
It's not your job to debug my code, but if you have any comments, they would be welcome.