lib/semantic_logger/railtie.rb in semantic_logger-0.5.0 vs lib/semantic_logger/railtie.rb in semantic_logger-0.5.1

- old
+ new

@@ -67,20 +67,13 @@ "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed." ) logger end - # #TODO Should these be moved? # Replace the default Rails loggers - if defined?(ActiveRecord::Base) - ActiveRecord::Base.logger = SemanticLogger::Logger.new(ActiveRecord) - end - if defined?(ActionController::Base) - ActionController::Base.logger = SemanticLogger::Logger.new(ActionController) - end - if defined?(ActiveResource::Base) - ActiveResource::Base.logger = SemanticLogger::Logger.new(ActiveResource) - end + ActiveSupport.on_load(:active_record) { self.logger = SemanticLogger::Logger.new('ActiveRecord') } + ActiveSupport.on_load(:action_controller) { self.logger = SemanticLogger::Logger.new('ActionController') } + ActiveSupport.on_load(:action_mailer) { self.logger = SemanticLogger::Logger.new('ActionMailer') } SemanticLogger::Logger.logger.info "SemanticLogger initialized" end end