From: Adam Dickmeiss Date: Mon, 31 Aug 2015 09:31:56 +0000 (+0200) Subject: Facility disable/logging of POSTed content PAZ-1027 X-Git-Tag: v1.12.2~1 X-Git-Url: http://git.indexdata.com/?p=pazpar2-moved-to-github.git;a=commitdiff_plain;h=80327a52571cc68cfc23ea9ef086a4b5334b5d00 Facility disable/logging of POSTed content PAZ-1027 Log level "post" controls whether POSTed content is logged. This is enabled by default. To disable, use -v -post on the command line. --- diff --git a/src/http.c b/src/http.c index 1bbd4a1..e6d883a 100644 --- a/src/http.c +++ b/src/http.c @@ -81,6 +81,7 @@ struct http_buf struct http_buf *next; }; +static int log_level_post = 0; static void proxy_io(IOCHAN i, int event); static struct http_channel *http_channel_create(http_server_t http_server, @@ -959,8 +960,8 @@ static void http_io(IOCHAN i, int event) hc->request->path, *hc->request->search ? "?" : "", hc->request->search); - if (hc->request->content_buf) - yaz_log(YLOG_LOG, "%s", hc->request->content_buf); + if (hc->request->content_buf && log_level_post) + yaz_log(log_level_post, "%s", hc->request->content_buf); if (http_weshouldproxy(hc->request)) http_proxy(hc->request); else @@ -1452,8 +1453,10 @@ http_server_t http_server_create(void) hs->proxy_addr = 0; hs->ref_count = 1; hs->http_sessions = 0; - hs->record_file = 0; + + log_level_post = yaz_log_module_level("post"); + return hs; } diff --git a/src/pazpar2.c b/src/pazpar2.c index b3928aa..d56daba 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -120,6 +120,7 @@ static int sc_main( #endif yaz_log_init_prefix("pazpar2"); + yaz_log_init_level(yaz_log_mask_str("post")); yaz_log_xml_errors(0, YLOG_WARN); yaz_enable_panic_backtrace(argv[0]);