'Enable logging of exceptions
Once called, any uncaught exceptions will be emitted with level
``ERROR`` by this logger, before being raised.
This can be disabled with ``disable_exception_logging``.'

def enable_exception_logging(self):

    try:
        ip = get_ipython()
    except NameError:
        ip = None
    if self.exception_logging_enabled():
        raise LoggingError('Exception    logging    has    already    been    enabled')
    if (ip is None):
        self._excepthook_orig = sys.excepthook
        sys.excepthook = self._excepthook
    else:
        def ipy_exc_handler(ipyshell, etype, evalue, tb, tb_offset=None):
            self._excepthook(etype, evalue, tb)
            ipyshell.showtraceback((etype, evalue, tb), tb_offset=tb_offset)
        ip.set_custom_exc((BaseException, _AstLogIPYExc), ipy_exc_handler)
        self._excepthook_orig = (lambda etype, evalue, tb: None)
