mirror of https://github.com/Delgan/loguru.git
21 lines
414 B
Python
21 lines
414 B
Python
import sys
|
|
|
|
from loguru import logger
|
|
|
|
|
|
def test(diagnose, backtrace):
|
|
logger.remove()
|
|
logger.add(sys.stderr, format="", diagnose=diagnose, backtrace=backtrace, colorize=True)
|
|
|
|
try:
|
|
1 / 0
|
|
except ZeroDivisionError:
|
|
type_, value, _ = sys.exc_info()
|
|
logger.opt(exception=(type_, value, None)).error("")
|
|
|
|
|
|
test(False, False)
|
|
test(True, False)
|
|
test(False, True)
|
|
test(True, True)
|