loguru/tests/exceptions/source/diagnose/global_variable.py

22 lines
296 B
Python

import sys
from loguru import logger
logger.remove()
logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True)
foo = True
bar = False
def func():
foo = None
return 1 / 0 + foo + bar + False
try:
func()
except ZeroDivisionError:
logger.exception("")