Method: Hanami.logger

Defined in:
lib/hanami.rb

.loggerDry::Logger::Dispatcher

Returns the app’s logger.

Direct global access to the logger via this method is not recommended. Instead, consider accessing the logger via the app or slice container, in most cases as an dependency using the Deps mixin.

Examples:

# app/my_component.rb

module MyApp
  class MyComponent
    include Deps["logger"]

    def some_method
      logger.info("hello")
    end
  end
end

Returns:

  • (Dry::Logger::Dispatcher)

Since:

  • 1.0.0



215
216
217
# File 'lib/hanami.rb', line 215

def self.logger
  app[:logger]
end