mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
make logger a singleton on the class
This commit is contained in:
parent
c6af7646ad
commit
a6fd462a80
1 changed files with 7 additions and 3 deletions
|
@ -48,14 +48,14 @@ module ActiveSupport
|
|||
mattr_accessor :colorize_logging
|
||||
self.colorize_logging = true
|
||||
|
||||
class_attribute :logger
|
||||
|
||||
class << self
|
||||
remove_method :logger
|
||||
def logger
|
||||
@logger ||= Rails.logger if defined?(Rails)
|
||||
@logger
|
||||
end
|
||||
|
||||
attr_writer :logger
|
||||
|
||||
def attach_to(namespace, log_subscriber=new, notifier=ActiveSupport::Notifications)
|
||||
log_subscribers << log_subscriber
|
||||
@@flushable_loggers = nil
|
||||
|
@ -91,6 +91,10 @@ module ActiveSupport
|
|||
super
|
||||
end
|
||||
|
||||
def logger
|
||||
LogSubscriber.logger
|
||||
end
|
||||
|
||||
def start(name, id, payload)
|
||||
return unless logger
|
||||
|
||||
|
|
Loading…
Reference in a new issue