log.py 368 B

1234567891011121314
  1. from pathlib import Path
  2. from loguru import logger
  3. _absolute = Path(__file__).absolute().parent.parent
  4. _access_log_path = (_absolute / 'logs/crawl-{time:YYYY-MM-DD}.log').resolve()
  5. logger.add(
  6. _access_log_path,
  7. format='{time:YYYY-MM-DD HH:mm:ss} - {level} - {message}',
  8. level='INFO',
  9. rotation='00:00',
  10. retention='1 week',
  11. encoding='utf-8',
  12. )