Sha256: 0c04815e5c4d297f3e658b6c2824d435b9a65832a45a3c68668abd6aa7976f09
Contents?: true
Size: 987 Bytes
Versions: 9
Compression:
Stored size: 987 Bytes
Contents
require "#{File.dirname(__FILE__)}/abstract_note" module Footnotes module Notes class LogNote < AbstractNote @@log = [] def self.log(message) @@log << message end def initialize(controller) @controller = controller end def title "Log (#{log.count("\n")})" 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) @log = @log[rindex..-1] end end @log end 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
Version data entries
9 entries across 9 versions & 2 rubygems