Add exception logging. Closes #41

This commit is contained in:
Sdogruyol 2016-01-04 21:54:58 +02:00
parent 2585d97a58
commit 6a4ed2d9eb
2 changed files with 2 additions and 0 deletions

View File

@ -33,6 +33,7 @@ class Kemal::Handler < HTTP::Handler
body = route.handler.call(context).to_s
return HTTP::Response.new(context.status_code, body, context.response_headers)
rescue ex
Kemal::Logger::INSTANCE.write "Exception: #{ex.to_s}\n"
return render_500(ex.to_s)
end
end

View File

@ -1,6 +1,7 @@
require "colorize"
class Kemal::Logger < HTTP::Handler
INSTANCE = new
getter handler
def initialize