You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 1 година
пре 1 година
пре 1 година
12345678910111213141516
  1. import logging
  2. import sys
  3. def _get_logger():
  4. log = logging.getLogger('log')
  5. log.setLevel(logging.INFO)
  6. console_handle = logging.StreamHandler(sys.stdout)
  7. console_handle.setFormatter(logging.Formatter('[%(levelname)s][%(asctime)s][%(filename)s:%(lineno)d] - %(message)s',
  8. datefmt='%Y-%m-%d %H:%M:%S'))
  9. log.addHandler(console_handle)
  10. return log
  11. # 日志句柄
  12. logger = _get_logger()