Class: Loggability::LogDevice::File
- Inherits:
-
Loggability::LogDevice
- Object
- Loggability::LogDevice
- Loggability::LogDevice::File
- Defined in:
- lib/loggability/log_device/file.rb
Overview
A log device that delegates to the ruby’s default Logger’s file device and writes to a file descriptor or a file.
Constant Summary
Constants inherited from Loggability::LogDevice
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
The target of the log device.
Instance Method Summary collapse
-
#close ⇒ Object
close the file.
-
#initialize(target) ⇒ File
constructor
Create a new
File
device that will write to the file using the built-in ruby’sFile
log device. -
#write(message) ⇒ Object
Append the specified
message
to the target.
Methods inherited from Loggability::LogDevice
create, load_device_type, parse_device_spec
Constructor Details
#initialize(target) ⇒ File
Create a new File
device that will write to the file using the built-in ruby’s File
log device
13 14 15 |
# File 'lib/loggability/log_device/file.rb', line 13 def initialize( target ) @target = ::Logger::LogDevice.new( target ) end |
Instance Attribute Details
#target ⇒ Object (readonly)
The target of the log device
23 24 25 |
# File 'lib/loggability/log_device/file.rb', line 23 def target @target end |
Instance Method Details
#close ⇒ Object
close the file
33 34 35 |
# File 'lib/loggability/log_device/file.rb', line 33 def close self.target.close end |
#write(message) ⇒ Object
Append the specified message
to the target.
27 28 29 |
# File 'lib/loggability/log_device/file.rb', line 27 def write( ) self.target.write( ) end |