Inspired by the buffered logger idea by Ezra
Methods
- A
- C
- F
- L
- N
- O
- R
- S
Included Modules
- ActiveSupport::BufferedLogger::Severity START:includes
Classes and Modules
Constants
MAX_BUFFER_SIZE | = | 1000 |
Attributes
[R] | auto_flushing |
Class Public methods
# File activesupport/lib/active_support/buffered_logger.rb, line 47 47: def initialize(log, level = DEBUG) 48: @log_dest = log 49: 50: unless log.respond_to?(:write) 51: unless File.exist?(File.dirname(log)) 52: ActiveSupport::Deprecation.warn("Automatic directory creation for '\#{log}' is deprecated. Please make sure the directory for your log file exists before creating the logger.\n") 53: FileUtils.mkdir_p(File.dirname(log)) 54: end 55: end 56: 57: @log = open_logfile log 58: self.level = level 59: end
Set to false to disable the silencer
Instance Public methods
Set the auto-flush period. Set to true to flush after every log message, to an integer to flush every N messages, or to false, nil, or zero to never auto-flush. If you turn auto-flushing off, be sure to regularly flush the log yourself — it will eat up memory until you do.
Silences the logger for the duration of the block.
# File activesupport/lib/active_support/buffered_logger.rb, line 30 30: def silence(temporary_level = ERROR) 31: if silencer 32: begin 33: logger = self.class.new @log_dest.dup, temporary_level 34: yield logger 35: ensure 36: logger.close 37: end 38: else 39: yield self 40: end 41: end