class LogStashLogger::Device::File

Public Class Methods

new(opts) click to toggle source
Calls superclass method LogStashLogger::Device::Base::new
# File lib/logstash-logger/device/file.rb, line 6
def initialize(opts)
  super
  @path = opts[:path] || fail(ArgumentError, "Path is required")
  open
end

Public Instance Methods

open() click to toggle source
# File lib/logstash-logger/device/file.rb, line 12
def open
  unless ::File.exist? ::File.dirname @path
    ::FileUtils.mkdir_p ::File.dirname @path
  end

  @io = ::File.open @path, ::File::WRONLY | ::File::APPEND | ::File::CREAT
  @io.binmode
  @io.sync = self.sync
end