Skip to content

Commit f9479d8

Browse files
committed
- 增加从app中直接读取log level的功能
- 更改readme文件 Signed-off-by: tinybees <[email protected]>
1 parent f5db98c commit f9479d8

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

CHANGES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
## Aelog Changelog
22

3-
###[1.0.7] - 2020-9-27
3+
###[1.0.8] - 2020-9-27
44

55
#### Added
66
- 新增sanic日志格式以支持sanic的access日志输出
77
- 增加类型标注
88
- 删除废弃的功能
9+
- 增加从app中直接读取log level的功能
10+
- 更改readme文件
911

1012
###[1.0.6] - 2020-8-30
1113

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ List of configuration keys that the aelog extension recognizes:
3636
| AELOG_ACCESS_FILE | Access file path, default None. |
3737
| AELOG_ERROR_FILE | Error file path, default None. |
3838
| AELOG_CONSOLE | Whether it is output at the terminal, default false. |
39+
| AELOG_LEVEL | log level, default 'DEBUG'. |
3940
| AELOG_MAX_BYTES | Log file size, default 50M. |
4041
| AELOG_BACKUP_COUNT | Rotating file count, default 5.|
4142

aelog/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
from .log import *
1212

1313

14-
__version__ = "1.0.7"
14+
__version__ = "1.0.8"

aelog/aelog.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
def init_app(app=None, *, aelog_access_file: str = None, aelog_error_file: str = None,
30-
aelog_console: bool = True, loglevel: str = "DEBUG",
30+
aelog_console: bool = True, aelog_level: str = "DEBUG",
3131
aelog_max_bytes: int = MAX_BYTES, aelog_backup_count: int = BACKUP_COUNT):
3232
"""
3333
init global logging
@@ -38,7 +38,7 @@ def init_app(app=None, *, aelog_access_file: str = None, aelog_error_file: str =
3838
app: app 应用
3939
aelog_access_file: access log full file
4040
aelog_error_file: error log full file
41-
loglevel: log level, default debug
41+
aelog_level: log level, default debug
4242
aelog_console: terminal output log
4343
aelog_max_bytes: log file max bytes
4444
aelog_backup_count: backup count
@@ -49,14 +49,15 @@ def init_app(app=None, *, aelog_access_file: str = None, aelog_error_file: str =
4949
aelog_access_file = app.config.get("AELOG_ACCESS_FILE", None) or aelog_access_file
5050
aelog_error_file = app.config.get("AELOG_ERROR_FILE", None) or aelog_error_file
5151
aelog_console = app.config.get("AELOG_CONSOLE", None) or aelog_console
52+
aelog_level = app.config.get("AELOG_LEVEL", None) or aelog_level
5253
aelog_max_bytes = app.config.get("AELOG_MAX_BYTES", None) or aelog_max_bytes
5354
aelog_backup_count = app.config.get("AELOG_BACKUP_COUNT", None) or aelog_backup_count
5455

5556
if aelog_access_file is None:
56-
aelog_conf = aelog_default_config(loglevel=loglevel)
57+
aelog_conf = aelog_default_config(loglevel=aelog_level)
5758
else:
5859
aelog_conf = aelog_config(aelog_access_file, error_file=aelog_error_file, console=aelog_console,
59-
loglevel=loglevel, max_bytes=aelog_max_bytes, backup_count=aelog_backup_count)
60+
loglevel=aelog_level, max_bytes=aelog_max_bytes, backup_count=aelog_backup_count)
6061
dictConfig(aelog_conf)
6162

6263

0 commit comments

Comments
 (0)