class LogDevice
A compatible log device which can be used with module Console
. Suitable for use with code which (incorrectly) assumes that the log device a public interface and has certain methods/behaviours.
Definitions
def initialize(subject, output)
Create a new log device.
Signature
-
parameter
subject
String
The subject of the log messages.
-
parameter
output
Console::Interface
The output interface.
Implementation
def initialize(subject, output)
@subject = subject
@output = output
end
def write(message)
Write a message to the log device.
Signature
-
parameter
message
String
The message to write.
Implementation
def write(message)
@output.call(@subject, message)
end
def call(*arguments, **options)
Log a message with the given severity.
Signature
-
parameter
options
Hash
Additional options.
Implementation
def call(*arguments, **options)
@output.call(*arguments, **options)
end
def reopen
Reopen the log device. This is a no-op.
Implementation
def reopen
end
def close
Close the log device. This is a no-op.
Implementation
def close
end