ErisPulse 1.0.14.dev1__tar.gz → 1.0.14.dev2__tar.gz
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.
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse/logger.py +29 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse.egg-info/PKG-INFO +1 -1
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/PKG-INFO +1 -1
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/pyproject.toml +1 -1
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse/__init__.py +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse/__main__.py +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse/db.py +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse/raiserr.py +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse/util.py +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse.egg-info/SOURCES.txt +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse.egg-info/dependency_links.txt +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse.egg-info/entry_points.txt +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse.egg-info/requires.txt +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/ErisPulse.egg-info/top_level.txt +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/README.md +0 -0
- {erispulse-1.0.14.dev1 → erispulse-1.0.14.dev2}/setup.cfg +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import inspect
|
|
3
3
|
import datetime
|
|
4
|
+
import functools
|
|
4
5
|
|
|
5
6
|
class Logger:
|
|
6
7
|
def __init__(self):
|
|
@@ -69,6 +70,34 @@ class Logger:
|
|
|
69
70
|
except Exception as e:
|
|
70
71
|
self._logger.error(f"无法保存日志到 {p}: {e}。")
|
|
71
72
|
raise e
|
|
73
|
+
|
|
74
|
+
def catch(self, func_or_level=None, level="error"):
|
|
75
|
+
if isinstance(func_or_level, str):
|
|
76
|
+
return lambda func: self.catch(func, level=func_or_level)
|
|
77
|
+
if func_or_level is None:
|
|
78
|
+
return lambda func: self.catch(func, level=level)
|
|
79
|
+
func = func_or_level
|
|
80
|
+
|
|
81
|
+
@functools.wraps(func)
|
|
82
|
+
def wrapper(*args, **kwargs):
|
|
83
|
+
try:
|
|
84
|
+
return func(*args, **kwargs)
|
|
85
|
+
except Exception as e:
|
|
86
|
+
import traceback
|
|
87
|
+
error_info = traceback.format_exc()
|
|
88
|
+
|
|
89
|
+
module_name = func.__module__
|
|
90
|
+
if module_name == "__main__":
|
|
91
|
+
module_name = "Main"
|
|
92
|
+
func_name = func.__name__
|
|
93
|
+
|
|
94
|
+
error_msg = f"Exception in {func_name}: {str(e)}\n{error_info}"
|
|
95
|
+
|
|
96
|
+
log_method = getattr(self, level, self.error)
|
|
97
|
+
log_method(error_msg)
|
|
98
|
+
|
|
99
|
+
return None
|
|
100
|
+
return wrapper
|
|
72
101
|
|
|
73
102
|
def _save_in_memory(self, ModuleName, msg):
|
|
74
103
|
if ModuleName not in self._logs:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ErisPulse
|
|
3
|
-
Version: 1.0.14.
|
|
3
|
+
Version: 1.0.14.dev2
|
|
4
4
|
Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
|
|
5
5
|
Author-email: "艾莉丝·格雷拉特(WSu2059)" <wsu2059@qq.com>, runoneall <runoobsteve@gmail.com>
|
|
6
6
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ErisPulse
|
|
3
|
-
Version: 1.0.14.
|
|
3
|
+
Version: 1.0.14.dev2
|
|
4
4
|
Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
|
|
5
5
|
Author-email: "艾莉丝·格雷拉特(WSu2059)" <wsu2059@qq.com>, runoneall <runoobsteve@gmail.com>
|
|
6
6
|
Classifier: Development Status :: 5 - Production/Stable
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|