source: subversion/sites/rails_port/config/initializers/buffered_logger.rb @ 15350

Last change on this file since 15350 was 6267, checked in by tomhughes, 11 years ago

Migrate web site to use rails 2.0.1.

File size: 481 bytes
Line 
1# Hack BufferedLogger to add timestamps to messages
2module ActiveSupport
3  class BufferedLogger
4    alias_method :old_add, :add
5
6    def add(severity, message = nil, progname = nil, &block)
7      return if @level > severity
8      message = (message || (block && block.call) || progname).to_s
9      time = Time.now
10      message = "[%s.%06d #%d] %s\n" % [time.strftime("%Y-%m-%d %H:%M:%S"), time.usec, $$, message.sub(/^\n+/, "")]
11      old_add(severity, message)
12    end
13  end
14end
Note: See TracBrowser for help on using the repository browser.