Permalink
Browse files

Add BufferedLogger#add #9667 [tomafro]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7634 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
dhh committed Sep 25, 2007
1 parent 42d3547 commit 6f0390c957d77d74ace3258fbeac5ae8a9a0b7b8
Showing with 11 additions and 6 deletions.
  1. +11 −6 activesupport/lib/active_support/buffered_logger.rb
@@ -49,14 +49,19 @@ def initialize(log, level = DEBUG)
end
end
def add(severity, message = nil, progname = nil, &block)
return if @level > severity
message = message || (block && block.call) || progname
message << "\n" unless message[-1] == ?\n
@buffer << message
flush if auto_flushing
message
end
for severity in Severity.constants
class_eval <<-EOT
def #{severity.downcase}(message)
return if @level > #{severity}
message << "\\n" unless message[-1] == ?\\n
@buffer << message
flush if auto_flushing
message
def #{severity.downcase}(message = nil, progname = nil, &block)
add(#{severity}, message, progname, &block)
end
def #{severity.downcase}?

0 comments on commit 6f0390c

Please sign in to comment.