def as_string(level)
      io = StringIO.new
      out(io,level)
      io.string
    end
def as_string(level)
      io = StringIO.new
      out(io,level)
      io.string
    end
helper function to return the output as a string
 ie creates stringio, calls out and returns the string