Class | Logger::LogDevice
In: | logger.rb
Parent: | Object

### Methods

close new write

### Classes and Modules

Class Logger::LogDevice::LogDeviceMutex

### Constants

SiD | = | 24 * 60 * 60

### Attributes

dev | [R] |
filename | [R] |

### Public Class methods

new(log = nil, opt = {})

[Source]

    # File logger.rb, line 490
        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()

[Source]

    # File logger.rb, line 517
        def close
          @mutex.synchronize do
            @dev.close
          end
        end

write(message)

[Source]

    # File logger.rb, line 504
        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

[Validate]