inspec/lib/vulcano/log.rb

32 lines
558 B
Ruby
Raw Normal View History

2015-09-03 18:36:46 +00:00
# encoding: utf-8
# Copyright 2015 Dominik Richter. All rights reserved.
require 'rainbow/ext/string'
module Vulcano
class Log
2015-09-03 18:43:58 +00:00
def initialize(opts = {})
@quiet = opts[:quiet] || false
end
2015-09-03 18:43:58 +00:00
def show(msg)
puts msg unless @quiet
end
2015-09-03 18:43:58 +00:00
def info(msg)
2015-09-03 18:35:23 +00:00
show ' . '.color(:white) + msg
end
2015-09-03 18:43:58 +00:00
def error(msg)
2015-09-03 18:35:23 +00:00
show ' ✖ '.color(:red).bright + msg
end
2015-09-03 18:43:58 +00:00
def warn(msg)
2015-09-03 18:35:23 +00:00
show ' ! '.color(:yellow).bright + msg
end
2015-09-03 18:43:58 +00:00
def ok(msg)
2015-09-03 18:35:23 +00:00
show ' ✔ '.color(:green).bright + msg
end
end
2015-09-03 18:43:58 +00:00
end