ErisPulse 1.0.2__zip → 1.0.3__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
+ import os
2
+ import sys
1
3
  from . import sdk
2
4
  from . import util
3
5
  from . import errors
@@ -10,8 +12,6 @@ setattr(sdk, "util", util)
10
12
 
11
13
  env.load_env_file()
12
14
 
13
- import os
14
-
15
15
  def init():
16
16
  try:
17
17
  sdkModulePath = os.path.join(os.path.dirname(__file__), "modules")
@@ -1,5 +1,6 @@
1
1
  import logging
2
2
  import inspect
3
+ from rich.logging import RichHandler
3
4
  from . import sdk
4
5
  from .envManager import env
5
6
 
@@ -10,33 +11,16 @@ if _log_level is None:
10
11
  _logger.setLevel(_log_level)
11
12
 
12
13
  if not _logger.handlers:
13
- log_format = (
14
- f"[%(asctime)s] "
15
- f"[%(levelname)s] "
16
- f"%(message)s"
14
+ # 自定义时间格式
15
+ console_handler = RichHandler(
16
+ show_time=True, # 显示时间
17
+ show_level=True, # 显示日志级别
18
+ show_path=False, # 不显示调用路径
19
+ markup=True, # 支持 Markdown
20
+ log_time_format="[%Y-%m-%d %H:%M:%S]", # 自定义时间格式
21
+ rich_tracebacks=True, # 支持更美观的异常堆栈
17
22
  )
18
- color_map = {
19
- "DEBUG": "\033[94m",
20
- "INFO": "\033[92m",
21
- "WARNING": "\033[93m",
22
- "ERROR": "\033[91m",
23
- "CRITICAL": "\033[95m",
24
- "RESET": "\033[0m",
25
- }
26
-
27
- class ColoredFormatter(logging.Formatter):
28
- def format(self, record):
29
- levelname = record.levelname
30
- if levelname in color_map:
31
- record.levelname = (
32
- f"{color_map[levelname]}{levelname}{color_map['RESET']}"
33
- )
34
- return super().format(record)
35
-
36
- console_handler = logging.StreamHandler()
37
- date_format = "%y/%m/%d-%H:%M:%S"
38
- formatter = ColoredFormatter(log_format, datefmt=date_format)
39
- console_handler.setFormatter(formatter)
23
+ console_handler.setFormatter(logging.Formatter("%(message)s"))
40
24
  _logger.addHandler(console_handler)
41
25
 
42
26
 
@@ -50,22 +34,27 @@ def _get_caller():
50
34
  module_name = module_name[:-5]
51
35
  return module_name
52
36
 
37
+
53
38
  def debug(msg, *args, **kwargs):
54
39
  caller_module = _get_caller()
55
40
  _logger.debug(f"[{caller_module}] {msg}", *args, **kwargs)
56
41
 
42
+
57
43
  def info(msg, *args, **kwargs):
58
44
  caller_module = _get_caller()
59
45
  _logger.info(f"[{caller_module}] {msg}", *args, **kwargs)
60
46
 
47
+
61
48
  def warning(msg, *args, **kwargs):
62
49
  caller_module = _get_caller()
63
50
  _logger.warning(f"[{caller_module}] {msg}", *args, **kwargs)
64
51
 
52
+
65
53
  def error(msg, *args, **kwargs):
66
54
  caller_module = _get_caller()
67
55
  _logger.error(f"[{caller_module}] {msg}", *args, **kwargs)
68
56
 
57
+
69
58
  def critical(msg, *args, **kwargs):
70
59
  caller_module = _get_caller()
71
60
  _logger.critical(f"[{caller_module}] {msg}", *args, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
5
5
  Home-page: https://github.com/wsu2059q/ErisPulse
6
6
  Author: 艾莉丝·格雷拉特(WSu2059)
@@ -20,6 +20,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
20
  Requires-Python: >=3.7
21
21
  Description-Content-Type: text/markdown
22
22
  Requires-Dist: aiohttp
23
+ Requires-Dist: rich
23
24
  Dynamic: author
24
25
  Dynamic: author-email
25
26
  Dynamic: classifier
@@ -33,9 +34,10 @@ Dynamic: requires-dist
33
34
  Dynamic: requires-python
34
35
  Dynamic: summary
35
36
 
36
- # ErisPulse
37
+ ### 版本更新小通知~
38
+ - 此版本(1.0.3)修复了部分命令行不支持logger颜色代码的问题 | 替换为rich
37
39
 
38
- v1.0.2此版本修复首次加载时因为模块目录不存在而报错的问题
40
+ # ErisPulse
39
41
 
40
42
  本项目基于 [RyhBotPythonSDK V2](https://github.com/runoneall/RyhBotPythonSDK2) 构建,并由 [sdkFrame](https://github.com/runoneall/sdkFrame) 提供支持。这是一个异步版本的 SDK,可能在功能和特性上与原库存在一定差异。
41
43
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
5
5
  Home-page: https://github.com/wsu2059q/ErisPulse
6
6
  Author: 艾莉丝·格雷拉特(WSu2059)
@@ -20,6 +20,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
20
  Requires-Python: >=3.7
21
21
  Description-Content-Type: text/markdown
22
22
  Requires-Dist: aiohttp
23
+ Requires-Dist: rich
23
24
  Dynamic: author
24
25
  Dynamic: author-email
25
26
  Dynamic: classifier
@@ -33,9 +34,10 @@ Dynamic: requires-dist
33
34
  Dynamic: requires-python
34
35
  Dynamic: summary
35
36
 
36
- # ErisPulse
37
+ ### 版本更新小通知~
38
+ - 此版本(1.0.3)修复了部分命令行不支持logger颜色代码的问题 | 替换为rich
37
39
 
38
- v1.0.2此版本修复首次加载时因为模块目录不存在而报错的问题
40
+ # ErisPulse
39
41
 
40
42
  本项目基于 [RyhBotPythonSDK V2](https://github.com/runoneall/RyhBotPythonSDK2) 构建,并由 [sdkFrame](https://github.com/runoneall/sdkFrame) 提供支持。这是一个异步版本的 SDK,可能在功能和特性上与原库存在一定差异。
41
43
 
@@ -1,6 +1,7 @@
1
- # ErisPulse
1
+ ### 版本更新小通知~
2
+ - 此版本(1.0.3)修复了部分命令行不支持logger颜色代码的问题 | 替换为rich
2
3
 
3
- v1.0.2此版本修复首次加载时因为模块目录不存在而报错的问题
4
+ # ErisPulse
4
5
 
5
6
  本项目基于 [RyhBotPythonSDK V2](https://github.com/runoneall/RyhBotPythonSDK2) 构建,并由 [sdkFrame](https://github.com/runoneall/sdkFrame) 提供支持。这是一个异步版本的 SDK,可能在功能和特性上与原库存在一定差异。
6
7
 
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='ErisPulse',
5
- version='1.0.2',
5
+ version='1.0.3',
6
6
  author='艾莉丝·格雷拉特(WSu2059)',
7
7
  author_email='wsu2059@qq.com',
8
8
  maintainer='runoneall',
@@ -12,7 +12,7 @@ setup(
12
12
  long_description_content_type='text/markdown',
13
13
  url='https://github.com/wsu2059q/ErisPulse',
14
14
  packages=find_packages(),
15
- install_requires=["aiohttp"],
15
+ install_requires=["aiohttp", "rich"],
16
16
  license='MIT',
17
17
  classifiers=[
18
18
  'Development Status :: 5 - Production/Stable',
File without changes
File without changes
File without changes
File without changes
File without changes