Sha256: 329734cd15a48280a48c522926bd5340771c404179f339202eae269f0de6bb2a

Contents?: true

Size: 809 Bytes

Versions: 5

Compression:

Stored size: 809 Bytes

Contents

#!/usr/bin/env ruby
# vim: set nosta noet ts=4 sw=4:
# encoding: utf-8

require 'logger'
require 'loggability/logger' unless defined?( Loggability::Logger )

# A log device that delegates to the ruby's default Logger's file device and writes
# to a file descriptor or a file.
class Loggability::LogDevice::File < Loggability::LogDevice

	### Create a new +File+ device that will write to the file using the built-in ruby's +File+ log device
	def initialize( target )
		@target = ::Logger::LogDevice.new( target )
	end


	######
	public
	######

	# The target of the log device
	attr_reader :target


	### Append the specified +message+ to the target.
	def write( message )
		self.target.write( message )
	end


	### close the file
	def close
		self.target.close
	end

end # class Loggability::LogDevice::File

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
loggability-0.18.2 lib/loggability/log_device/file.rb
loggability-0.18.1 lib/loggability/log_device/file.rb
loggability-0.18.0 lib/loggability/log_device/file.rb
loggability-0.17.0 lib/loggability/log_device/file.rb
loggability-0.16.0 lib/loggability/log_device/file.rb