Class: Console::Compatible::Logger::LogDevice

Inherits:
Object
  • Object
show all
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

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, **options)
	@output.call(*arguments, **options)
end

#closeObject

Close the log device. This is a no-op.



44
45
# File 'lib/console/compatible/logger.rb', line 44

def close
end

#reopenObject

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(message)
	@output.call(@subject, message)
end