Project

any_logger

0.0
The project is in a healthy, maintained state
A DSL for simplifying modification of Rails ActiveSupport Instrumentation API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Project Readme

AnyLogger

A DSL for simplifying modification of Rails ActiveSupport Instrumentation API

Example

# initializers/any_logger.rb
require "any_logger"
require "any_logger/example/controller_subscriber"

AnyLogger.configure do |config|
  config.logger = Rails::Rack::Logger # default: AnyLogger::Example::RackLogger

  config.subscriber.attach :action_mailer, MyLogger::ModelSubscriber
  # If you call swap, detach, or attach directly in config, the subscriber will be set
  config.swap :action_controller, AnyLogger::Example::ControllerSubscriber
  config.detach :action_view

  # Event can be attached using either a class or a block
  config.event.swap :active_record, :sql, MyLogger::ActiveRecord::Sql
  config.event.attach :active_job, :discard do |event|
    MyErrorReporter.notify(event)
  end
end