Poco::LoggingFactory::registerBuiltins should support SimpleFileChannel. #197

This commit is contained in:
Alex Fabijanic 2017-10-12 11:49:08 -05:00
parent f1e4d592c4
commit 6cb5ce393a
2 changed files with 16 additions and 7 deletions

View File

@ -17,6 +17,7 @@
#include "Poco/AsyncChannel.h"
#include "Poco/ConsoleChannel.h"
#include "Poco/FileChannel.h"
#include "Poco/SimpleFileChannel.h"
#include "Poco/FormattingChannel.h"
#include "Poco/SplitterChannel.h"
#include "Poco/NullChannel.h"
@ -24,9 +25,6 @@
#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_NO_SYSLOGCHANNEL)
#include "Poco/SyslogChannel.h"
#endif
#if defined(POCO_OS_FAMILY_VMS)
#include "Poco/OpcomChannel.h"
#endif
#if defined(POCO_OS_FAMILY_WINDOWS) && !defined(_WIN32_WCE)
#include "Poco/EventLogChannel.h"
#include "Poco/WindowsConsoleChannel.h"
@ -94,8 +92,10 @@ void LoggingFactory::registerBuiltins()
_channelFactory.registerClass("ConsoleChannel", new Instantiator<ConsoleChannel, Channel>);
_channelFactory.registerClass("ColorConsoleChannel", new Instantiator<ColorConsoleChannel, Channel>);
#endif
#ifndef POCO_NO_FILECHANNEL
_channelFactory.registerClass("FileChannel", new Instantiator<FileChannel, Channel>);
_channelFactory.registerClass("SimpleFileChannel", new Instantiator<SimpleFileChannel, Channel>);
#endif
_channelFactory.registerClass("FormattingChannel", new Instantiator<FormattingChannel, Channel>);
#ifndef POCO_NO_SPLITTERCHANNEL
@ -109,9 +109,7 @@ void LoggingFactory::registerBuiltins()
_channelFactory.registerClass("SyslogChannel", new Instantiator<SyslogChannel, Channel>);
#endif
#endif
#if defined(POCO_OS_FAMILY_VMS)
_channelFactory.registerClass("OpcomChannel", new Instantiator<OpcomChannel, Channel>);
#endif
#if defined(POCO_OS_FAMILY_WINDOWS) && !defined(_WIN32_WCE)
_channelFactory.registerClass("EventLogChannel", new Instantiator<EventLogChannel, Channel>);
#endif

View File

@ -18,7 +18,10 @@
#if defined(_WIN32)
#include "Poco/WindowsConsoleChannel.h"
#endif
#ifndef POCO_NO_FILECHANNEL
#include "Poco/FileChannel.h"
#include "Poco/SimpleFileChannel.h"
#endif
#include "Poco/SplitterChannel.h"
#include "Poco/Formatter.h"
#include "Poco/PatternFormatter.h"
@ -31,7 +34,10 @@
using Poco::LoggingFactory;
using Poco::Channel;
using Poco::ConsoleChannel;
#ifndef POCO_NO_FILECHANNEL
using Poco::FileChannel;
using Poco::SimpleFileChannel;
#endif
using Poco::SplitterChannel;
using Poco::Formatter;
using Poco::PatternFormatter;
@ -80,9 +86,14 @@ void LoggingFactoryTest::testBuiltins()
assert (dynamic_cast<ConsoleChannel*>(pConsoleChannel.get()) != 0);
#endif
#ifndef POCO_NO_FILECHANNEL
AutoPtr<Channel> pFileChannel = fact.createChannel("FileChannel");
assert (dynamic_cast<FileChannel*>(pFileChannel.get()) != 0);
AutoPtr<Channel> pSimpleFileChannel = fact.createChannel("SimpleFileChannel");
assert(dynamic_cast<SimpleFileChannel*>(pSimpleFileChannel.get()) != 0);
#endif
AutoPtr<Channel> pSplitterChannel = fact.createChannel("SplitterChannel");
assert (dynamic_cast<SplitterChannel*>(pSplitterChannel.get()) != 0);