Stdlib Compatibility¶
XTraceback works as a drop-in replacement for the standard library’s traceback module and can patch logging.LogFormatter.formatException()
XTraceback should be installed as early as possible in your code, or alternatively in a site sitecustomize module.
traceback¶
>>> import xtraceback
>>> xtraceback.compat.install()
This installs xtraceback.StdlibCompat.print_exception() as a sys.excepthook and patches the traceback module replacing the following functions with extended versions from xtraceback.StdlibCompat:
logging¶
>>> import logging
>>> import xtraceback
>>> logging.basicConfig()
>>> xtraceback.compat.install_logging(logging.root.handlers[0])