LogUtil.py 384 B

1234567891011121314151617
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. from AnsjerPush.config import BASE_DIR
  4. class LogUtil:
  5. @staticmethod
  6. def write_log(file_path=None, log=''):
  7. if not file_path:
  8. file_path = '/'.join((BASE_DIR, 'static/test.log'))
  9. file = open(file_path, 'a+')
  10. file.write(log)
  11. file.write('\n')
  12. file.flush()
  13. file.close()