require "logger" module Boty module Logger attr_writer :logger def self.adapter=(adapter) @adapter = adapter end def self.adapter @adapter ||= ::Logger.new(STDOUT).tap { |logger| logger.level = ::Logger::DEBUG } end def logger Logger.adapter end class Multi < ::Logger def initialize(adapters) @adapters = adapters end def level=(level) @adapters.each do |adapter| adapter.level = level end end def add(*args, &block) @adapters.each do |adapter| adapter.add(*args, &block) end end end class Memory < ::Logger attr_reader :logs def initialize(*args) @logs = [] end def add(*args, &block) @logs << if block_given? block.call else args[2] end end end class Null < ::Logger def initialize(*args); end def add(*args, &block); end end end end