diff options
author | Magnus Ahltorp <map@kth.se> | 2015-02-02 16:47:01 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2015-02-20 14:12:47 +0100 |
commit | 4f4a1cb883f53538ee25ba618aeae5d00202166f (patch) | |
tree | a2cf3d6c74a6c759107f81af2cffa963133b4dcf | |
parent | 5fbbb3e0bf7ea28dc8c5061ccb73fa5827872537 (diff) |
Log time spent serving a request
-rw-r--r-- | src/catlfish_web.erl | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/catlfish_web.erl b/src/catlfish_web.erl index f3231e4..9869b21 100644 --- a/src/catlfish_web.erl +++ b/src/catlfish_web.erl @@ -14,11 +14,13 @@ start(Options, Module) -> loop(Req, Module) -> "/" ++ Path = Req:get(path), try + Starttime = os:timestamp(), case Req:get(method) of 'GET' -> Query = Req:parse_qs(), lager:debug("GET ~p ~p", [Path, Query]), Result = Module:request(get, Path, Query), + lager:debug("GET finished: ~p us", [timer:now_diff(os:timestamp(), Starttime)]), case Result of none -> Req:respond({404, [{"Content-Type", "text/plain"}], "Page not found"}); @@ -29,6 +31,7 @@ loop(Req, Module) -> Body = Req:recv_body(), lager:debug("POST ~p ~p", [Path, Body]), Result = Module:request(post, Path, Body), + lager:debug("POST finished: ~p us", [timer:now_diff(os:timestamp(), Starttime)]), case Result of none -> Req:respond({404, [{"Content-Type", "text/plain"}], "Page not found"}); |