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
|
body = route.handler.call(context).to_s
|
||||||
return HTTP::Response.new(context.status_code, body, context.response_headers)
|
return HTTP::Response.new(context.status_code, body, context.response_headers)
|
||||||
rescue ex
|
rescue ex
|
||||||
|
Kemal::Logger::INSTANCE.write "Exception: #{ex.to_s}\n"
|
||||||
return render_500(ex.to_s)
|
return render_500(ex.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
require "colorize"
|
require "colorize"
|
||||||
|
|
||||||
class Kemal::Logger < HTTP::Handler
|
class Kemal::Logger < HTTP::Handler
|
||||||
|
INSTANCE = new
|
||||||
getter handler
|
getter handler
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
|
|
Loading…
Reference in a new issue