From f60b245498829700f6d321a15bbc079d833758aa Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sun, 13 Sep 2020 16:41:43 +0200 Subject: ucs: show parameters in the log Signed-off-by: Alban Gruin --- src/ucs.ml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ucs.ml b/src/ucs.ml index cda7bcc..4a5f490 100644 --- a/src/ucs.ml +++ b/src/ucs.ml @@ -30,11 +30,10 @@ let fetch group = >>= fun (_resp, body) -> Cohttp_lwt.Body.to_string body -let log req = - let uri = Request.uri req and - datetime = CalendarLib.( +let log uri = + let datetime = CalendarLib.( Printer.Calendar.sprint "%Y-%m-%d %H:%M:%S" @@ Calendar.now ()) in - Lwt_io.printlf "[%s] %s" datetime (Uri.path uri) + Lwt_io.printlf "[%s] %s" datetime (Uri.path_and_query uri) let respond ?(mime="text/html; charset=utf-8") ?(status=`OK) body = let headers = Header.init_with "Content-Type" mime in @@ -48,7 +47,7 @@ let server = |> Astring.String.cuts ~empty:false ~sep:"/" |> List.map Uri.pct_decode and query = Uri.query uri in - log req >>= fun () -> + log uri >>= fun () -> match meth, path, query with | `GET, ([] | ["index.html"]), [] -> respond Pages.main | `GET, ["lnk"], ["group", [group]] -> -- cgit v1.2.1