Skip to content

Commit

Permalink
feat: 增加bash脚本,增加logging配置文件示例
Browse files Browse the repository at this point in the history
  • Loading branch information
hinak0 committed Sep 1, 2022
1 parent f89729e commit 986706f
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,12 @@ dmypy.json
# 避免上传配置文件
config/*.json
config/*.yaml
config/*.ini

# push配置
config/push.ini
.DS_Store
yaml/

# 日志文件
*.log
44 changes: 44 additions & 0 deletions config/logging.ini.example
Original file line number Diff line number Diff line change
@@ -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(mailhost,fromaddr,toaddrs,subject,credentials = None,secure = None,timeout = 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 changes: 6 additions & 0 deletions start.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# 进入脚本所在目录
cd $(cd `dirname $0`;pwd)
# 随机延时$RANDOM值为1~32767
sleep $[$RANDOM%1200];
python ./main.py;

0 comments on commit 986706f

Please sign in to comment.