Class: Loggr::Adapter::RailsAdapter

Inherits:
AbstractAdapter show all
Defined in:
lib/loggr/adapter/rails.rb

Overview

Always uses the logger defined on ‘Rails.logger`, CAVEAT ensure to never ever set `Rails.logger` to this backend, i.e.:

# IF YOU DID THIS...
Loggr.adapter = Loggr::Adapter::Rails

MyApp::Application.configure do
  # ...NEVER DO THIS !!!
  config.logger = Loggr.logger('rails')
end

If you are using the rails adapter, ensure that you do not override ‘config.logger` with an instance of the Rails adapter logger factory. Keep the default logger, or create a new one using:

config.logger = Loggr.logger('rails', :backend => Loggr::Adapter::Buffered)

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#mdc

Instance Method Details

#logger(name, options = {}) ⇒ Object

The rails backend ignores all options as it just returns always returns ‘Rails.logger` :)



28
29
30
# File 'lib/loggr/adapter/rails.rb', line 28

def logger(name, options = {})
  ::Rails.logger
end