Sha256: 5f639ac4d059df9d1f7b54fa15cb97f19749cee2122d96b41db1efa28503fc5d

Contents?: true

Size: 536 Bytes

Versions: 8

Compression:

Stored size: 536 Bytes

Contents

require "rainbow"

module DSL
  ##
  # Record log message
  # @param text (String)
  # @param type (Symbol) Values :info, :warn or :error
  def log(text = "", type = :info)
    s = " INFO"
    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})
    msg = "[#{f}] #{s}: #{text}"
    msg = "[#{f}] #{text}" if s == ""
    @report.lines << msg
  end
  alias_method :msg, :log
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
teuton-2.9.2 lib/teuton/case/dsl/log.rb
teuton-2.9.1 lib/teuton/case/dsl/log.rb
teuton-2.9.0 lib/teuton/case/dsl/log.rb
teuton-2.8.0 lib/teuton/case/dsl/log.rb
teuton-2.7.3 lib/teuton/case/dsl/log.rb
teuton-2.7.2 lib/teuton/case/dsl/log.rb
teuton-2.7.1 lib/teuton/case/dsl/log.rb
teuton-2.7.0 lib/teuton/case/dsl/log.rb