Sha256: cf95766cdf47f54f9b6ad677ad7e393247b4aecd385ff9d9f643ee65ebda643d

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module Lumberjack
  # This is an abstract class for logging devices. Subclasses must implement the +write+ method and
  # may implement the +close+ and +flush+ methods if applicable.
  class Device
    autoload :DateRollingLogFile, File.expand_path("../device/date_rolling_log_file.rb", __FILE__)
    autoload :LogFile, File.expand_path("../device/log_file.rb", __FILE__)
    autoload :Null, File.expand_path("../device/null.rb", __FILE__)
    autoload :RollingLogFile, File.expand_path("../device/rolling_log_file.rb", __FILE__)
    autoload :SizeRollingLogFile, File.expand_path("../device/size_rolling_log_file.rb", __FILE__)
    autoload :Writer, File.expand_path("../device/writer.rb", __FILE__)

    # Subclasses must implement this method to write a LogEntry.
    def write(entry)
      raise NotImpelementedError
    end
    
    # Subclasses may implement this method to close the device.
    def close
      flush
    end
    
    # Subclasses may implement this method to flush any buffers used by the device.
    def flush
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lumberjack-1.0.2 lib/lumberjack/device.rb
lumberjack-1.0.1 lib/lumberjack/device.rb
lumberjack-1.0.0 lib/lumberjack/device.rb