Sha256: 2c5c1d65687db3060f0a14fd7ddbcc2d46269f606042c65801f40125e9af6e37

Contents?: true

Size: 420 Bytes

Versions: 5

Compression:

Stored size: 420 Bytes

Contents

require 'logger'
require 'fileutils'

class Peastash
  class LogDevice < ::Logger::LogDevice
    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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
peastash-0.2.5 lib/peastash/log_device.rb
peastash-0.2.4 lib/peastash/log_device.rb
peastash-0.2.3 lib/peastash/log_device.rb
peastash-0.2.2 lib/peastash/log_device.rb
peastash-0.2.1 lib/peastash/log_device.rb