Class: Relaton::Logger::LogDevice

Inherits:
Logger::LogDevice
  • Object
show all
Defined in:
lib/relaton/logger/log_device.rb

Instance Method Summary collapse

Constructor Details

#initialize(logdev, **args) ⇒ LogDevice

Returns a new instance of LogDevice.

Parameters:

  • header (Boolean, nil)

    whether to add header to log file



8
9
10
11
12
# File 'lib/relaton/logger/log_device.rb', line 8

def initialize(logdev, **args)
  # TODO: the header is not used yet, maybe it will be used in the future for not JSON formatters
  @header = args.delete :header
  super
end

Instance Method Details

#add_log_header(file) ⇒ Object



14
15
16
17
18
# File 'lib/relaton/logger/log_device.rb', line 14

def add_log_header(file)
  return unless @header

  super
end

#truncateObject



20
21
22
23
24
25
# File 'lib/relaton/logger/log_device.rb', line 20

def truncate
  return unless @dev.respond_to? :truncate

  @dev.truncate 0
  @dev.rewind
end