lib/rails-footnotes/notes/log_note.rb in rails3-footnotes-4.0.0.pre.4 vs lib/rails-footnotes/notes/log_note.rb in rails3-footnotes-4.0.0.pre.5
- old
+ new
@@ -2,15 +2,15 @@
module Footnotes
module Notes
class LogNote < AbstractNote
@@log = []
-
+
def self.log(message)
@@log << message
end
-
+
def initialize(controller)
@controller = controller
end
def title
@@ -18,11 +18,11 @@
end
def content
escape(log.gsub(/\e\[.+?m/, '')).gsub("\n", '<br />')
end
-
+
def log
unless @log
@log = @@log.join('')
@@log = []
if rindex = @log.rindex('Processing '+@controller.class.name+'#'+@controller.action_name)
@@ -30,17 +30,18 @@
end
end
@log
end
+ # FIXME (andre 2011-04-04) Fix this to collect Rails 3 logs
module LoggingExtensions
def add(*args, &block)
logged_message = super
Footnotes::Notes::LogNote.log(logged_message)
logged_message
end
end
-
+
Rails.logger.extend LoggingExtensions
end
end
end