Class: Console::Compatible::Logger::LogDevice
- Inherits:
-
Object
- Object
- Console::Compatible::Logger::LogDevice
- Defined in:
- lib/console/compatible/logger.rb
Overview
A compatible log device which can be used with Console. Suitable for use with code which (incorrectly) assumes that the log device a public interface and has certain methods/behaviours.
Instance Method Summary collapse
-
#call(*arguments, **options) ⇒ Object
Log a message with the given severity.
-
#close ⇒ Object
Close the log device.
-
#initialize(subject, output) ⇒ LogDevice
constructor
Create a new log device.
-
#reopen ⇒ Object
Reopen the log device.
-
#write(message) ⇒ Object
Write a message to the log device.
Constructor Details
#initialize(subject, output) ⇒ LogDevice
Create a new log device.
19 20 21 22 |
# File 'lib/console/compatible/logger.rb', line 19 def initialize(subject, output) @subject = subject @output = output end |
Instance Method Details
#call(*arguments, **options) ⇒ Object
Log a message with the given severity.
35 36 37 |
# File 'lib/console/compatible/logger.rb', line 35 def call(*arguments, **) @output.call(*arguments, **) end |
#close ⇒ Object
Close the log device. This is a no-op.
44 45 |
# File 'lib/console/compatible/logger.rb', line 44 def close end |
#reopen ⇒ Object
Reopen the log device. This is a no-op.
40 41 |
# File 'lib/console/compatible/logger.rb', line 40 def reopen end |
#write(message) ⇒ Object
Write a message to the log device.
27 28 29 |
# File 'lib/console/compatible/logger.rb', line 27 def write() @output.call(@subject, ) end |