Class: Nicetest::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/nicetest/logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ Logger

Returns a new instance of Logger.



7
8
9
10
# File 'lib/nicetest/logger.rb', line 7

def initialize(io)
  @pastel = Cli::PASTEL
  @io = io
end

Instance Method Details

#debug(message) ⇒ Object



24
25
26
27
28
# File 'lib/nicetest/logger.rb', line 24

def debug(message)
  if ENV["NICETEST_DEBUG"] == "1"
    log("debug", message, color: :blue)
  end
end

#error(message) ⇒ Object



16
17
18
# File 'lib/nicetest/logger.rb', line 16

def error(message)
  log("error", message, color: :red)
end

#fatal!(message) ⇒ Object



30
31
32
33
# File 'lib/nicetest/logger.rb', line 30

def fatal!(message)
  error(message)
  exit(1)
end

#info(message) ⇒ Object



20
21
22
# File 'lib/nicetest/logger.rb', line 20

def info(message)
  log("info ", message, color: :cyan)
end

#warn(message) ⇒ Object



12
13
14
# File 'lib/nicetest/logger.rb', line 12

def warn(message)
  log("warn ", message, color: :yellow)
end