Sha256: fbb88bd1bb43ecd22bb707f60ad7e14779a15bb9d48ea948809b8d119309f813

Contents?: true

Size: 639 Bytes

Versions: 4

Compression:

Stored size: 639 Bytes

Contents

# frozen_string_literals: true

require 'fileutils'

module Lumberjack
  class Device
    # This is a logging device that appends log entries to a file.
    class LogFile < Writer
      EXTERNAL_ENCODING = "ascii-8bit"

      # The absolute path of the file being logged to.
      attr_reader :path
      
      # Create a logger to the file at +path+. Options are passed through to the Writer constructor.
      def initialize(path, options = {})
        @path = File.expand_path(path)
        FileUtils.mkdir_p(File.dirname(@path))
        super(File.new(@path, 'a', :encoding => EXTERNAL_ENCODING), options)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/lumberjack-1.0.13/lib/lumberjack/device/log_file.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.13/lib/lumberjack/device/log_file.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.13/lib/lumberjack/device/log_file.rb
lumberjack-1.0.13 lib/lumberjack/device/log_file.rb