diff options
author | Alban Gruin | 2020-09-12 16:58:31 +0200 |
---|---|---|
committer | Alban Gruin | 2020-09-12 17:04:05 +0200 |
commit | d3ae708373eba13e961a70d752b36ec41cec2510 (patch) | |
tree | 3542e93cce926808c7449abb4e888f18ab6ca53a | |
parent | 6a0b1d0778aacd1e5baf57940f48f940abc80652 (diff) |
ucs: log queries
Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
-rw-r--r-- | src/ucs.ml | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -30,6 +30,12 @@ let fetch group = >>= fun (_resp, body) -> Cohttp_lwt.Body.to_string body +let log req = + let uri = Request.uri req and + datetime = CalendarLib.( + Printer.Calendar.sprint "%Y-%m-%d %H:%M:%S" @@ Calendar.now ()) in + Lwt_io.printlf "[%s] %s" datetime (Uri.path uri) + let server = let callback _conn req _body = let meth = Request.meth req and @@ -37,6 +43,7 @@ let server = |> Uri.path |> Astring.String.cuts ~empty:false ~sep:"/" |> List.map Uri.pct_decode in + log req >>= fun () -> match meth, uri with | `GET, ["ics"; file] when Astring.String.is_suffix ~affix:".ics" file -> let group = String.(sub file 0 (length file - 4)) in |