Merge pull request #240 from light0926/master

feat: 增加bash脚本,增加logging配置文件示例
This commit is contained in:
Womsxd 2022-09-01 21:07:47 +08:00 committed by GitHub
commit f9ec3fa968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 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,45 @@
[loggers]
keys=root,AutoMihoyoBBS
[handlers]
keys=fileHandler,consoleHandler
[formatters]
keys=simpleFormatter
; 缺少root logger会报错
[logger_root]
level=DEBUG
handlers=fileHandler,consoleHandler
[logger_AutoMihoyoBBS]
level=WARNING
qualname=fileHandler,consoleHandler
handlers=fileHandler,consoleHandler
; console
[handler_consoleHandler]
class=StreamHandler
args=(sys.stdout,)
level=INFO
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;