Sha256: c2f93e3443cf081d2c912686756befd1ab9b2da08b80c7effbf55ff985312b7e

Contents?: true

Size: 535 Bytes

Versions: 3

Compression:

Stored size: 535 Bytes

Contents

require 'fileutils'

module Lumberjack
  class Device
    # This is a logging device that appends log entries to a file.
    class LogFile < Writer
      # 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'), options)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lumberjack-1.0.2 lib/lumberjack/device/log_file.rb
lumberjack-1.0.1 lib/lumberjack/device/log_file.rb
lumberjack-1.0.0 lib/lumberjack/device/log_file.rb