class Derelict::Utils::Logger::ArrayOutputter
A Log4r Outputter which stores all logs in an array
Logs are stored in the internal array by write
. Logs can be cleared using flush
, which returns the flushed logs too.
Public Instance Methods
flush()
click to toggle source
Clear internal log messages array and return the erased data
# File lib/derelict/utils/logger/array_outputter.rb, line 24 def flush messages.dup.tap { messages.clear } end
level()
click to toggle source
Force the outputter to receive and store all levels of messages
# File lib/derelict/utils/logger/array_outputter.rb, line 13 def level Log4r::ALL end
messages()
click to toggle source
The internal array of messages
# File lib/derelict/utils/logger/array_outputter.rb, line 18 def messages [] end
Private Instance Methods
write(message)
click to toggle source
Write a message to the internal array
This is an abstract method in the parent class, and handles persisting the log data. In this class, it saves the message into an internal array to be retrieved later.
* message: The log message to be persisted
# File lib/derelict/utils/logger/array_outputter.rb, line 37 def write(message) messages << message end