aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2020-09-12 16:58:31 +0200
committerAlban Gruin2020-09-12 17:04:05 +0200
commitd3ae708373eba13e961a70d752b36ec41cec2510 (patch)
tree3542e93cce926808c7449abb4e888f18ab6ca53a
parent6a0b1d0778aacd1e5baf57940f48f940abc80652 (diff)
ucs: log queries
Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
-rw-r--r--src/ucs.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ucs.ml b/src/ucs.ml
index 92814f6..c9fcf95 100644
--- a/src/ucs.ml
+++ b/src/ucs.ml
@@ -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