xlog.py 732 B

1234567891011121314151617181920212223242526
  1. # update: 2022-4-19
  2. import logging
  3. import traceback
  4. LOG = logging.getLogger(__name__)
  5. # logging.basicConfig(format='%(levelname)s | %(asctime)s | %(module)s.%(funcName)s:%(lineno)s >>> %(message)s',
  6. # level=logging.DEBUG)
  7. logging.basicConfig(format=f"INFO: %(message)s", level=logging.INFO)
  8. def debug_log(tags, args, is_work=True, show_level=logging.INFO):
  9. """"""
  10. if not is_work:
  11. return
  12. elif type(args) == list:
  13. lines = f"{tags}:"
  14. for count, line in enumerate(args):
  15. lines += f"\n- {count + 1} - {line}"
  16. LOG.info(lines)
  17. elif type(args) == str:
  18. LOG.info(f"{tags} | {args}")
  19. def trace_log():
  20. """"""
  21. return traceback.format_exc()