Skip to content

Commit c153c0b

Browse files
committed
- 删除废弃的功能
Signed-off-by: tinybees <[email protected]>
1 parent 4a40b1a commit c153c0b

File tree

4 files changed

+3
-43
lines changed

4 files changed

+3
-43
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#### Added
66
- 新增sanic日志格式以支持sanic的access日志输出
77
- 增加类型标注
8+
- 删除废弃的功能
89

910
###[1.0.6] - 2020-8-30
1011

aelog/aelog.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@
1212
import logging
1313
import os
1414
import traceback
15-
import warnings
1615
from concurrent.futures import ThreadPoolExecutor
1716
from functools import partial
18-
from logging import Logger
1917
from logging.config import dictConfig
2018
from typing import Tuple
2119

2220
from .consts import BACKUP_COUNT, MAX_BYTES
2321
from .log import aelog_config, aelog_default_config
2422

25-
__all__ = ("init_app", "get_logger", "debug", "info", "warning", "error", "critical", "exception",
26-
"async_debug", "async_info", "async_warning", "async_error", "async_exception", "async_critical")
23+
__all__ = ("init_app", "debug", "info", "warning", "error", "critical", "exception", "async_debug",
24+
"async_info", "async_warning", "async_error", "async_exception", "async_critical")
2725

2826
_pool = ThreadPoolExecutor()
2927

@@ -60,23 +58,6 @@ def init_app(app=None, *, aelog_access_file: str = None, aelog_error_file: str =
6058
aelog_conf = aelog_config(aelog_access_file, error_file=aelog_error_file, console=aelog_console,
6159
loglevel=loglevel, max_bytes=aelog_max_bytes, backup_count=aelog_backup_count)
6260
dictConfig(aelog_conf)
63-
setattr(init_app, "init_flag", True)
64-
65-
66-
def get_logger() -> Logger:
67-
"""
68-
get logger object, If the aelog has no initialize, call init_aelog() and output to the terminal.
69-
Args:
70-
71-
Returns:
72-
73-
"""
74-
warnings.warn("`get_logger` option is deprecated in version 1.0.5. Use `aelog` instead.",
75-
DeprecationWarning)
76-
if not getattr(init_app, "init_flag", None):
77-
init_app()
78-
caller_module = inspect.getmodule(inspect.currentframe().f_back) # type: ignore
79-
return logging.getLogger(caller_module.__name__ if caller_module else "")
8061

8162

8263
def find_caller(caller_frame, stack_info=False) -> Tuple:

tests/test_aelog.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,6 @@
1010
import aelog
1111

1212

13-
def test_get_logger():
14-
"""
15-
16-
Args:
17-
18-
Returns:
19-
20-
"""
21-
aelog.init_app(aelog_access_file="test.log", aelog_console=True)
22-
logger = aelog.get_logger()
23-
logger.debug("simple debug message")
24-
logger.info("simple info message")
25-
logger.warning("simple warning message")
26-
logger.error("simple error message")
27-
logger.critical("simple critical message")
28-
try:
29-
5 / 0
30-
except Exception as e:
31-
logger.exception(e)
32-
33-
3413
def test_aelog_output_console():
3514
"""
3615

tests/verify.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from tests import test_aelog
1313

1414
if __name__ == '__main__':
15-
test_aelog.test_get_logger()
1615
test_aelog.test_aelog_output_console()
1716
test_aelog.test_aelog_output_file()
1817
loop = asyncio.get_event_loop()

0 commit comments

Comments
 (0)