From: Adam Dickmeiss Date: Wed, 11 Jan 2006 08:53:52 +0000 (+0000) Subject: Extend log filter, so that message can be set X-Git-Tag: YP2.0.0.2~104 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=edb11cb2d4bf64c64e4effe67845f58c4e014e45;p=metaproxy-moved-to-github.git Extend log filter, so that message can be set --- diff --git a/etc/config1.xml b/etc/config1.xml index d529e11..49d11a8 100644 --- a/etc/config1.xml +++ b/etc/config1.xml @@ -1,5 +1,5 @@ - + @@ -14,6 +14,9 @@ + + F + loc @@ -23,8 +26,14 @@ idgils indexdata.dk/gils + + Default + localhost:9999 + + + + B - diff --git a/src/filter_log.cpp b/src/filter_log.cpp index 2782dc5..2f521d2 100644 --- a/src/filter_log.cpp +++ b/src/filter_log.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_log.cpp,v 1.13 2006-01-09 21:20:15 adam Exp $ +/* $Id: filter_log.cpp,v 1.14 2006-01-11 08:53:52 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -6,7 +6,7 @@ #include "config.hpp" -#include "filter.hpp" +#include "xmlutil.hpp" #include "package.hpp" #include @@ -97,6 +97,23 @@ void yf::Log::process(yp2::Package &package) const } } +void yf::Log::configure(const xmlNode *ptr) +{ + for (ptr = ptr->children; ptr; ptr = ptr->next) + { + if (ptr->type != XML_ELEMENT_NODE) + continue; + if (!strcmp((const char *) ptr->name, "message")) + m_p->m_msg = yp2::xml::get_text(ptr); + else + { + throw yp2::filter::FilterException("Bad element " + + std::string((const char *) + ptr->name)); + } + } +} + static yp2::filter::Base* filter_creator() { return new yp2::filter::Log; diff --git a/src/filter_log.hpp b/src/filter_log.hpp index 2ae395a..b6238b5 100644 --- a/src/filter_log.hpp +++ b/src/filter_log.hpp @@ -1,4 +1,4 @@ -/* $Id: filter_log.hpp,v 1.12 2006-01-04 11:55:31 adam Exp $ +/* $Id: filter_log.hpp,v 1.13 2006-01-11 08:53:52 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -21,6 +21,7 @@ namespace yp2 { Log(const std::string &x); ~Log(); void process(yp2::Package & package) const; + void configure(const xmlNode * ptr); }; } }