Update of /cvsroot/pclasses/pclasses2/plugins/LogTarget/Console
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15363/plugins/LogTarget/Console
Added Files:
Makefile.am ConsoleLogTarget.cpp
Log Message:
Added plugins subdirs.
Added ConsoleLogTarget plugin.
--- NEW FILE: Makefile.am ---
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include $(all_includes)
METASOURCES = AUTO
lib_LTLIBRARIES = libplog_console.la
libplog_console_la_SOURCES = ConsoleLogTarget.cpp
libplog_console_la_LIBADD = $(top_builddir)/src/libpclasses.la \
$(top_builddir)/src/App/libpclasses_app.la
--- NEW FILE: ConsoleLogTarget.cpp ---
/***************************************************************************
* Copyright (C) 2004 by Christian Prochnow *
* cp...@se... *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "pclasses/Plugin/Plugin.h"
#include "pclasses/App/LogTarget.h"
#include <iostream>
using namespace P;
using namespace P::IO;
using namespace P::App;
using namespace std;
class ConsoleLogTarget: public LogTarget {
public:
ConsoleLogTarget()
{
}
~ConsoleLogTarget() throw()
{
}
void open(const URL& url) throw(IOError)
{ _out = &cout; }
void close() throw(IOError)
{ _out = 0; }
void reload() throw(IOError)
{ }
void output(const LogMessage& msg) throw(IOError)
{
if(msg.level() >= logLevel())
(*_out) << msg.when() << ' ' << msg.level2Str(msg.level()) << ' ' << msg.msg().utf8() << endl;
}
bool valid() const throw()
{
return _out ? true : false;
}
private:
ostream* _out;
};
PLUGIN_REGISTER_TYPE(LogTarget, ConsoleLogTarget);
PLUGIN_REGISTER_ALIAS(LogTarget, Console, ConsoleLogTarget);
|