module Envoy
Constants
- DEBUG
- ERROR
- FATAL
- INFO
- TRACE
- VERBOSITIES
- VERSION
- WARN
Public Class Methods
find_file(name)
click to toggle source
# File lib/envoy/utils.rb, line 33 def self.find_file (name) dirs = Dir.pwd.split("/") r = dirs.reduce([]) do |m, x| [[*m[0], x], *m] end.map do |p| p.join("/") + "/#{name}" end.each do |p| return p if File.exist?(p) end false end
log(level, text, io = STDERR)
click to toggle source
# File lib/envoy/utils.rb, line 20 def self.log (level, text, io = STDERR) return unless io level = Envoy.const_get(level.upcase) unless level.is_a?(Numeric) return unless level <= verbosity message = [ Time.now.strftime("%F %T"), VERBOSITIES[level], text ].compact.join(" ") io.puts message io.flush end
verbosity()
click to toggle source
# File lib/envoy/utils.rb, line 12 def self.verbosity @verbosity end
verbosity=(num)
click to toggle source
# File lib/envoy/utils.rb, line 16 def self.verbosity= (num) @verbosity = [0, [5, num].min].max end