def log_fault (exc, message = "", level = logging.CRITICAL,
               traceback = False):
  """Print the usual traceback information, followed by a listing of all
  the local variables in each frame.
  """
  tb = sys.exc_info ()[2]
  stack = _get_stack (tb)
  LOG.log (level,
           "FAULT: %s%s(%s): %s", ("%s -- " % message) if message else "",
           tb.tb_frame.f_code.co_filename,
           tb.tb_lineno,
           repr (exc))
  if traceback or LOG.isEnabledFor (logging.DEBUG):
    for line in _generate_stackdump (stack):
      LOG.debug (line)