aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/log_subscriber.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-06-19 11:56:27 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-06-19 14:41:31 -0700
commita6fd462a8019f0be512bcba7ce5b9f9e482c7f8e (patch)
treeb9eaa1ebd559d454b642e66a5cf68b96b45c8057 /activesupport/lib/active_support/log_subscriber.rb
parentc6af7646ad6975b46daee7e800a90fbd88431d6b (diff)
downloadrails-a6fd462a8019f0be512bcba7ce5b9f9e482c7f8e.tar.gz
rails-a6fd462a8019f0be512bcba7ce5b9f9e482c7f8e.tar.bz2
rails-a6fd462a8019f0be512bcba7ce5b9f9e482c7f8e.zip
make logger a singleton on the class
Diffstat (limited to 'activesupport/lib/active_support/log_subscriber.rb')
-rw-r--r--activesupport/lib/active_support/log_subscriber.rb10
1 files changed, 7 insertions, 3 deletions
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