mirror of
https://github.com/Nanaloveyuki/py-logiliteal.git
synced 2025-09-03 18:16:22 +00:00
✅ config
读取,写入,重置测试成功
This commit is contained in:
13
src/__init__.py
Normal file
13
src/__init__.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
"""
|
||||||
|
pliblog - 简易,现代化具有色彩的日志记录器 / Easy, Modern and colorful Logger
|
||||||
|
"""
|
||||||
|
# encoding = utf-8
|
||||||
|
# python 3.13.5
|
||||||
|
|
||||||
|
from .utils import get_config, set_config, reset_config
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"get_config",
|
||||||
|
"set_config",
|
||||||
|
"reset_config"
|
||||||
|
]
|
26
tests/t-configs.py
Normal file
26
tests/t-configs.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
project_root = Path(__file__).parent.parent
|
||||||
|
sys.path.append(str(project_root))
|
||||||
|
|
||||||
|
from src.utils.configs import get_config, set_config, reset_config
|
||||||
|
|
||||||
|
print(f"\n配置更换测试")
|
||||||
|
set_config("file_level", "DEBUG")
|
||||||
|
fl = get_config("file_level")
|
||||||
|
print(fl)
|
||||||
|
|
||||||
|
set_config("file_level", "INFO")
|
||||||
|
fl = get_config("file_level")
|
||||||
|
print(fl)
|
||||||
|
|
||||||
|
print(f"\n配置重置测试")
|
||||||
|
print(reset_config())
|
||||||
|
|
||||||
|
print(f"\n配置重置后测试")
|
||||||
|
fl = get_config("file_level")
|
||||||
|
print(fl)
|
||||||
|
|
||||||
|
print(f"\n未指定配置读取测试")
|
||||||
|
print(get_config())
|
Reference in New Issue
Block a user