diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2011-10-19 14:53:34 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-10-19 14:54:00 -0500 |
commit | 18dbfcb36369ebb800a22325f689ff4cf27ef467 (patch) | |
tree | 7f72388105f8b93c8e408f42e0e5cec36469531a /activesupport/lib | |
parent | 533451a5b623a4c8c257d45381286ac236636272 (diff) | |
download | rails-18dbfcb36369ebb800a22325f689ff4cf27ef467.tar.gz rails-18dbfcb36369ebb800a22325f689ff4cf27ef467.tar.bz2 rails-18dbfcb36369ebb800a22325f689ff4cf27ef467.zip |
Programatically define the log level methods and use the Logger constants instead (SyslogLogger didnt define them as I expected)
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/tagged_logging.rb | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb index 0d8504bc1f..0cabb528ef 100644 --- a/activesupport/lib/active_support/tagged_logging.rb +++ b/activesupport/lib/active_support/tagged_logging.rb @@ -1,3 +1,5 @@ +require 'logger' + module ActiveSupport # Wraps any standard Logger class to provide tagging capabilities. Examples: # @@ -27,29 +29,12 @@ module ActiveSupport @logger.add(severity, "#{tags}#{message}", progname, &block) end - - def fatal(progname = nil, &block) - add(@logger.class::FATAL, progname, &block) - end - - def error(progname = nil, &block) - add(@logger.class::ERROR, progname, &block) - end - - def warn(progname = nil, &block) - add(@logger.class::WARN, progname, &block) - end - - def info(progname = nil, &block) - add(@logger.class::INFO, progname, &block) - end - - def debug(progname = nil, &block) - add(@logger.class::DEBUG, progname, &block) - end - - def unknown(progname = nil, &block) - add(@logger.class::UNKNOWN, progname, &block) + %w( fatal error warn info debug unkown ).each do |severity| + eval <<-EOM, nil, __FILE__, __LINE__ + 1 + def #{severity}(progname = nil, &block) + add(Logger::#{severity.upcase}, progname, &block) + end + EOM end |