Add exception logging. Closes #41
This commit is contained in:
parent
2585d97a58
commit
6a4ed2d9eb
2 changed files with 2 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require "colorize"
|
||||
|
||||
class Kemal::Logger < HTTP::Handler
|
||||
INSTANCE = new
|
||||
getter handler
|
||||
|
||||
def initialize
|
||||
|
|
Loading…
Reference in a new issue