Custom Logger Setup a custom logger for your Hanami project

Custom Logger

You can specify a custom logger in cases where you desire different logging behaviour. For example, the Timber logger:

# config/environment.rb
# ...

Hanami.configure do
  # ...

  environment :production do
    logger Timber::Logger.new($stdout)

    # ...
  end
end

Use this logger as normal via Hanami.logger. It’s important to note that any logger chosen must conform to the default ::Logger interface.

Twitter Facebook

Want to learn more about Hanami?

We have written an extensive Getting Started guide for curious people like you.