Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make logger a singleton on the class

  • Loading branch information...
commit a6fd462a8019f0be512bcba7ce5b9f9e482c7f8e 1 parent c6af764
@tenderlove tenderlove authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 activesupport/lib/active_support/log_subscriber.rb
View
10 activesupport/lib/active_support/log_subscriber.rb
@@ -48,14 +48,14 @@ class LogSubscriber
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 @@ def initialize
super
end
+ def logger
+ LogSubscriber.logger
+ end
+
def start(name, id, payload)
return unless logger
Please sign in to comment.
Something went wrong with that request. Please try again.