From: Adam Dickmeiss Date: Wed, 15 May 2013 08:53:45 +0000 (+0200) Subject: sd_remove: log error msg + addinfo X-Git-Tag: v1.3.56~8 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=f97d0ca28b921765133e40c58d1b1b8ef3e7ecef;p=metaproxy-moved-to-github.git sd_remove: log error msg + addinfo --- diff --git a/src/filter_sd_remove.cpp b/src/filter_sd_remove.cpp index d7e75ea..3755b05 100644 --- a/src/filter_sd_remove.cpp +++ b/src/filter_sd_remove.cpp @@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include #include -#include namespace metaproxy_1 { namespace filter { @@ -64,6 +64,25 @@ void yf::SD_Remove::configure(const xmlNode *xmlnode, bool test_only, } } +static void diagrec_to_sutrs(WRBUF b, Z_DiagRec *diag) +{ + wrbuf_puts(b," ERROR "); + if (diag->which != Z_DiagRec_defaultFormat) + wrbuf_puts(b, "diag not in default format"); + else + { + Z_DefaultDiagFormat *e = diag->u.defaultFormat; + wrbuf_printf(b, ODR_INT_PRINTF ": %s", *e->condition, + diagbib1_str(*e->condition)); + if (e->u.v2Addinfo && *e->u.v2Addinfo) // v3Addinfo is same data + { + wrbuf_puts(b, " -- "); + wrbuf_puts(b, e->u.v2Addinfo); + } + } + wrbuf_puts(b, "\n"); +} + void yf::SD_Remove::process(mp::Package &package) const { package.move(); @@ -106,7 +125,7 @@ void yf::SD_Remove::process(mp::Package &package) const if (npr->which == Z_NamePlusRecord_surrogateDiagnostic) { WRBUF w = wrbuf_alloc(); - wrbuf_diags(w, 1, &npr->u.surrogateDiagnostic); + diagrec_to_sutrs(w, npr->u.surrogateDiagnostic); npr->which = Z_NamePlusRecord_databaseRecord; npr->u.databaseRecord = z_ext_record_sutrs(odr_en, wrbuf_buf(w),