Use log instead

This commit is contained in:
Sdogruyol 2016-12-04 01:27:26 +03:00
parent 66e04ecaec
commit 1afb4cbfa8
2 changed files with 3 additions and 3 deletions

View file

@ -30,7 +30,7 @@ module Kemal
# Test environment doesn't need to have signal trap, built-in images, and logging. # Test environment doesn't need to have signal trap, built-in images, and logging.
unless config.env == "test" unless config.env == "test"
Signal::INT.trap { Signal::INT.trap {
config.logger.write "Kemal is going to take a rest!\n" log "Kemal is going to take a rest!\n"
config.server.close config.server.close
exit exit
} }
@ -46,7 +46,7 @@ module Kemal
end end
end end
config.logger.write "[#{config.env}] Kemal is ready to lead at #{config.scheme}://#{config.host_binding}:#{config.port}\n" log "[#{config.env}] Kemal is ready to lead at #{config.scheme}://#{config.host_binding}:#{config.port}\n"
config.server.listen config.server.listen
end end
end end

View file

@ -11,7 +11,7 @@ module Kemal
rescue ex : Kemal::Exceptions::CustomException rescue ex : Kemal::Exceptions::CustomException
call_exception_with_status_code(context, ex, context.response.status_code) call_exception_with_status_code(context, ex, context.response.status_code)
rescue ex : Exception rescue ex : Exception
Kemal.config.logger.write("Exception: #{ex.inspect_with_backtrace}\n") log("Exception: #{ex.inspect_with_backtrace}\n")
return call_exception_with_status_code(context, ex, 500) if Kemal.config.error_handlers.has_key?(500) return call_exception_with_status_code(context, ex, 500) if Kemal.config.error_handlers.has_key?(500)
verbosity = Kemal.config.env == "production" ? false : true verbosity = Kemal.config.env == "production" ? false : true
return render_500(context, ex.inspect_with_backtrace, verbosity) return render_500(context, ex.inspect_with_backtrace, verbosity)