From a6fd462a8019f0be512bcba7ce5b9f9e482c7f8e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 19 Jun 2012 11:56:27 -0700 Subject: make logger a singleton on the class --- activesupport/lib/active_support/log_subscriber.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/log_subscriber.rb b/activesupport/lib/active_support/log_subscriber.rb index 3023e0d274..720954625a 100644 --- a/activesupport/lib/active_support/log_subscriber.rb +++ b/activesupport/lib/active_support/log_subscriber.rb @@ -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 -- cgit v1.2.3