From: Christian P. <cp...@us...> - 2005-07-02 11:43:45
|
Update of /cvsroot/pclasses/pclasses2/plugins/LogTarget/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18557/plugins/LogTarget/console Added Files: Makefile.am LogTarget_console.cpp Log Message: - Renamed LogTarget plugins --- NEW FILE: Makefile.am --- INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include $(all_includes) METASOURCES = AUTO pkglib_LTLIBRARIES = LogTarget_console.la LogTarget_console_la_SOURCES = LogTarget_console.cpp LogTarget_console_la_LDFLAGS = -module -avoid-version LogTarget_console_la_LIBADD = $(top_builddir)/src/libpclasses.la \ $(top_builddir)/src/Unicode/libpclasses_unicode.la \ $(top_builddir)/src/IO/libpclasses_io.la \ $(top_builddir)/src/System/libpclasses_system.la \ $(top_builddir)/src/App/libpclasses_app.la --- NEW FILE: LogTarget_console.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/System/Plugin.h" #include "pclasses/App/LogTarget.h" #include <iostream> using namespace P; using namespace P::IO; using namespace P::App; using namespace std; class LogTarget_console: public LogTarget { public: LogTarget_console() { } ~LogTarget_console() 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) { (*_out) << msg.when() << ' ' << msg.level2Str(msg.level()) << ' ' << msg.msg().utf8() << endl; } bool valid() const throw() { return _out ? true : false; } private: ostream* _out; }; P_PLUGIN_REGISTER_TYPE(LogTarget, LogTarget_console); P_PLUGIN_REGISTER_ALIAS(LogTarget, console, LogTarget_console); |