unitlog 0.0.7__tar.gz → 0.0.8__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.
- {unitlog-0.0.7/unitlog.egg-info → unitlog-0.0.8}/PKG-INFO +1 -1
- unitlog-0.0.8/unitlog/__init__.py +15 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/unitlog/unit.py +1 -37
- {unitlog-0.0.7 → unitlog-0.0.8/unitlog.egg-info}/PKG-INFO +1 -1
- unitlog-0.0.7/unitlog/__init__.py +0 -16
- {unitlog-0.0.7 → unitlog-0.0.8}/LICENSE +0 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/README.md +0 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/setup.cfg +0 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/setup.py +0 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/test/test_multi_logger.py +0 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/unitlog/handlers.py +0 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/unitlog/util_log.py +0 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/unitlog.egg-info/SOURCES.txt +0 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/unitlog.egg-info/dependency_links.txt +0 -0
- {unitlog-0.0.7 → unitlog-0.0.8}/unitlog.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
__version__ = "0.0.8"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
updates = """
|
|
5
|
+
### 版本说明
|
|
6
|
+
|
|
7
|
+
**✨ 核心亮点**
|
|
8
|
+
- **代码执行逻辑优化**:移除了之前依赖于 `__name__ == '__main__'` 的判断逻辑,以提高代码的灵活性和可维护性。现在,即使使用 `pyinstaller` 打包后,代码的执行逻辑也能保持一致性和稳定性。
|
|
9
|
+
|
|
10
|
+
**🚀 体验优化**
|
|
11
|
+
- **版本迭代更新**:我们对软件进行了两次版本迭代,从 0.0.5 更新至 0.0.7,以确保软件的稳定性和性能。
|
|
12
|
+
|
|
13
|
+
**🐛 问题修复**
|
|
14
|
+
- 由于本次更新中没有提到对老功能的修复,因此没有列出任何问题修复项。
|
|
15
|
+
"""
|
|
@@ -103,43 +103,6 @@ class UnitLog(object):
|
|
|
103
103
|
parent_logger_name=None,
|
|
104
104
|
force_all_console_log_to_file=False) -> logging.Logger:
|
|
105
105
|
|
|
106
|
-
caller_frame = inspect.currentframe().f_back
|
|
107
|
-
caller_module_name = caller_frame.f_globals.get('__name__')
|
|
108
|
-
caller_func_name = caller_frame.f_code.co_name
|
|
109
|
-
|
|
110
|
-
# ---------------------------------------------------------
|
|
111
|
-
# 规则 1: 严禁全局裸奔 (必须包在函数里)
|
|
112
|
-
# ---------------------------------------------------------
|
|
113
|
-
if caller_func_name == '<module>':
|
|
114
|
-
raise RuntimeError(
|
|
115
|
-
"⛔️ [禁止全局调用] 你必须把此函数放在一个 def 函数内部调用,\n"
|
|
116
|
-
"""
|
|
117
|
-
例如
|
|
118
|
-
def main():
|
|
119
|
-
register_logger()
|
|
120
|
-
|
|
121
|
-
if __name__ == '__main__':
|
|
122
|
-
main()
|
|
123
|
-
"""
|
|
124
|
-
"严禁在脚本顶层直接执行,否则会导致多进程 spawn 时的无限递归。"
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
# ---------------------------------------------------------
|
|
128
|
-
# 规则 2: 必须是 Main 入口,或者是 单元测试
|
|
129
|
-
# ---------------------------------------------------------
|
|
130
|
-
# 如果是直接运行脚本,name 是 __main__ -> 通过
|
|
131
|
-
# 如果是 unittest,name 是 文件名 -> 但 is_under_testing() 为真 -> 通过
|
|
132
|
-
# 如果是 spawn 子进程,name 是 文件名 -> 且不在测试栈中 -> 拦截
|
|
133
|
-
if caller_module_name != '__main__' and not is_under_testing():
|
|
134
|
-
raise RuntimeError(
|
|
135
|
-
f"⛔️ [禁止导入执行] 检测到当前模块名为 '{caller_module_name}'。\n"
|
|
136
|
-
"此函数只能在 'if __name__ == \"__main__\":' 入口下执行,\n"
|
|
137
|
-
"或者是通过单元测试(unittest/pytest)执行。\n"
|
|
138
|
-
"禁止在多进程 spawn 导入阶段或作为普通模块被 import 时执行。"
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
print(f"✅ 安全检查通过 (调用者: {caller_module_name}, 环境安全)")
|
|
142
|
-
|
|
143
106
|
if not self.started.is_set():
|
|
144
107
|
self.bus_queue = mp.Queue()
|
|
145
108
|
self.worker = mp.Process(target=self.listening_log_msg, args=(self.bus_queue, ), daemon=True)
|
|
@@ -295,5 +258,6 @@ def main():
|
|
|
295
258
|
|
|
296
259
|
|
|
297
260
|
|
|
261
|
+
|
|
298
262
|
if __name__ == "__main__":
|
|
299
263
|
main()
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.7"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
updates = """
|
|
5
|
-
### 版本说明
|
|
6
|
-
|
|
7
|
-
**✨ 核心亮点**
|
|
8
|
-
- **多进程支持**:我们引入了更加稳健的多进程支持,现在可以通过 spawn 方式来启动和管理多个进程,提升了应用的并行处理能力。
|
|
9
|
-
- **日志系统增强**:为了确保日志记录的可靠性,我们更新了日志系统,现在会自动确保日志路径目录的存在,避免了因目录问题导致的日志记录失败。
|
|
10
|
-
|
|
11
|
-
**🚀 体验优化**
|
|
12
|
-
- **系统稳定性提升**:通过对多进程支持的改进和日志系统的优化,我们增强了应用的稳定性和可靠性,为用户提供了更加流畅的体验。
|
|
13
|
-
|
|
14
|
-
**🐛 问题修复**
|
|
15
|
-
- *(本次更新没有涉及到老功能的修复,因此此部分留空)*
|
|
16
|
-
"""
|
|
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
|