Class: Derelict::Utils::Logger::ArrayOutputter

Inherits:
Log4r::Outputter
  • Object
show all
Extended by:
Memoist
Defined in:
lib/derelict/utils/logger/array_outputter.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#flushObject

Clear internal log messages array and return the erased data



24
25
26
# File 'lib/derelict/utils/logger/array_outputter.rb', line 24

def flush
  messages.dup.tap { messages.clear }
end

#levelObject

Force the outputter to receive and store all levels of messages



13
14
15
# File 'lib/derelict/utils/logger/array_outputter.rb', line 13

def level
  Log4r::ALL
end

#messagesObject

The internal array of messages



18
19
20
# File 'lib/derelict/utils/logger/array_outputter.rb', line 18

def messages
  []
end