Sha256: 897deb4a460546b921c95bb0a8601a2c123ca9740279aaa0be61a2a1f6f15a00

Contents?: true

Size: 527 Bytes

Versions: 8

Compression:

Stored size: 527 Bytes

Contents

# frozen_string_literal: true

##
# Define DSL#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

8 entries across 8 versions & 1 rubygems

Version Path
teuton-2.3.6 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.3.5 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.3.4 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.3.3 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.3.2 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.3.1 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.2.2 lib/teuton/case_manager/case/dsl/log.rb
teuton-2.1.11 lib/teuton/case_manager/case/dsl/log.rb