Sha256: fa03457ec19f5282102b99e12e24d94528ecd8d9ca98805e0970b22b73bb907e

Contents?: true

Size: 1.19 KB

Versions: 13

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literals: true

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
    require_relative "device/writer"
    require_relative "device/log_file"
    require_relative "device/rolling_log_file"
    require_relative "device/date_rolling_log_file"
    require_relative "device/size_rolling_log_file"
    require_relative "device/multi"
    require_relative "device/null"

    # Subclasses must implement this method to write a LogEntry.
    def write(entry)
      raise NotImplementedError
    end

    # Subclasses may implement this method to close the device.
    def close
      flush
    end

    # Subclasses may implement this method to reopen the device.
    def reopen(logdev = nil)
      flush
    end

    # Subclasses may implement this method to flush any buffers used by the device.
    def flush
    end

    # Subclasses may implement this method to get the format for log timestamps.
    def datetime_format
    end

    # Subclasses may implement this method to set a format for log timestamps.
    def datetime_format=(format)
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.35 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.34 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.33 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.32 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.31 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.30 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.29 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.28 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.27 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.26 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
qiita_org-0.1.25 gems/ruby/2.7.0/gems/lumberjack-1.2.8/lib/lumberjack/device.rb
lumberjack-1.2.8 lib/lumberjack/device.rb