module Utility

  attr_writer :verbose

  # attr reader for @verbose
  def verbose
    if @verbose
      @verbose
    else
      verbose_default = 0
    end
  end

  def vinfo(*args)
    cname = (self.class.to_s =~ /Goose/) ? "#{self.class} : " : ''
    $stderr.puts("Info    : #{cname}#{args}") if 2 <= self.verbose 
  end

  def vwarn(*args)
    cname = (self.class.to_s =~ /Goose/) ? "#{self.class} : " : ''
    $stderr.puts("Warning : #{cname}#{args}") if 1 <= self.verbose
  end

  def vputs(lv, *args)
    $stderr.puts args if lv <= self.verbose 
  end

  def vprintf(lv, *args)
    $stderr.printf args if lv <= self.verbose 
  end

end # Utility
