diff options
author | Magnus Ahltorp <map@kth.se> | 2015-02-02 16:47:01 +0100 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2015-02-19 13:16:45 +0100 |
commit | 27f5d5042fdba70b97899d33e762666fb80415f1 (patch) | |
tree | 228517d96b41ff669ca80aa65490436a9a94a6c6 | |
parent | 8e44034c26ef661bcf89f097c05843f63a81f41a (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"}); |