# class MonoLogger::LocklessLogDevice

### Public Class Methods

new(log = nil) click to toggle source

    # File lib/chef/monologger.rb, line 45
    def initialize(log = nil)
      @dev = @filename = @shift_age = @shift_size = nil
      if log.respond_to?(:write) and log.respond_to?(:close)
        @dev = log
      else
        @dev = open_logfile(log)
        @filename = log
      end
      @dev.sync = true
    end

### Public Instance Methods

close() click to toggle source

    # File lib/chef/monologger.rb, line 62
    def close
      @dev.close rescue nil
    end

write(message) click to toggle source

    # File lib/chef/monologger.rb, line 56
    def write(message)
      @dev.write(message)
    rescue Exception => ignored
      warn("log writing failed. #{ignored}")
    end