Rename common_log_handler and common_exception_handler

This commit is contained in:
Serdar Dogruyol 2017-10-06 20:34:18 +03:00
parent ac56973663
commit 5d737ee8f3
6 changed files with 21 additions and 21 deletions

View file

@ -117,7 +117,7 @@ module Kemal
private def setup_log_handler
@logger ||= if @logging
Kemal::CommonLogHandler.new
Kemal::LogHandler.new
else
Kemal::NullLogHandler.new
end
@ -127,7 +127,7 @@ module Kemal
private def setup_error_handler
if @always_rescue
@error_handler ||= Kemal::CommonExceptionHandler.new
@error_handler ||= Kemal::ExceptionHandler.new
HANDLERS.insert(@handler_position, @error_handler.not_nil!)
@handler_position += 1
end

View file

@ -1,6 +1,6 @@
module Kemal
# Handles all the exceptions, including 404, custom errors and 500.
class CommonExceptionHandler
class ExceptionHandler
include HTTP::Handler
INSTANCE = new

View file

@ -3,8 +3,8 @@
# goes between the first 4 and the last `Kemal::RouteHandler`.
#
# - `Kemal::InitHandler`
# - `Kemal::CommonLogHandler`
# - `Kemal::CommonExceptionHandler`
# - `Kemal::LogHandler`
# - `Kemal::ExceptionHandler`
# - `Kemal::StaticFileHandler`
# - Here goes custom handlers
# - `Kemal::RouteHandler`
@ -24,7 +24,7 @@ def public_folder(path : String)
end
# Logs the output via `logger`.
# This is the built-in `Kemal::CommonLogHandler` by default which uses STDOUT.
# This is the built-in `Kemal::LogHandler` by default which uses STDOUT.
def log(message : String)
Kemal.config.logger.write "#{message}\n"
end
@ -39,7 +39,7 @@ def logging(status : Bool)
Kemal.config.logging = status
end
# This is used to replace the built-in `Kemal::CommonLogHandler` with a custom logger.
# This is used to replace the built-in `Kemal::LogHandler` with a custom logger.
#
# A custom logger must inherit from `Kemal::BaseLogHandler` and must implement
# `call(env)`, `write(message)` methods.

View file

@ -1,6 +1,6 @@
module Kemal
# Uses `STDOUT` by default and handles the logging of request/response process time.
class CommonLogHandler < Kemal::BaseLogHandler
class LogHandler < Kemal::BaseLogHandler
@io : IO
def initialize(@io : IO = STDOUT)