improvement: use Time.measure

This commit is contained in:
Alexander Reelsen 2019-03-20 08:39:36 +01:00
parent c6ac5232db
commit 14ed2aa8bf

View file

@ -5,9 +5,8 @@ module Kemal
end
def call(context : HTTP::Server::Context)
time = Time.monotonic
call_next(context)
elapsed_text = elapsed_text(Time.monotonic - time)
elapsed_time = Time.measure { call_next(context) }
elapsed_text = elapsed_text(elapsed_time)
@io << Time.now << ' ' << context.response.status_code << ' ' << context.request.method << ' ' << context.request.resource << ' ' << elapsed_text << '\n'
context
end