Sha256: 13aa91df7fd1c6d6315bf23a77e9551fb8f3e3428623a2e7df7f1129cab7e90d

Contents?: true

Size: 543 Bytes

Versions: 4

Compression:

Stored size: 543 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
  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('%<hour>02d:%<min>02d:%<sec>02d',
               { hour: t.hour, min: t.min, sec: t.sec })
    @report.lines << "[#{f}] #{s}: #{text}"
  end
  alias msg log
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
teuton-2.1.10 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.1.9 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.1.8 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.1.8dev1 lib/teuton/case_manager/case/dsl/log.rb