def __global_logging_exception_handler(exc_type, exc_value, exc_traceback):
 if (exc_type.__name__ == 'KeyboardInterrupt'):
  if is_mp_logging_listener_configured():
   shutdown_multiprocessing_logging_listener()
 else:
  logging.getLogger(__name__).error("An un-handled exception was caught by salt's global exception handler:\n{0}: {1}\n{2}".format(exc_type.__name__, exc_value, ''.join(traceback.format_exception(exc_type, exc_value, exc_traceback)).strip()))
  sys.__excepthook__(exc_type, exc_value, exc_traceback)

def __global_logging_exception_handler ( exc_type , exc_value , exc_traceback ) : if ( exc_type . __name__ == 'KeyboardInterrupt' ) : if is_mp_logging_listener_configured ( ) : shutdown_multiprocessing_logging_listener ( ) else : logging . getLogger ( __name__ ) . error ( "An un-handled exception was caught by salt's global exception handler:\n{0}: {1}\n{2}" . format ( exc_type . __name__ , exc_value , '' . join ( traceback . format_exception ( exc_type , exc_value , exc_traceback ) ) . strip ( ) ) ) sys . __excepthook__ ( exc_type , exc_value , exc_traceback )
this function will log all un-handled python exceptions .