Sha256: 636613200867a4653c4fba1fab15e7da50caa88dca20eab0d239816ca064d100
Contents?: true
Size: 590 Bytes
Versions: 9
Compression:
Stored size: 590 Bytes
Contents
module Blazing class Logger LOG_LEVELS = [:info, :success, :warn, :error] def initialize(output = $stdout) @output = output end def messages @messages ||= [] end def log(type, message) if LOG_LEVELS.include? type messages << Hash[:message => message, :type => type] else raise end end def report(type = nil) if type messages.select { |m| m[:type] == type }.each { |m| @output.puts m[:message] } else messages.each { |m| @output.puts m[:message] } end end end end
Version data entries
9 entries across 9 versions & 1 rubygems