Commits

Kristian Fiskerstrand  committed 6de75fd

Disregard headers in requests in logfile for debuglevel < 6

  • Participants
  • Parent commits 918475b

Comments (0)

Files changed (2)

     default configuration support IPv6. (Requires OCaml 3.11.0 or newer)
   - Only use '-warn-error A' if the source is marked as development as per
     the version suffix (+) (part of BB Issue #2)
+  - Reduce logging verbosity for debug level lower than 6 for (i) bad requests, 
+    and (ii) no results found (removal of HTTP headers in log) (BB Issue #13)
 
 1.1.4
   - Fix X-HKP-Results-Count so that limit=0 returns no results, but include
   in
   sprintf "(%s %s)" kind request
 
+let request_to_string_logdepend request = 
+  let request_string = match !Settings.debuglevel with
+          _ when !Settings.debuglevel < 6 -> request_to_string_short request
+        | _ -> request_to_string request in
+  request_string
+
+
 (* Result codes and descriptions from                                               *)
 (* https://support.google.com/webmasters/bin/answer.py?hl=en&answer=40132           *)
 (* send_result exposes a completely open CORS policy, so use only with public data. *)
         | Bad_request s ->
             ignore (Unix.alarm recover_timeout);
             plerror 2 "Bad request %s: %s"
-              (request_to_string request) s;
+              (request_to_string_logdepend request) s;
             let output = HtmlTemplates.page ~title:"Bad request"
                  ~body:(sprintf "Bad request: %s" s)
             in
         | No_results s ->
             ignore (Unix.alarm recover_timeout);
             plerror 2 "No results for request %s: %s"
-              (request_to_string request) s;
+              (request_to_string_logdepend request) s;
             let output = HtmlTemplates.page ~title:"No results found"
              ~body:(sprintf "No results found: %s" s)
             in