forked from KimmyXYC/KeyboxChecker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (28 loc) · 866 Bytes
/
main.py
File metadata and controls
38 lines (28 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import asyncio
import os
import sys
from dotenv import load_dotenv
from loguru import logger
from app.controller import BotRunner
from app_conf import settings
load_dotenv()
# 移除默认的日志处理器
logger.remove()
# 添加标准输出
print("从配置文件中读取到的DEBUG为", settings.app.debug)
handler_id = logger.add(sys.stderr, level="INFO" if not settings.app.debug else "DEBUG")
# 添加文件写出
# Create logs directory if it doesn't exist
os.makedirs("logs", exist_ok=True)
logger.add(
sink="logs/bot.log", # Changed from "run.log"
format="{time} - {level} - {message}",
level="INFO",
rotation="100 MB",
enqueue=True,
)
logger.info("Log Is Secret, Please Don't Share It To Others")
async def main():
await asyncio.gather(BotRunner().run())
loop = asyncio.get_event_loop()
loop.run_until_complete(main())