Module: RailsCustomLogging

Defined in:
lib/rails_custom_logging.rb,
lib/rails_custom_logging/railtie.rb,
lib/rails_custom_logging/version.rb,
lib/rails_custom_logging/configuration.rb,
lib/rails_custom_logging/formatters/key_value.rb,
lib/rails_custom_logging/transformers/default.rb,
lib/rails_custom_logging/rails_ext/rack/logger.rb,
lib/rails_custom_logging/subscribers/action_controller.rb

Defined Under Namespace

Modules: Formatters, Rack, Subscribers, Transformers Classes: Configuration, Error, Railtie

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configurationObject



26
27
28
# File 'lib/rails_custom_logging.rb', line 26

def self.configuration
  @_configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



22
23
24
# File 'lib/rails_custom_logging.rb', line 22

def self.configure
  yield configuration
end

.enabled?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/rails_custom_logging.rb', line 38

def self.enabled?
  configuration.enabled == true
end

.formatterObject



30
31
32
# File 'lib/rails_custom_logging.rb', line 30

def self.formatter
  configuration.formatter
end

.setup(app) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/rails_custom_logging.rb', line 13

def self.setup(app)
  # Remove Rails default subscribers
  ActionController::LogSubscriber.detach_from :action_controller
  ActionView::LogSubscriber.detach_from :action_view

  # Add our own
  Subscribers::ActionController.attach_to :action_controller
end

.transformerObject



34
35
36
# File 'lib/rails_custom_logging.rb', line 34

def self.transformer
  configuration.transformer
end