Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple logger handlers when custom logger is used #653

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/kemal/helpers/helpers.cr
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ end
# 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.
# `call(context)`, `write(message)` methods.
#
# ```
# class MyCustomLogger < Kemal::BaseLogHandler
# def call(env)
# def call(context)
# puts "I'm logging some custom stuff here."
# call_next(env) # => This calls the next handler
# call_next(context) # => This calls the next handler
# end
#
# # This is used from `log` method.
Expand All @@ -71,7 +71,6 @@ end
# ```
def logger(logger : Kemal::BaseLogHandler)
Kemal.config.logger = logger
Kemal.config.add_handler logger
end

# Enables / Disables static file serving.
Expand Down