In Files

  • logger.rb

Parent

Methods

Logger::LogDevice

Constants

SiD

Attributes

dev[R]
filename[R]

Public Class Methods

new(log = nil, opt = {}) click to toggle source
 
               # File logger.rb, line 480
def initialize(log = nil, opt = {})
  @dev = @filename = @shift_age = @shift_size = nil
  @mutex = LogDeviceMutex.new
  if log.respond_to?(:write) and log.respond_to?(:close)
    @dev = log
  else
    @dev = open_logfile(log)
    @dev.sync = true
    @filename = log
    @shift_age = opt[:shift_age] || 7
    @shift_size = opt[:shift_size] || 1048576
  end
end
            

Public Instance Methods

close() click to toggle source
 
               # File logger.rb, line 507
def close
  @mutex.synchronize do
    @dev.close
  end
end
            
write(message) click to toggle source
 
               # File logger.rb, line 494
def write(message)
  @mutex.synchronize do
    if @shift_age and @dev.respond_to?(:stat)
      begin
        check_shift_log
      rescue
        raise Logger::ShiftingError.new("Shifting failed. #{$!}")
      end
    end
    @dev.write(message)
  end
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus