Class: Lumberjack::Device::DateRollingLogFile Deprecated

Inherits:
LogFile show all
Defined in:
lib/lumberjack/device/date_rolling_log_file.rb

Overview

Deprecated.

Use Lumberjack::Device::LogFile

Deprecated device. Use LogFile instead.

Constant Summary

Constants inherited from Writer

Writer::EDGE_WHITESPACE_PATTERN

Instance Attribute Summary

Attributes inherited from Writer

#stream

Instance Method Summary collapse

Methods inherited from LogFile

#dev, #path, #reopen

Methods inherited from Writer

#close, #datetime_format, #datetime_format=, #dev, #flush, #path, #write

Methods inherited from Lumberjack::Device

#close, #datetime_format, #datetime_format=, #dev, #flush, open_device, #reopen, #write

Constructor Details

#initialize(path, options = {}) ⇒ DateRollingLogFile

Returns a new instance of DateRollingLogFile.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/lumberjack/device/date_rolling_log_file.rb', line 10

def initialize(path, options = {})
  Utils.deprecated("Lumberjack::Device::DateRollingLogFile", "Lumberjack::Device::DateRollingLogFile is deprecated and will be removed in version 2.1; use Lumberjack::Device::LogFile instead.")

  unless options[:roll]&.to_s&.match(/(daily)|(weekly)|(monthly)/i)
    raise ArgumentError.new("illegal value for :roll (#{options[:roll].inspect})")
  end

  new_options = options.reject { |k, _| k == :roll }.merge(shift_age: options[:roll].to_s.downcase)

  super(path, new_options)
end