Sha256: 9988fa0cdaed9b382bc44c4086e914ebc303f8cb2ff64c6f31f3341f5946e3e3

Contents?: true

Size: 607 Bytes

Versions: 8

Compression:

Stored size: 607 Bytes

Contents

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

8 entries across 8 versions & 4 rubygems

Version Path
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.12/lib/lumberjack/device/log_file.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.12/lib/lumberjack/device/log_file.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.12/lib/lumberjack/device/log_file.rb
lumberjack-1.0.12 lib/lumberjack/device/log_file.rb
lumberjack-1.0.11 lib/lumberjack/device/log_file.rb
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.10/lib/lumberjack/device/log_file.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.10/lib/lumberjack/device/log_file.rb
lumberjack-1.0.10 lib/lumberjack/device/log_file.rb