4 extern Poco::AutoPtr<Poco::Util::AbstractConfiguration>
_config;
11 HCE::Logger::initializeDefaultLogger();
12 HCE::Logger::checkDefaultLogger();
15 Poco::AutoPtr<Poco::FormattingChannel> pFCFile;
16 Poco::Util::AbstractConfiguration::Keys channels;
21 for (std::vector<std::string>::const_iterator key = channels.begin(); key != channels.end(); ++key) {
25 pFCFile =
new Poco::FormattingChannel(Poco::AutoPtr<Poco::PatternFormatter>(
new Poco::PatternFormatter(
HCE::_config->getString(patternForChannel))));
32 Poco::AutoPtr<Poco::FileChannel> fileChannel(
new Poco::FileChannel(
HCE::_config->getString(std::string(
CHANNELS) +
"."+*key)));
38 fileChannel->setProperty(
"archive",archive);
39 fileChannel->setProperty(
"purgeAge",purgeAge);
40 fileChannel->setProperty(
"rotation",rotation);
42 pFCFile->setChannel(fileChannel);
45 Poco::Logger* logger = Poco::Logger::has(*key);
47 logger->setChannel(pFCFile);
51 Poco::Logger& newLogger = Poco::Logger::create(*key,pFCFile);
57 void HCE::Logger::initializeDefaultLogger() {
58 Poco::AutoPtr<Poco::FormattingChannel> defaultpFCFile =
60 Poco::AutoPtr<Poco::FileChannel> fileChannel(
new Poco::FileChannel(getDefaultChannel()));
70 fileChannel->setProperty(
"archive",archive);
71 fileChannel->setProperty(
"purgeAge",purgeAge);
72 fileChannel->setProperty(
"rotation",rotation);
73 defaultpFCFile->setChannel(fileChannel);
76 Poco::Logger* logger = NULL;
79 Poco::Logger& defaultLogger = Poco::Logger::create(
DEFAULT_LOG_NAME,defaultpFCFile);
87 void HCE::Logger::checkDefaultLogger() {
91 poco_assert (checkLogger != NULL);
94 std::string HCE::Logger::getDefaultChannel () {
103 Poco::Logger* logger = NULL;
104 logger = Poco::Logger::has(channel);
105 if (logger != NULL) {
111 if (logger != NULL) {
125 std::cout << HCE::Logger::createMsgIfThatChannelNotExist(channel) <<
std::endl;
130 Poco::Logger::setLevel(channelName,level);
135 int levelIntegerValue = Poco::Logger::parseLevel(level);
140 Poco::Logger::setLevel(Poco::Logger::ROOT,level);
145 int levelIntegerValue = Poco::Logger::parseLevel(level);
161 std::string HCE::Logger::createMsgIfThatChannelNotExist (
const std::string& channelName) {
162 std::stringstream ss;
163 ss <<
"Channel "; ss << channelName; ss <<
" not exists";