sources from main repository

This commit is contained in:
Guenter Obiltschnig
2006-12-22 09:31:08 +00:00
parent 15193c3465
commit 772a1021dc
768 changed files with 5910 additions and 840 deletions

View File

@@ -1,7 +1,7 @@
//
// Logger.cpp
//
// $Id: //poco/1.3/Foundation/samples/Logger/src/Logger.cpp#1 $
// $Id: //poco/Main/Foundation/samples/Logger/src/Logger.cpp#9 $
//
// This class demonstrates the Logger, PatternFormatter, FormattingChannel,
// ConsoleChannel and FileChannel classes.
@@ -39,6 +39,7 @@
#include "Poco/ConsoleChannel.h"
#include "Poco/FileChannel.h"
#include "Poco/Message.h"
#include "Poco/AutoPtr.h"
using Poco::Logger;
@@ -47,18 +48,22 @@ using Poco::FormattingChannel;
using Poco::ConsoleChannel;
using Poco::FileChannel;
using Poco::Message;
using Poco::AutoPtr;
int main(int argc, char** argv)
{
// set up two channel chains - one to the
// console and the other one to a log file.
FormattingChannel* pFCConsole = new FormattingChannel(new PatternFormatter("%s: %p: %t"));
pFCConsole->setChannel(new ConsoleChannel);
AutoPtr<FormattingChannel> pFCConsole(new FormattingChannel(new PatternFormatter("%s: %p: %t")));
AutoPtr<ConsoleChannel> pConsole(new ConsoleChannel);
pFCConsole->setChannel(pConsole);
pFCConsole->open();
FormattingChannel* pFCFile = new FormattingChannel(new PatternFormatter("%Y-%m-%d %H:%M:%S.%c %N[%P]:%s:%q:%t"));
pFCFile->setChannel(new FileChannel("sample.log"));
AutoPtr<PatternFormatter> pPF(new PatternFormatter("%Y-%m-%d %H:%M:%S.%c %N[%P]:%s:%q:%t"));
AutoPtr<FormattingChannel> pFCFile(new FormattingChannel(pPF));
AutoPtr<FileChannel> pFC(new FileChannel("sample.log"));
pFCFile->setChannel(pFC);
pFCFile->open();
// create two Logger objects - one for
@@ -71,7 +76,7 @@ int main(int argc, char** argv)
fileLogger.error("An error message");
consoleLogger.warning("A warning message");
fileLogger.error("A warning message");
fileLogger.warning("A warning message");
consoleLogger.information("An information message");
fileLogger.information("An information message");