1
0
Fork 0
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:
Aaron Patterson 2012-06-19 11:56:27 -07:00
parent c6af7646ad
commit a6fd462a80

View file

@ -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