class Climatic::Logger::Accumulator
Constants
- STACK_OPS
Attributes
level[RW]
log_lines[R]
Public Class Methods
new()
click to toggle source
# File lib/climatic/logger/accumulator.rb, line 10 def initialize @log_lines = [{op: :debug, args: ['Starting special temporary "accumulator" logger...']}] end
Public Instance Methods
method_missing(method_name, *args)
click to toggle source
Calls superclass method
# File lib/climatic/logger/accumulator.rb, line 30 def method_missing(method_name, *args) if STACK_OPS.include? method_name stack method_name, *args else super end end
respond_to_missing?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/climatic/logger/accumulator.rb, line 38 def respond_to_missing?(method_name, include_private = false) STACK_OPS.include?(method_name) || super end
stack(op, *args)
click to toggle source
# File lib/climatic/logger/accumulator.rb, line 14 def stack(op, *args) log_lines << {op: op, args: args} end
transfer_content_to(other_logger)
click to toggle source
# File lib/climatic/logger/accumulator.rb, line 18 def transfer_content_to(other_logger) debug "Transferring accumulated logs to logger '#{other_logger.inspect}'" if other_logger.nil? @log_lines = [] return end log_lines.each do |log_line| other_logger.send log_line[:op], *log_line[:args] end @log_lines = [] end