from base.goupibutong import Goupi from loguru import logger import time logger.add('huanbu.log', rotation='100 MB', level='DEBUG', compression='tar.gz', colorize=True, enqueue=True) logger.debug("That's it, beautiful and simple logging!") def logout(interval=0): butonghandler = Goupi() for i in range(1000000000): juzi = butonghandler.butong(10) logger.info(juzi) time.sleep(interval) def func(a, b): return a / b def nested(c): try: func(5, c) except Exception as e: logger.exception(e) # nested(0) if __name__ == '__main__': # logout() nested(0)