class Consul::Async::Debug
Toolbox for logs
Public Class Methods
level()
click to toggle source
# File lib/consul/async/debug.rb, line 5 def self.level @level || 2 end
level=(log_level)
click to toggle source
# File lib/consul/async/debug.rb, line 13 def self.level=(log_level) lvl = levels.index(log_level) raise "Log level #{log_level} unsupported, must be one of #{levels.inspect}" if lvl.nil? @level = lvl end
levels()
click to toggle source
# File lib/consul/async/debug.rb, line 9 def self.levels %w[none error info debug] end
print_debug(msg)
click to toggle source
# File lib/consul/async/debug.rb, line 36 def self.print_debug(msg) STDERR.print "[DEBG] #{msg}" if level > 2 end
print_info(msg)
click to toggle source
# File lib/consul/async/debug.rb, line 28 def self.print_info(msg) STDERR.print "[INFO] #{msg}" if level > 1 end
puts_debug(msg)
click to toggle source
# File lib/consul/async/debug.rb, line 32 def self.puts_debug(msg) warn "[DEBG] #{msg}" if level > 2 end
puts_error(msg)
click to toggle source
# File lib/consul/async/debug.rb, line 20 def self.puts_error(msg) warn "[ERROR] #{msg}" if level.positive? end
puts_info(msg)
click to toggle source
# File lib/consul/async/debug.rb, line 24 def self.puts_info(msg) warn "[INFO] #{msg}" if level > 1 end