mermaid-trace 0.4.0__tar.gz → 0.4.1__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.
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/PKG-INFO +23 -8
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/README.md +22 -7
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/README_CN.md +33 -7
- mermaid_trace-0.4.1/docs/en/API.md +157 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/en/CHANGELOG.md +16 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/en/USER_GUIDE.md +13 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/API.md +82 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/CHANGELOG.md +16 -0
- mermaid_trace-0.4.1/docs/zh/UPDATE_SUMMARY.md +99 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/USER_GUIDE.md +13 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/code_comments/src/mermaid_trace/__init__.md +1 -1
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/code_comments/src/mermaid_trace/core/context.md +7 -4
- mermaid_trace-0.4.1/docs/zh/code_comments/src/mermaid_trace/core/events.md +158 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/code_comments/src/mermaid_trace/core/formatter.md +69 -31
- mermaid_trace-0.4.1/docs/zh/code_comments/src/mermaid_trace/core/image/context/1769443810901.png +0 -0
- mermaid_trace-0.4.1/docs/zh/code_comments/src/mermaid_trace/core/image/context/1769443817389.png +0 -0
- mermaid_trace-0.4.1/docs/zh/code_comments/src/mermaid_trace/core/image/context/1769443818915.png +0 -0
- mermaid_trace-0.4.1/docs/zh/code_comments/src/mermaid_trace/core/image/context/1769443830665.png +0 -0
- mermaid_trace-0.4.1/docs/zh/code_comments/src/mermaid_trace/core/image/context/1769443835553.png +0 -0
- mermaid_trace-0.4.1/docs/zh/code_comments/src/mermaid_trace/handlers/async_handler.md +124 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/code_comments/src/mermaid_trace/handlers/mermaid_handler.md +28 -19
- mermaid_trace-0.4.1/flow.mmd +33 -0
- mermaid_trace-0.4.1/image/README_CN/1769402097355.png +0 -0
- mermaid_trace-0.4.1/improvement_plan.md +253 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/src/mermaid_trace/__init__.py +4 -2
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/src/mermaid_trace/cli.py +88 -46
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/src/mermaid_trace/core/context.py +83 -23
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/src/mermaid_trace/core/decorators.py +112 -22
- mermaid_trace-0.4.1/src/mermaid_trace/core/events.py +190 -0
- mermaid_trace-0.4.1/src/mermaid_trace/core/formatter.py +151 -0
- mermaid_trace-0.4.1/src/mermaid_trace/handlers/async_handler.py +105 -0
- mermaid_trace-0.4.1/src/mermaid_trace/handlers/mermaid_handler.py +119 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/src/mermaid_trace/integrations/fastapi.py +54 -33
- mermaid_trace-0.4.1/tests/core/test_context_extra.py +32 -0
- mermaid_trace-0.4.1/tests/core/test_decorators_extra.py +86 -0
- mermaid_trace-0.4.1/tests/core/test_events.py +71 -0
- mermaid_trace-0.4.1/tests/core/test_formatter_extra.py +130 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/integrations/test_integration_fastapi.py +36 -22
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/scenarios/test_concurrency.py +21 -14
- mermaid_trace-0.4.0/docs/en/API.md +0 -75
- mermaid_trace-0.4.0/docs/zh/code_comments/src/mermaid_trace/core/events.md +0 -96
- mermaid_trace-0.4.0/docs/zh/code_comments/src/mermaid_trace/handlers/async_handler.md +0 -69
- mermaid_trace-0.4.0/flow.mmd +0 -15
- mermaid_trace-0.4.0/src/mermaid_trace/core/events.py +0 -77
- mermaid_trace-0.4.0/src/mermaid_trace/core/formatter.py +0 -81
- mermaid_trace-0.4.0/src/mermaid_trace/handlers/async_handler.py +0 -52
- mermaid_trace-0.4.0/src/mermaid_trace/handlers/mermaid_handler.py +0 -99
- mermaid_trace-0.4.0/tests/core/test_events.py +0 -28
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/.github/workflows/ci.yml +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/.github/workflows/release.yml +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/.gitignore +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/LICENSE +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/SECURITY.md +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/en/CONTRIBUTING.md +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/en/LICENSE +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/CONTRIBUTING.md +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/LICENSE +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/code_comments/src/mermaid_trace/cli.md +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/code_comments/src/mermaid_trace/core/decorators.md +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/code_comments/src/mermaid_trace/integrations/fastapi.md +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/examples/concurrency_demo.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/examples/demo.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/examples/error_handling_demo.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/examples/nested_demo.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/pyproject.toml +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/src/mermaid_trace/core/__init__.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/src/mermaid_trace/py.typed +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/__init__.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/conftest.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/core/__init__.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/core/test_cli.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/core/test_context.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/core/test_formatter.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/handlers/test_handlers.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/integrations/test_integration_decorators.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/scenarios/test_basic_flow.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/scenarios/test_edge_cases.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tests/scenarios/test_performance.py +0 -0
- {mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mermaid-trace
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Visualize your Python code execution flow as Mermaid Sequence Diagrams.
|
|
5
5
|
Project-URL: Documentation, https://github.com/xt765/mermaid-trace#readme
|
|
6
6
|
Project-URL: Changelog, https://github.com/xt765/mermaid-trace/blob/main/docs/en/CHANGELOG.md
|
|
@@ -63,17 +63,31 @@ Description-Content-Type: text/markdown
|
|
|
63
63
|
|
|
64
64
|
# MermaidTrace: The Python Logger That Draws Diagrams
|
|
65
65
|
|
|
66
|
-
[
|
|
67
|
-
|
|
66
|
+
🌐 **Language**: [English](README.md) | [中文](README_CN.md)
|
|
67
|
+
|
|
68
|
+
[](https://pypi.org/project/mermaid-trace/)
|
|
69
|
+
[](https://pypi.org/project/mermaid-trace/)
|
|
68
70
|
[](LICENSE)
|
|
69
71
|
[](https://github.com/xt765/mermaid-trace/actions/workflows/ci.yml)
|
|
70
72
|
[](https://codecov.io/gh/xt765/mermaid-trace)
|
|
71
73
|
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 📋 Overview
|
|
77
|
+
|
|
72
78
|
**Stop reading logs. Start watching them.**
|
|
73
79
|
|
|
74
80
|
MermaidTrace is a specialized logging tool that automatically generates [Mermaid JS](https://mermaid.js.org/) sequence diagrams from your code execution. It's perfect for visualizing complex business logic, microservice interactions, or asynchronous flows.
|
|
75
81
|
|
|
76
|
-
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📚 Documentation
|
|
85
|
+
|
|
86
|
+
[User Guide](docs/en/USER_GUIDE.md) · [API Reference](docs/en/API.md) · [Contributing Guidelines](docs/en/CONTRIBUTING.md) · [Changelog](docs/en/CHANGELOG.md) · [License](docs/en/LICENSE)
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## ✨ Key Features
|
|
77
91
|
|
|
78
92
|
- **Decorator-Driven**: Just add `@trace` or `@trace_interaction` to your functions.
|
|
79
93
|
- **Auto-Diagramming**: Generates `.mmd` files that can be viewed in VS Code, GitHub, or Mermaid Live Editor.
|
|
@@ -82,6 +96,8 @@ MermaidTrace is a specialized logging tool that automatically generates [Mermaid
|
|
|
82
96
|
- **FastAPI Integration**: Includes middleware for zero-config HTTP request tracing.
|
|
83
97
|
- **CLI Tool**: Built-in viewer to preview diagrams in your browser.
|
|
84
98
|
|
|
99
|
+
---
|
|
100
|
+
|
|
85
101
|
## 🚀 Quick Start
|
|
86
102
|
|
|
87
103
|
### Installation
|
|
@@ -151,15 +167,14 @@ Visualize your generated `.mmd` files instantly:
|
|
|
151
167
|
mermaid-trace serve my_flow.mmd
|
|
152
168
|
```
|
|
153
169
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
- [English Documentation](docs/en/USER_GUIDE.md)
|
|
157
|
-
- [中文文档](README_CN.md)
|
|
170
|
+
---
|
|
158
171
|
|
|
159
172
|
## 🤝 Contributing
|
|
160
173
|
|
|
161
174
|
We welcome contributions! Please see [CONTRIBUTING.md](docs/en/CONTRIBUTING.md) for details.
|
|
162
175
|
|
|
176
|
+
---
|
|
177
|
+
|
|
163
178
|
## 📄 License
|
|
164
179
|
|
|
165
180
|
MIT
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
# MermaidTrace: The Python Logger That Draws Diagrams
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
|
|
3
|
+
🌐 **Language**: [English](README.md) | [中文](README_CN.md)
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/mermaid-trace/)
|
|
6
|
+
[](https://pypi.org/project/mermaid-trace/)
|
|
5
7
|
[](LICENSE)
|
|
6
8
|
[](https://github.com/xt765/mermaid-trace/actions/workflows/ci.yml)
|
|
7
9
|
[](https://codecov.io/gh/xt765/mermaid-trace)
|
|
8
10
|
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 📋 Overview
|
|
14
|
+
|
|
9
15
|
**Stop reading logs. Start watching them.**
|
|
10
16
|
|
|
11
17
|
MermaidTrace is a specialized logging tool that automatically generates [Mermaid JS](https://mermaid.js.org/) sequence diagrams from your code execution. It's perfect for visualizing complex business logic, microservice interactions, or asynchronous flows.
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📚 Documentation
|
|
22
|
+
|
|
23
|
+
[User Guide](docs/en/USER_GUIDE.md) · [API Reference](docs/en/API.md) · [Contributing Guidelines](docs/en/CONTRIBUTING.md) · [Changelog](docs/en/CHANGELOG.md) · [License](docs/en/LICENSE)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## ✨ Key Features
|
|
14
28
|
|
|
15
29
|
- **Decorator-Driven**: Just add `@trace` or `@trace_interaction` to your functions.
|
|
16
30
|
- **Auto-Diagramming**: Generates `.mmd` files that can be viewed in VS Code, GitHub, or Mermaid Live Editor.
|
|
@@ -19,6 +33,8 @@ MermaidTrace is a specialized logging tool that automatically generates [Mermaid
|
|
|
19
33
|
- **FastAPI Integration**: Includes middleware for zero-config HTTP request tracing.
|
|
20
34
|
- **CLI Tool**: Built-in viewer to preview diagrams in your browser.
|
|
21
35
|
|
|
36
|
+
---
|
|
37
|
+
|
|
22
38
|
## 🚀 Quick Start
|
|
23
39
|
|
|
24
40
|
### Installation
|
|
@@ -88,15 +104,14 @@ Visualize your generated `.mmd` files instantly:
|
|
|
88
104
|
mermaid-trace serve my_flow.mmd
|
|
89
105
|
```
|
|
90
106
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- [English Documentation](docs/en/USER_GUIDE.md)
|
|
94
|
-
- [中文文档](README_CN.md)
|
|
107
|
+
---
|
|
95
108
|
|
|
96
109
|
## 🤝 Contributing
|
|
97
110
|
|
|
98
111
|
We welcome contributions! Please see [CONTRIBUTING.md](docs/en/CONTRIBUTING.md) for details.
|
|
99
112
|
|
|
113
|
+
---
|
|
114
|
+
|
|
100
115
|
## 📄 License
|
|
101
116
|
|
|
102
117
|
MIT
|
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
# MermaidTrace: 能画图的 Python 日志工具
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
|
|
3
|
+
🌐 **语言**: [English](README.md) | [中文](README_CN.md)
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/mermaid-trace/)
|
|
6
|
+
[](https://pypi.org/project/mermaid-trace/)
|
|
5
7
|
[](LICENSE)
|
|
6
8
|
[](https://github.com/xt765/mermaid-trace/actions/workflows/ci.yml)
|
|
7
9
|
[](https://codecov.io/gh/xt765/mermaid-trace)
|
|
8
10
|
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 📋 概述
|
|
14
|
+
|
|
9
15
|
**别再干读日志了。开始“看”懂它们吧。**
|
|
10
16
|
|
|
11
17
|
MermaidTrace 是一个专业的日志工具,能从你的代码执行中自动生成 [Mermaid JS](https://mermaid.js.org/) 时序图。它非常适合可视化复杂的业务逻辑、微服务交互或异步流程。
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📚 文档
|
|
22
|
+
|
|
23
|
+
### 主要文档
|
|
24
|
+
|
|
25
|
+
[用户指南](docs/zh/USER_GUIDE.md) · [API 参考](docs/zh/API.md) · [贡献指南](docs/zh/CONTRIBUTING.md) · [更新日志](docs/zh/CHANGELOG.md) · [许可证](docs/zh/LICENSE)
|
|
26
|
+
|
|
27
|
+
### 代码注释文档
|
|
28
|
+
|
|
29
|
+
| 类别 | 链接 |
|
|
30
|
+
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| **核心模块** | [Context](docs/zh/code_comments/src/mermaid_trace/core/context.md) · [Decorators](docs/zh/code_comments/src/mermaid_trace/core/decorators.md) · [Events](docs/zh/code_comments/src/mermaid_trace/core/events.md) · [Formatter](docs/zh/code_comments/src/mermaid_trace/core/formatter.md) |
|
|
32
|
+
| **处理器** | [Async Handler](docs/zh/code_comments/src/mermaid_trace/handlers/async_handler.md) · [Mermaid Handler](docs/zh/code_comments/src/mermaid_trace/handlers/mermaid_handler.md) |
|
|
33
|
+
| **集成** | [FastAPI](docs/zh/code_comments/src/mermaid_trace/integrations/fastapi.md) |
|
|
34
|
+
| **其他** | [init](docs/zh/code_comments/src/mermaid_trace/__init__.md) · [CLI](docs/zh/code_comments/src/mermaid_trace/cli.md) |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## ✨ 核心特性
|
|
14
39
|
|
|
15
40
|
- **装饰器驱动**:只需在函数上添加 `@trace` 或 `@trace_interaction` 即可。
|
|
16
41
|
- **自动绘图**:生成 `.mmd` 文件,可在 VS Code、GitHub 或 Mermaid Live Editor 中查看。
|
|
@@ -19,6 +44,8 @@ MermaidTrace 是一个专业的日志工具,能从你的代码执行中自动
|
|
|
19
44
|
- **FastAPI 集成**:内置中间件,实现零配置的 HTTP 请求追踪。
|
|
20
45
|
- **CLI 工具**:内置查看器,可在浏览器中即时预览图表。
|
|
21
46
|
|
|
47
|
+
---
|
|
48
|
+
|
|
22
49
|
## 🚀 快速开始
|
|
23
50
|
|
|
24
51
|
### 安装
|
|
@@ -88,15 +115,14 @@ async def root():
|
|
|
88
115
|
mermaid-trace serve my_flow.mmd
|
|
89
116
|
```
|
|
90
117
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- [英文文档](docs/en/USER_GUIDE.md)
|
|
94
|
-
- [中文文档](docs/zh/USER_GUIDE.md)
|
|
118
|
+
---
|
|
95
119
|
|
|
96
120
|
## 🤝 贡献
|
|
97
121
|
|
|
98
122
|
欢迎贡献!详情请参阅 [CONTRIBUTING.md](docs/zh/CONTRIBUTING.md)。
|
|
99
123
|
|
|
124
|
+
---
|
|
125
|
+
|
|
100
126
|
## 📄 许可证
|
|
101
127
|
|
|
102
128
|
MIT
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Core](#core)
|
|
6
|
+
- [trace / trace_interaction](#trace--trace_interaction)
|
|
7
|
+
- [configure_flow](#configure_flow)
|
|
8
|
+
- [LogContext](#logcontext)
|
|
9
|
+
- [Event (Abstract Base Class)](#event-abstract-base-class)
|
|
10
|
+
- [FlowEvent](#flowevent)
|
|
11
|
+
- [BaseFormatter (Abstract Base Class)](#baseformatter-abstract-base-class)
|
|
12
|
+
- [MermaidFormatter](#mermaidformatter)
|
|
13
|
+
- [MermaidFileHandler](#mermaidfilehandler)
|
|
14
|
+
- [AsyncMermaidHandler](#asyncmermaidhandler)
|
|
15
|
+
- [Integrations](#integrations)
|
|
16
|
+
- [MermaidTraceMiddleware (FastAPI)](#mermaidtracemiddleware-fastapi)
|
|
17
|
+
|
|
18
|
+
## Core
|
|
19
|
+
|
|
20
|
+
### `trace` / `trace_interaction`
|
|
21
|
+
|
|
22
|
+
Decorator to trace function execution. Can be used with or without arguments.
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
# Simple usage
|
|
26
|
+
@trace
|
|
27
|
+
def my_func(): ...
|
|
28
|
+
|
|
29
|
+
# Detailed usage
|
|
30
|
+
@trace(source="Client", target="Server", action="Login", capture_args=False)
|
|
31
|
+
def login(username): ...
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Arguments:**
|
|
35
|
+
- `source` (Optional[str]): The caller participant name. If `None`, inferred from `contextvars`.
|
|
36
|
+
- `target` (Optional[str]): The callee participant name. If `None`, inferred from class name (if method) or module name.
|
|
37
|
+
- `name` (Optional[str]): Alias for `target`. Explicitly sets the participant name.
|
|
38
|
+
- `action` (Optional[str]): Description of the interaction. If `None`, defaults to formatted function name (e.g., `process_payment` -> "Process Payment").
|
|
39
|
+
- `capture_args` (bool): Whether to log arguments and return values. Defaults to `True`. Set to `False` for sensitive data.
|
|
40
|
+
- `max_arg_length` (int): Maximum length of string representation for arguments. Defaults to 50.
|
|
41
|
+
- `max_arg_depth` (int): Maximum depth for nested structures in argument representation. Defaults to 1.
|
|
42
|
+
|
|
43
|
+
### `configure_flow`
|
|
44
|
+
|
|
45
|
+
Configures the global logger to output to a Mermaid file. This should be called once at application startup.
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
def configure_flow(
|
|
49
|
+
output_file: str = "flow.mmd",
|
|
50
|
+
handlers: Optional[List[logging.Handler]] = None,
|
|
51
|
+
append: bool = False,
|
|
52
|
+
async_mode: bool = False
|
|
53
|
+
) -> logging.Logger
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Arguments:**
|
|
57
|
+
- `output_file` (str): Path to the `.mmd` output file. Defaults to "flow.mmd".
|
|
58
|
+
- `handlers` (List[logging.Handler]): Optional list of custom logging handlers. If provided, `output_file` is ignored unless you include `MermaidFileHandler` manually.
|
|
59
|
+
- `append` (bool): If `True`, adds new handlers without removing existing ones. Defaults to `False`.
|
|
60
|
+
- `async_mode` (bool): If `True`, uses a non-blocking background thread for logging (QueueHandler). Recommended for production. Defaults to `False`.
|
|
61
|
+
|
|
62
|
+
### `LogContext`
|
|
63
|
+
|
|
64
|
+
Manages execution context (like thread-local storage) to track caller/callee relationships and trace IDs across async tasks and threads.
|
|
65
|
+
|
|
66
|
+
**Methods:**
|
|
67
|
+
- `LogContext.current_trace_id() -> str`: Get or generate the current Trace ID.
|
|
68
|
+
- `LogContext.current_participant() -> str`: Get the current active participant.
|
|
69
|
+
- `LogContext.scope(data)`: Synchronous context manager to temporarily update context.
|
|
70
|
+
- `LogContext.ascope(data)`: Asynchronous context manager (`async with`) to temporarily update context.
|
|
71
|
+
|
|
72
|
+
### `Event` (Abstract Base Class)
|
|
73
|
+
|
|
74
|
+
Abstract base class for all event types, providing a common interface for different types of events.
|
|
75
|
+
|
|
76
|
+
**Methods:**
|
|
77
|
+
- `get_source() -> str`: Get the source of the event.
|
|
78
|
+
- `get_target() -> str`: Get the target of the event.
|
|
79
|
+
- `get_action() -> str`: Get the action name of the event.
|
|
80
|
+
- `get_message() -> str`: Get the message text of the event.
|
|
81
|
+
- `get_timestamp() -> float`: Get the timestamp of the event.
|
|
82
|
+
- `get_trace_id() -> str`: Get the trace ID of the event.
|
|
83
|
+
|
|
84
|
+
### `FlowEvent`
|
|
85
|
+
|
|
86
|
+
Represents a single interaction or step in the execution flow, inheriting from `Event`.
|
|
87
|
+
|
|
88
|
+
**Attributes:**
|
|
89
|
+
- `source` (str): The name of the participant initiating the action.
|
|
90
|
+
- `target` (str): The name of the participant receiving the action.
|
|
91
|
+
- `action` (str): A short, human-readable name for the operation.
|
|
92
|
+
- `message` (str): The actual text label displayed on the diagram arrow.
|
|
93
|
+
- `trace_id` (str): Unique identifier for the trace session.
|
|
94
|
+
- `timestamp` (float): Unix timestamp of when the event occurred.
|
|
95
|
+
- `is_return` (bool): Flag indicating if this is a response arrow.
|
|
96
|
+
- `is_error` (bool): Flag indicating if an exception occurred.
|
|
97
|
+
- `error_message` (Optional[str]): Detailed error text if `is_error` is True.
|
|
98
|
+
- `params` (Optional[str]): Stringified representation of function arguments.
|
|
99
|
+
- `result` (Optional[str]): Stringified representation of the return value.
|
|
100
|
+
|
|
101
|
+
### `BaseFormatter` (Abstract Base Class)
|
|
102
|
+
|
|
103
|
+
Abstract base class for all event formatters, providing a common interface for different output formats.
|
|
104
|
+
|
|
105
|
+
**Methods:**
|
|
106
|
+
- `format_event(event: Event) -> str`: Format an Event into the desired output string.
|
|
107
|
+
- `format(record: logging.LogRecord) -> str`: Format a logging record containing an event.
|
|
108
|
+
|
|
109
|
+
### `MermaidFormatter`
|
|
110
|
+
|
|
111
|
+
Custom formatter to convert Events into Mermaid sequence diagram syntax, inheriting from `BaseFormatter`.
|
|
112
|
+
|
|
113
|
+
**Methods:**
|
|
114
|
+
- `format_event(event: Event) -> str`: Converts an Event into a Mermaid syntax string.
|
|
115
|
+
|
|
116
|
+
### `MermaidFileHandler`
|
|
117
|
+
|
|
118
|
+
A custom logging handler that writes `Event` objects to a Mermaid (.mmd) file.
|
|
119
|
+
|
|
120
|
+
**Features:**
|
|
121
|
+
- Thread-safe file writing using locks
|
|
122
|
+
- Automatic Mermaid header management
|
|
123
|
+
- Support for both overwrite and append modes
|
|
124
|
+
- Delay writing support for better performance
|
|
125
|
+
|
|
126
|
+
### `AsyncMermaidHandler`
|
|
127
|
+
|
|
128
|
+
A non-blocking logging handler that uses a background thread to write logs.
|
|
129
|
+
|
|
130
|
+
**Arguments:**
|
|
131
|
+
- `handlers` (List[logging.Handler]): A list of handlers that should receive the logs from the queue.
|
|
132
|
+
- `queue_size` (int): The maximum size of the queue. Default is 1000.
|
|
133
|
+
|
|
134
|
+
**Features:**
|
|
135
|
+
- Queue-based logging with configurable size limit
|
|
136
|
+
- Built-in drop policy for when queue is full
|
|
137
|
+
- Automatic queue flushing on application exit
|
|
138
|
+
|
|
139
|
+
## Integrations
|
|
140
|
+
|
|
141
|
+
### `MermaidTraceMiddleware` (FastAPI)
|
|
142
|
+
|
|
143
|
+
Middleware for automatic HTTP request tracing. Captures request path, method, status code, and timing.
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from mermaid_trace.integrations.fastapi import MermaidTraceMiddleware
|
|
147
|
+
|
|
148
|
+
app.add_middleware(MermaidTraceMiddleware, app_name="MyAPI")
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Arguments:**
|
|
152
|
+
- `app`: The FastAPI/Starlette application.
|
|
153
|
+
- `app_name` (str): The name of the participant representing this application in the diagram.
|
|
154
|
+
|
|
155
|
+
**Headers Support:**
|
|
156
|
+
- `X-Source`: If sent by the client, sets the source participant name.
|
|
157
|
+
- `X-Trace-ID`: If sent, uses this ID for the trace session; otherwise generates a new UUID.
|
|
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.4.1] - 2026-01-26
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Abstract Event Model**: Introduced `Event` abstract base class and `BaseFormatter` interface for better extensibility and support for multiple output formats.
|
|
12
|
+
- **Enhanced Async Handler**: Added queue size limit (`queue_size=1000`) with drop policy to prevent memory overflow in high-traffic scenarios.
|
|
13
|
+
- **Improved Exception Handling**: Enhanced exception logging to include full stack traces and error details.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- **Context Loss Issue**: Fixed `LogContext._get_store()` method to properly initialize `contextvar` when no context exists, preventing subsequent `LookupError` exceptions.
|
|
17
|
+
- **Concurrency Safety**: Added thread locks in `MermaidFileHandler._write_header()` to prevent race conditions when writing file headers with `delay=True`.
|
|
18
|
+
|
|
19
|
+
### Improved
|
|
20
|
+
- **Architecture Design**: Decoupled components by introducing abstract interfaces, reducing tight coupling between `FlowEvent` and Mermaid-specific formatting.
|
|
21
|
+
- **Test Coverage**: Increased test coverage to 90.17% by adding comprehensive test cases for the new abstract classes.
|
|
22
|
+
- **Code Maintainability**: Added detailed English annotations to all code files, improving readability and developer experience.
|
|
23
|
+
|
|
8
24
|
## [0.4.0] - 2026-01-26
|
|
9
25
|
|
|
10
26
|
### Added
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# User Guide
|
|
2
2
|
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Introduction](#introduction)
|
|
6
|
+
- [How It Works](#how-it-works)
|
|
7
|
+
- [Concurrency & Trace IDs](#concurrency--trace-ids)
|
|
8
|
+
- [Context Inference](#context-inference)
|
|
9
|
+
- [Advanced Configuration](#advanced-configuration)
|
|
10
|
+
- [Async Mode (Performance)](#async-mode-performance)
|
|
11
|
+
- [Data Capture Control](#data-capture-control)
|
|
12
|
+
- [Explicit Naming](#explicit-naming)
|
|
13
|
+
- [Flexible Handler Configuration](#flexible-handler-configuration)
|
|
14
|
+
- [CLI Viewer](#cli-viewer)
|
|
15
|
+
|
|
3
16
|
## Introduction
|
|
4
17
|
|
|
5
18
|
MermaidTrace bridges the gap between code execution and architectural visualization. Unlike static analysis tools, it traces *actual* runtime calls, giving you a true picture of your system's behavior.
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# API 参考文档
|
|
2
2
|
|
|
3
|
+
## 目录
|
|
4
|
+
|
|
5
|
+
- [核心功能 (Core)](#核心功能-core)
|
|
6
|
+
- [trace / trace_interaction](#trace--trace_interaction)
|
|
7
|
+
- [configure_flow](#configure_flow)
|
|
8
|
+
- [LogContext](#logcontext)
|
|
9
|
+
- [Event(抽象基类)](#event抽象基类)
|
|
10
|
+
- [FlowEvent](#flowevent)
|
|
11
|
+
- [BaseFormatter(抽象基类)](#baseformatter抽象基类)
|
|
12
|
+
- [MermaidFormatter](#mermaidformatter)
|
|
13
|
+
- [MermaidFileHandler](#mermaidfilehandler)
|
|
14
|
+
- [AsyncMermaidHandler](#asyncmermaidhandler)
|
|
15
|
+
- [集成 (Integrations)](#集成-integrations)
|
|
16
|
+
- [MermaidTraceMiddleware (FastAPI)](#mermaidtracemiddleware-fastapi)
|
|
17
|
+
|
|
3
18
|
## 核心功能 (Core)
|
|
4
19
|
|
|
5
20
|
### `trace` / `trace_interaction`
|
|
@@ -54,6 +69,73 @@ def configure_flow(
|
|
|
54
69
|
- `LogContext.scope(data)`: 同步上下文管理器,用于临时更新上下文。
|
|
55
70
|
- `LogContext.ascope(data)`: 异步上下文管理器 (`async with`),用于临时更新上下文。
|
|
56
71
|
|
|
72
|
+
### `Event`(抽象基类)
|
|
73
|
+
|
|
74
|
+
所有事件类型的抽象基类,为不同类型的事件提供通用接口。
|
|
75
|
+
|
|
76
|
+
**方法:**
|
|
77
|
+
- `get_source() -> str`: 获取事件的来源。
|
|
78
|
+
- `get_target() -> str`: 获取事件的目标。
|
|
79
|
+
- `get_action() -> str`: 获取事件的动作名称。
|
|
80
|
+
- `get_message() -> str`: 获取事件的消息文本。
|
|
81
|
+
- `get_timestamp() -> float`: 获取事件的时间戳。
|
|
82
|
+
- `get_trace_id() -> str`: 获取事件的追踪 ID。
|
|
83
|
+
|
|
84
|
+
### `FlowEvent`
|
|
85
|
+
|
|
86
|
+
表示执行流程中的单个交互或步骤,继承自 `Event`。
|
|
87
|
+
|
|
88
|
+
**属性:**
|
|
89
|
+
- `source` (str): 发起动作的参与者名称。
|
|
90
|
+
- `target` (str): 接收动作的参与者名称。
|
|
91
|
+
- `action` (str): 操作的简短可读名称。
|
|
92
|
+
- `message` (str): 显示在图表箭头上的实际文本标签。
|
|
93
|
+
- `trace_id` (str): 追踪会话的唯一标识符。
|
|
94
|
+
- `timestamp` (float): 事件发生时的 Unix 时间戳。
|
|
95
|
+
- `is_return` (bool): 指示这是否为响应箭头的标志。
|
|
96
|
+
- `is_error` (bool): 指示是否发生异常的标志。
|
|
97
|
+
- `error_message` (Optional[str]): 如果 `is_error` 为 True,则包含详细的错误文本。
|
|
98
|
+
- `params` (Optional[str]): 函数参数的字符串表示。
|
|
99
|
+
- `result` (Optional[str]): 返回值的字符串表示。
|
|
100
|
+
|
|
101
|
+
### `BaseFormatter`(抽象基类)
|
|
102
|
+
|
|
103
|
+
所有事件格式化器的抽象基类,为不同的输出格式提供通用接口。
|
|
104
|
+
|
|
105
|
+
**方法:**
|
|
106
|
+
- `format_event(event: Event) -> str`: 将事件格式化为所需的输出字符串。
|
|
107
|
+
- `format(record: logging.LogRecord) -> str`: 格式化包含事件的日志记录。
|
|
108
|
+
|
|
109
|
+
### `MermaidFormatter`
|
|
110
|
+
|
|
111
|
+
将事件转换为 Mermaid 时序图语法的自定义格式化器,继承自 `BaseFormatter`。
|
|
112
|
+
|
|
113
|
+
**方法:**
|
|
114
|
+
- `format_event(event: Event) -> str`: 将事件转换为 Mermaid 语法字符串。
|
|
115
|
+
|
|
116
|
+
### `MermaidFileHandler`
|
|
117
|
+
|
|
118
|
+
将 `Event` 对象写入 Mermaid (.mmd) 文件的自定义日志处理器。
|
|
119
|
+
|
|
120
|
+
**特性:**
|
|
121
|
+
- 使用锁确保线程安全的文件写入
|
|
122
|
+
- 自动管理 Mermaid 文件头
|
|
123
|
+
- 支持覆盖和追加两种模式
|
|
124
|
+
- 支持延迟写入以提高性能
|
|
125
|
+
|
|
126
|
+
### `AsyncMermaidHandler`
|
|
127
|
+
|
|
128
|
+
使用后台线程写入日志的非阻塞日志处理器。
|
|
129
|
+
|
|
130
|
+
**参数:**
|
|
131
|
+
- `handlers` (List[logging.Handler]): 应该从队列接收日志的处理器列表。
|
|
132
|
+
- `queue_size` (int): 队列的最大大小。默认为 1000。
|
|
133
|
+
|
|
134
|
+
**特性:**
|
|
135
|
+
- 基于队列的日志记录,具有可配置的大小限制
|
|
136
|
+
- 队列已满时的内置丢弃策略
|
|
137
|
+
- 应用程序退出时自动刷新队列
|
|
138
|
+
|
|
57
139
|
## 集成 (Integrations)
|
|
58
140
|
|
|
59
141
|
### `MermaidTraceMiddleware` (FastAPI)
|
|
@@ -5,6 +5,22 @@
|
|
|
5
5
|
格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/),
|
|
6
6
|
并且本项目遵守 [Semantic Versioning](https://semver.org/lang/zh-CN/)(语义化版本控制)。
|
|
7
7
|
|
|
8
|
+
## [0.4.1] - 2026-01-26
|
|
9
|
+
|
|
10
|
+
### 新增
|
|
11
|
+
- **抽象事件模型**: 引入了 `Event` 抽象基类和 `BaseFormatter` 接口,以提高扩展性并支持多种输出格式。
|
|
12
|
+
- **增强型异步处理器**: 添加了队列大小限制 (`queue_size=1000`) 和丢弃策略,以防止高流量场景下的内存溢出。
|
|
13
|
+
- **改进的异常处理**: 增强了异常日志记录,包括完整的堆栈跟踪和错误详情。
|
|
14
|
+
|
|
15
|
+
### 修复
|
|
16
|
+
- **上下文丢失问题**: 修复了 `LogContext._get_store()` 方法,在没有上下文时正确初始化 `contextvar`,防止后续 `LookupError` 异常。
|
|
17
|
+
- **并发安全性**: 在 `MermaidFileHandler._write_header()` 中添加了线程锁,以防止在 `delay=True` 时写入文件头的竞争条件。
|
|
18
|
+
|
|
19
|
+
### 改进
|
|
20
|
+
- **架构设计**: 通过引入抽象接口解耦组件,减少了 `FlowEvent` 与 Mermaid 特定格式之间的紧密耦合。
|
|
21
|
+
- **测试覆盖率**: 通过为新抽象类添加全面的测试用例,将测试覆盖率提高到 90.17%。
|
|
22
|
+
- **代码可维护性**: 为所有代码文件添加了详细的英文注释,提高了可读性和开发体验。
|
|
23
|
+
|
|
8
24
|
## [0.4.0] - 2026-01-26
|
|
9
25
|
|
|
10
26
|
### 新增
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# 文档与代码注释更新汇总
|
|
2
|
+
|
|
3
|
+
## 版本: v0.4.1
|
|
4
|
+
|
|
5
|
+
### 一、文档更新
|
|
6
|
+
|
|
7
|
+
#### 1. 变更日志 (CHANGELOG.md)
|
|
8
|
+
|
|
9
|
+
- **英文版本**: 新增 v0.4.1 版本记录,包含所有新增功能和修复
|
|
10
|
+
- **中文版本**: 同步更新中文变更日志,确保与英文内容一致
|
|
11
|
+
|
|
12
|
+
#### 2. API 参考文档 (API.md)
|
|
13
|
+
|
|
14
|
+
- **英文版本**:
|
|
15
|
+
|
|
16
|
+
- 新增 `Event` 抽象基类文档
|
|
17
|
+
- 新增 `BaseFormatter` 抽象基类文档
|
|
18
|
+
- 更新 `FlowEvent` 文档,显示其继承关系
|
|
19
|
+
- 更新 `AsyncMermaidHandler` 文档,包含队列大小限制和丢弃策略
|
|
20
|
+
- 更新 `MermaidFileHandler` 文档,包含线程安全说明
|
|
21
|
+
- 新增 `MermaidFormatter` 继承关系说明
|
|
22
|
+
- **中文版本**: 同步更新所有中文 API 文档,确保术语翻译准确,内容与英文一致
|
|
23
|
+
|
|
24
|
+
### 二、代码注释更新 (docs/zh/code_comments/)
|
|
25
|
+
|
|
26
|
+
#### 1. 核心模块 (core/)
|
|
27
|
+
|
|
28
|
+
- **context.md**: 更新 `_get_store` 方法注释,说明新增的 `contextvar` 初始化逻辑,解决上下文丢失问题
|
|
29
|
+
- **events.md**: 新增 `Event` 抽象基类注释,更新 `FlowEvent` 注释,显示其继承关系和新增的抽象方法实现
|
|
30
|
+
- **formatter.md**: 新增 `BaseFormatter` 抽象基类注释,更新 `MermaidFormatter` 注释,说明其继承关系和新增的 `format_event` 方法
|
|
31
|
+
|
|
32
|
+
#### 2. 处理器模块 (handlers/)
|
|
33
|
+
|
|
34
|
+
- **async_handler.md**: 更新异步处理器注释,说明新增的队列大小限制 (默认 1000) 和丢弃策略,以及改进的 `emit` 方法
|
|
35
|
+
- **mermaid_handler.md**: 更新 `_write_header` 方法注释,说明新增的线程锁机制,确保并发安全
|
|
36
|
+
|
|
37
|
+
### 三、关键功能变更说明
|
|
38
|
+
|
|
39
|
+
#### 1. 抽象层设计
|
|
40
|
+
|
|
41
|
+
- 引入 `Event` 抽象基类,为不同类型的事件提供通用接口
|
|
42
|
+
- 引入 `BaseFormatter` 抽象基类,为不同输出格式的格式化器提供通用接口
|
|
43
|
+
- 改进组件间的解耦,降低 `FlowEvent` 与 Mermaid 特定格式的耦合度
|
|
44
|
+
|
|
45
|
+
#### 2. 并发安全性
|
|
46
|
+
|
|
47
|
+
- 修复 `MermaidFileHandler._write_header` 方法的并发安全问题,添加线程锁保护
|
|
48
|
+
- 改进 `LogContext._get_store` 方法,正确初始化 `contextvar`,解决上下文丢失问题
|
|
49
|
+
|
|
50
|
+
#### 3. 性能优化
|
|
51
|
+
|
|
52
|
+
- 为 `AsyncMermaidHandler` 添加队列大小限制 (默认 1000),防止内存溢出
|
|
53
|
+
- 实现智能丢弃策略,在队列满时避免阻塞主程序
|
|
54
|
+
- 添加超时机制,确保日志记录不会长时间阻塞应用程序
|
|
55
|
+
|
|
56
|
+
#### 4. 错误处理
|
|
57
|
+
|
|
58
|
+
- 增强异常日志记录,包含完整堆栈跟踪和错误详情
|
|
59
|
+
- 改进 `emit` 方法的错误处理,避免无限递归
|
|
60
|
+
- 添加队列满时的警告机制,提高系统可观测性
|
|
61
|
+
- 修复 `AsyncMermaidHandler.stop()` 方法中的 `queue.Full` 异常,确保在队列满时能够优雅停止
|
|
62
|
+
|
|
63
|
+
### 四、质量保证
|
|
64
|
+
|
|
65
|
+
#### 1. 交叉校对
|
|
66
|
+
|
|
67
|
+
- 所有英文文档和中文文档进行了交叉校对,确保内容一致
|
|
68
|
+
- 术语翻译统一,遵循项目现有的文档规范
|
|
69
|
+
- 格式统一,保持良好的可读性
|
|
70
|
+
|
|
71
|
+
#### 2. 代码注释质量
|
|
72
|
+
|
|
73
|
+
- 注释准确、清晰,重点解释实现思路和设计决策
|
|
74
|
+
- 避免过度注释,仅针对关键逻辑和复杂代码段添加注释
|
|
75
|
+
- 遵循项目现有的注释风格
|
|
76
|
+
|
|
77
|
+
### 五、更新范围
|
|
78
|
+
|
|
79
|
+
| 模块 | 英文文档 | 中文文档 | 中文代码注释 |
|
|
80
|
+
| ---------- | -------- | -------- | ------------ |
|
|
81
|
+
| CHANGELOG | ✅ | ✅ | ❌ |
|
|
82
|
+
| API 参考 | ✅ | ✅ | ❌ |
|
|
83
|
+
| 核心模块 | ❌ | ❌ | ✅ |
|
|
84
|
+
| 处理器模块 | ❌ | ❌ | ✅ |
|
|
85
|
+
| 集成模块 | ❌ | ❌ | ❌ |
|
|
86
|
+
| 测试模块 | ✅ | ✅ | ❌ |
|
|
87
|
+
|
|
88
|
+
### 六、后续建议
|
|
89
|
+
|
|
90
|
+
1. **定期更新**:建议在每次版本发布时同步更新文档和代码注释
|
|
91
|
+
2. **社区贡献**:鼓励社区成员参与文档翻译和注释改进
|
|
92
|
+
3. **自动化检查**:考虑添加文档链接检查和格式验证工具
|
|
93
|
+
4. **用户反馈**:收集用户对文档的反馈,持续改进文档质量
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
**更新日期**: 2026-01-26
|
|
98
|
+
**更新人员**: 系统自动生成
|
|
99
|
+
**更新范围**: 完整中英文文档集及代码注释
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# 用户指南
|
|
2
2
|
|
|
3
|
+
## 目录
|
|
4
|
+
|
|
5
|
+
- [简介](#简介)
|
|
6
|
+
- [工作原理](#工作原理)
|
|
7
|
+
- [并发与 Trace ID](#并发与-trace-id)
|
|
8
|
+
- [上下文推断 (Context Inference)](#上下文推断-context-inference)
|
|
9
|
+
- [高级配置](#高级配置)
|
|
10
|
+
- [异步模式 (性能优化)](#异步模式-性能优化)
|
|
11
|
+
- [数据捕获控制](#数据捕获控制)
|
|
12
|
+
- [显式命名](#显式命名)
|
|
13
|
+
- [灵活的 Handler 配置](#灵活的-handler-配置)
|
|
14
|
+
- [CLI 查看器](#cli-查看器)
|
|
15
|
+
|
|
3
16
|
## 简介
|
|
4
17
|
|
|
5
18
|
MermaidTrace 弥合了代码执行与架构可视化之间的鸿沟。与静态分析工具不同,它追踪的是**实际**的运行时调用,为您提供系统行为的真实写照。
|
{mermaid_trace-0.4.0 → mermaid_trace-0.4.1}/docs/zh/code_comments/src/mermaid_trace/__init__.md
RENAMED
|
@@ -118,5 +118,5 @@ except PackageNotFoundError:
|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
# 导出公共 API 以方便访问
|
|
121
|
-
__all__ = ["trace_interaction", "trace", "configure_flow", "MermaidFileHandler", "AsyncMermaidHandler", "LogContext", "FlowEvent", "MermaidFormatter"]
|
|
121
|
+
__all__ = ["trace_interaction", "trace", "configure_flow", "MermaidFileHandler", "AsyncMermaidHandler", "LogContext", "Event", "FlowEvent", "BaseFormatter", "MermaidFormatter"]
|
|
122
122
|
```
|