Sha256: c027aadc5be728203e093667dbe68a602e55355930a0b25fa2b059f8c6bd5cb8
Contents?: true
Size: 630 Bytes
Versions: 4
Compression:
Stored size: 630 Bytes
Contents
# frozen_string_literal: true ## # Case class -> DSL module : log function module DSL ## # Record log message # @param text (String) # @param type (Symbol) Values :info, :warn or :error # rubocop:disable Style/FormatStringToken def log(text = '', type = :info) s = '' s = Rainbow('WARN!').color(:yellow) if type == :warn s = Rainbow('ERROR').bg(:red) if type == :error t = Time.now # f = format('%02d:%02d:%02d', t.hour, t.min, t.sec) f = '%02d:%02d:%02d' % [t.hour, t.min, t.sec] @report.lines << "[#{f}] #{s}: #{text}" end # rubocop:enable Style/FormatStringToken alias msg log end
Version data entries
4 entries across 4 versions & 1 rubygems