We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3bba133 commit e0867cfCopy full SHA for e0867cf
main.py
@@ -1,6 +1,6 @@
1
# -*- coding: utf-8 -*-
2
3
-import logging
+import logging.handlers
4
import os
5
import re
6
import sys
@@ -25,7 +25,11 @@
25
26
logfile_dir_path = os.path.dirname(os.path.abspath(__file__))
27
logfile_abs_path = os.path.join(logfile_dir_path, "logs", "bot.log")
28
-logfile_handler = logging.FileHandler(logfile_abs_path, 'a', 'utf-8')
+
29
+if not os.path.exists(os.path.join(logfile_dir_path, "logs")):
30
+ os.makedirs(os.path.join(logfile_dir_path, "logs"))
31
32
+logfile_handler = logging.handlers.WatchedFileHandler(logfile_abs_path, 'a', 'utf-8')
33
34
logger = logging.getLogger(__name__)
35
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.DEBUG, handlers=[logfile_handler])
0 commit comments