feat: 增加bash脚本,增加logging配置文件示例

This commit is contained in:
hinak0 2022-09-01 20:32:57 +08:00
parent f89729e13f
commit 986706f497
3 changed files with 54 additions and 0 deletions

4
.gitignore vendored
View File

@ -137,8 +137,12 @@ dmypy.json
# 避免上传配置文件
config/*.json
config/*.yaml
config/*.ini
# push配置
config/push.ini
.DS_Store
yaml/
# 日志文件
*.log

View File

@ -0,0 +1,44 @@
[loggers]
keys=root,AutoMihoyoBBS
[handlers]
keys=fileHandler,consoleHandler
[formatters]
keys=simpleFormatter
; 缺少root logger会报错
[logger_root]
level=DEBUG
handlers=fileHandler,consoleHandler
[logger_AutoMihoyoBBS]
level=WARNING
handlers=fileHandler,consoleHandler
; console
[handler_consoleHandler]
class=StreamHandler
args=(sys.stdout,)
level=DEBUG
formatter=simpleFormatter
; file
[handler_fileHandler]
class=FileHandler
args=('logging.log', 'a')
level=DEBUG
formatter=simpleFormatter
; 由于官方的SMTPHandler似乎不支持ssl邮箱暂时不使用
; Email
; [handler_SMTPHandler]
; class=handlers.SMTPHandler
; ; logging.handlers.SMTPHandler(mailhostfromaddrtoaddrssubjectcredentials = Nonesecure = Nonetimeout = 1.0)
; args=()
; level=ERROR
; formatter=simpleFormatter
[formatter_simpleFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=%Y-%m-%dT%H:%M:%S

6
start.bash Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# 进入脚本所在目录
cd $(cd `dirname $0`;pwd)
# 随机延时$RANDOM值为1~32767
sleep $[$RANDOM%1200];
python ./main.py;