mirror of https://github.com/Delgan/loguru.git
27 lines
650 B
Python
27 lines
650 B
Python
import sys
|
|
|
|
import _init
|
|
from somelib import callme, divide
|
|
|
|
from loguru import logger
|
|
|
|
|
|
def test(*, backtrace, colorize, diagnose):
|
|
logger.remove()
|
|
logger.add(sys.stderr, format="", colorize=colorize, backtrace=backtrace, diagnose=diagnose)
|
|
|
|
def callback():
|
|
divide(1, 0)
|
|
|
|
try:
|
|
callme(callback)
|
|
except ZeroDivisionError:
|
|
logger.exception("")
|
|
|
|
|
|
test(backtrace=True, colorize=True, diagnose=True)
|
|
test(backtrace=False, colorize=True, diagnose=True)
|
|
test(backtrace=True, colorize=True, diagnose=False)
|
|
test(backtrace=False, colorize=True, diagnose=False)
|
|
test(backtrace=False, colorize=False, diagnose=False)
|