class Lumberjack::Device::LogFile

This is a logging device that appends log entries to a file.

Constants

EXTERNAL_ENCODING

Attributes

path[R]

The absolute path of the file being logged to.

Public Class Methods

new(path, options = {}) click to toggle source

Create a logger to the file at path. Options are passed through to the Writer constructor.

Calls superclass method
# File lib/lumberjack/device/log_file.rb, line 15
def initialize(path, options = {})
  @path = File.expand_path(path)
  FileUtils.mkdir_p(File.dirname(@path))
  super(file_stream, options)
end

Public Instance Methods

reopen(logdev = nil) click to toggle source
# File lib/lumberjack/device/log_file.rb, line 21
def reopen(logdev = nil)
  close
  @stream = file_stream
end

Private Instance Methods

file_stream() click to toggle source
# File lib/lumberjack/device/log_file.rb, line 28
def file_stream
  File.new(@path, "a", encoding: EXTERNAL_ENCODING)
end