Class: Peastash::LogDevice

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

Instance Method Summary collapse

Instance Method Details

#open_logfile(filename) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/peastash/log_device.rb', line 6

def open_logfile(filename)
  super
rescue Errno::EACCES
  stat_data = File.stat(filename) rescue nil
  STDERR.puts "[#{Time.now}][#{Process.pid}] Could not open #{filename} for writing, recreating it. Info: #{stat_data.inspect}"
  FileUtils.rm(filename)
  create_logfile(filename)
end