sycommon-python-lib 0.1.25__py3-none-any.whl → 0.1.26__py3-none-any.whl
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.
- sycommon/logging/sql_logger.py +4 -4
- {sycommon_python_lib-0.1.25.dist-info → sycommon_python_lib-0.1.26.dist-info}/METADATA +1 -1
- {sycommon_python_lib-0.1.25.dist-info → sycommon_python_lib-0.1.26.dist-info}/RECORD +6 -6
- {sycommon_python_lib-0.1.25.dist-info → sycommon_python_lib-0.1.26.dist-info}/WHEEL +0 -0
- {sycommon_python_lib-0.1.25.dist-info → sycommon_python_lib-0.1.26.dist-info}/entry_points.txt +0 -0
- {sycommon_python_lib-0.1.25.dist-info → sycommon_python_lib-0.1.26.dist-info}/top_level.txt +0 -0
sycommon/logging/sql_logger.py
CHANGED
|
@@ -9,7 +9,7 @@ from decimal import Decimal
|
|
|
9
9
|
class SQLTraceLogger:
|
|
10
10
|
@staticmethod
|
|
11
11
|
def setup_sql_logging(engine: Engine):
|
|
12
|
-
"""为 SQLAlchemy
|
|
12
|
+
"""为 SQLAlchemy 引擎注册事件监听器"""
|
|
13
13
|
def serialize_params(params):
|
|
14
14
|
"""处理特殊类型参数的序列化"""
|
|
15
15
|
if isinstance(params, (list, tuple)):
|
|
@@ -42,9 +42,9 @@ class SQLTraceLogger:
|
|
|
42
42
|
"execution_time_ms": round(execution_time, 2),
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
SYLogger.info(f"SQL
|
|
45
|
+
SYLogger.info(f"SQL执行: {sql_log}")
|
|
46
46
|
except Exception as e:
|
|
47
|
-
SYLogger.error(f"SQL
|
|
47
|
+
SYLogger.error(f"SQL日志处理失败: {str(e)}")
|
|
48
48
|
|
|
49
49
|
# 监听 SQL 执行开始事件(记录开始时间到连接的 execution_options)
|
|
50
50
|
@event.listens_for(Engine, "before_cursor_execute")
|
|
@@ -56,4 +56,4 @@ class SQLTraceLogger:
|
|
|
56
56
|
# 这里会创建一个新的执行选项副本,避免修改不可变对象
|
|
57
57
|
conn = conn.execution_options(_start_time=time.time())
|
|
58
58
|
except Exception as e:
|
|
59
|
-
SYLogger.error(f"SQL
|
|
59
|
+
SYLogger.error(f"SQL开始时间记录失败: {str(e)}")
|
|
@@ -17,7 +17,7 @@ sycommon/health/ping.py,sha256=FTlnIKk5y1mPfS1ZGOeT5IM_2udF5aqVLubEtuBp18M,250
|
|
|
17
17
|
sycommon/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
sycommon/logging/kafka_log.py,sha256=3HjBg3WoDd3DmjtAlpyLcAVTKI-AHKrKlKmmPerq9tU,20751
|
|
19
19
|
sycommon/logging/logger_wrapper.py,sha256=TiHsrIIHiQMzXgXK12-0KIpU9GhwQJOoHslakzmq2zc,357
|
|
20
|
-
sycommon/logging/sql_logger.py,sha256=
|
|
20
|
+
sycommon/logging/sql_logger.py,sha256=fu-sDqEOM9ovoUo6NNu9EIj2tQSE4stcF1maTPTBS64,2505
|
|
21
21
|
sycommon/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
sycommon/middleware/context.py,sha256=_5ghpv4u_yAvjkgM-XDx8OnO-YI1XtntHrXsHJHZkwo,88
|
|
23
23
|
sycommon/middleware/cors.py,sha256=0B5d_ovD56wcH9TfktRs88Q09R9f8Xx5h5ALWYvE8Iw,600
|
|
@@ -48,8 +48,8 @@ sycommon/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
48
48
|
sycommon/tools/docs.py,sha256=OPj2ETheuWjXLyaXtaZPbwmJKfJaYXV5s4XMVAUNrms,1607
|
|
49
49
|
sycommon/tools/snowflake.py,sha256=DdEj3T5r5OEvikp3puxqmmmz6BrggxomoSlnsRFb5dM,1174
|
|
50
50
|
sycommon/tools/timing.py,sha256=OiiE7P07lRoMzX9kzb8sZU9cDb0zNnqIlY5pWqHcnkY,2064
|
|
51
|
-
sycommon_python_lib-0.1.
|
|
52
|
-
sycommon_python_lib-0.1.
|
|
53
|
-
sycommon_python_lib-0.1.
|
|
54
|
-
sycommon_python_lib-0.1.
|
|
55
|
-
sycommon_python_lib-0.1.
|
|
51
|
+
sycommon_python_lib-0.1.26.dist-info/METADATA,sha256=9dmi_waOOjJUIgDQipHgAs5ka-HBz3rXC00ZeMCitR8,7038
|
|
52
|
+
sycommon_python_lib-0.1.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
53
|
+
sycommon_python_lib-0.1.26.dist-info/entry_points.txt,sha256=q_h2nbvhhmdnsOUZEIwpuoDjaNfBF9XqppDEmQn9d_A,46
|
|
54
|
+
sycommon_python_lib-0.1.26.dist-info/top_level.txt,sha256=98CJ-cyM2WIKxLz-Pf0AitWLhJyrfXvyY8slwjTXNuc,17
|
|
55
|
+
sycommon_python_lib-0.1.26.dist-info/RECORD,,
|
|
File without changes
|
{sycommon_python_lib-0.1.25.dist-info → sycommon_python_lib-0.1.26.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|