From: Adam Dickmeiss Date: Wed, 4 Jul 2012 08:20:31 +0000 (+0200) Subject: One line log: quote addinfo, log record syntax X-Git-Tag: v1.3.38~7 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=fc1ede2a94c028ae8054783308043c1d466e34e8;p=metaproxy-moved-to-github.git One line log: quote addinfo, log record syntax --- diff --git a/src/filter_log.cpp b/src/filter_log.cpp index f7ea13c..db25e89 100644 --- a/src/filter_log.cpp +++ b/src/filter_log.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include +#include #include #include #include @@ -149,13 +150,23 @@ yf::Log::Impl::~Impl() static void log_DefaultDiagFormat(WRBUF w, Z_DefaultDiagFormat *e) { if (e->condition) - wrbuf_printf(w, ODR_INT_PRINTF " ",*e->condition); + wrbuf_printf(w, ODR_INT_PRINTF " ", *e->condition); else wrbuf_puts(w, "?? "); if (e->which == Z_DefaultDiagFormat_v2Addinfo && e->u.v2Addinfo) + { + wrbuf_puts(w, "\""); wrbuf_puts(w, e->u.v2Addinfo); + wrbuf_puts(w, "\""); + } else if (e->which == Z_DefaultDiagFormat_v3Addinfo && e->u.v3Addinfo) + { + wrbuf_puts(w, "\""); wrbuf_puts(w, e->u.v3Addinfo); + wrbuf_puts(w, "\""); + } + else + wrbuf_puts(w, "-"); } static void log_DiagRecs(WRBUF w, int num_diagRecs, Z_DiagRec **diags) @@ -169,6 +180,17 @@ static void log_DiagRecs(WRBUF w, int num_diagRecs, Z_DiagRec **diags) } } +static void log_syntax(WRBUF w, const Odr_oid *syntax) +{ + if (syntax) + { + char oid_name[OID_STR_MAX+1]; + wrbuf_puts(w, yaz_oid_to_string_buf(syntax, 0, oid_name)); + } + else + wrbuf_puts(w, "-"); +} + static void log_1_line(Z_APDU *z_req, Z_APDU *z_res, WRBUF w) { switch (z_req->which) @@ -267,6 +289,8 @@ static void log_1_line(Z_APDU *z_req, Z_APDU *z_res, WRBUF w) res->records->u.multipleNonSurDiagnostics->num_diagRecs, res->records->u.multipleNonSurDiagnostics->diagRecs); } + wrbuf_puts(w, " "); + log_syntax(w, req->preferredRecordSyntax); wrbuf_printf(w, " 1+" ODR_INT_PRINTF " ", res->numberOfRecordsReturned ? *res->numberOfRecordsReturned : 0); @@ -304,6 +328,10 @@ static void log_1_line(Z_APDU *z_req, Z_APDU *z_res, WRBUF w) res->records->u.multipleNonSurDiagnostics->num_diagRecs, res->records->u.multipleNonSurDiagnostics->diagRecs); } + wrbuf_puts(w, " "); + assert(req->preferredRecordSyntax); + log_syntax(w, req->preferredRecordSyntax); + wrbuf_printf(w, " %s " ODR_INT_PRINTF "+" ODR_INT_PRINTF " ", req->resultSetId, *req->resultSetStartPoint, *req->numberOfRecordsRequested);