Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update log.py #8

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "hatchling.build"

[project]
name = "swankit"
version = "0.1.0b1"
version = "0.1.0b2"
dynamic = ["readme"]
description = "Base toolkit for SwanLab"
license = "Apache-2.0"
Expand Down
8 changes: 4 additions & 4 deletions swankit/log/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __init__(self, name=__name__.lower(), level: Levels = "info"):
super().__init__()
self.prefix = name + ':'
self.__logger = logging.getLogger(name)
self.__original_level = self.__get_level(level)
self.__original_level = self.get_level(level)
self.__installed = False
self.__logger.setLevel(self.__original_level)
# 初始化控制台日志处理器,输出到标准输出流
Expand Down Expand Up @@ -153,10 +153,10 @@ def set_level(self, level: Levels):

:raises: KeyError: If an invalid level is passed.
"""
self.__logger.setLevel(self.__get_level(level))
self.__logger.setLevel(self.get_level(level))

def __get_level(self, level: Levels):
"""私有属性,获取等级对应的 logging 对象
def get_level(self, level: Levels) -> int:
"""获取等级字符串对应的等级值,用于比较日志等级

Parameters
----------
Expand Down