1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Specify log subscribers need a logger set before they can receive events

The current example code for `ActiveSupport::LogSubscriber` mysteriously
fails if you're using it outside of Rails. This helps clarify a logger
needs to be set first before log subscribers can process events.

[ci skip]
This commit is contained in:
Gannon McGibbon 2019-07-12 19:02:12 -04:00
parent 88b91299f3
commit 171965810e

View file

@ -29,6 +29,9 @@ module ActiveSupport
# subscriber, the line above should be called after your
# <tt>ActiveRecord::LogSubscriber</tt> definition.
#
# A logger also needs to be set with <tt>ActiveRecord::LogSubscriber.logger=</tt>.
# This is assigned automatically in a Rails environment.
#
# After configured, whenever a <tt>"sql.active_record"</tt> notification is published,
# it will properly dispatch the event
# (<tt>ActiveSupport::Notifications::Event</tt>) to the sql method.