From dce393452b7d902736b875930f518e4bcc8a2e6d Mon Sep 17 00:00:00 2001 From: Nanaloveyuki Date: Sun, 27 Jul 2025 14:53:00 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20`config`=E8=AF=BB=E5=8F=96,?= =?UTF-8?q?=E5=86=99=E5=85=A5,=E9=87=8D=E7=BD=AE=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/__init__.py | 13 +++++++++++++ tests/t-configs.py | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/__init__.py create mode 100644 tests/t-configs.py diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..5d5d190 --- /dev/null +++ b/src/__init__.py @@ -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" +] \ No newline at end of file diff --git a/tests/t-configs.py b/tests/t-configs.py new file mode 100644 index 0000000..6cd90a5 --- /dev/null +++ b/tests/t-configs.py @@ -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()) \ No newline at end of file