aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/clean_logger.rb
blob: 3632a27c40a9add7fd4aeeb829ba5a87c52f40e8 (plain) (tree)
1
2
3
4
5
6
7
8
9


                     
                                                      



                                                         
                                 

     






                                                          
require 'logger'

class Logger #:nodoc:
  # Silences the logger for the duration of the block.
  def silence(temporary_level = Logger::ERROR)
    old_logger_level, self.level = level, temporary_level
    yield
  ensure
    self.level = old_logger_level
  end

  private
    remove_const "Format"
    Format = "%s\n"
    def format_message(severity, timestamp, msg, progname)
      Format % [msg]
    end
end