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` :)

Ensures we get some black magic using `tagged` and `mapped`.



30
31
32
# File 'lib/loggr/adapter/rails.rb', line 30

def logger(name, options = {})
  Loggr::Support::Annotations.enhance ::Rails.logger
end