|
NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
|
Mapped Diagnostic Context,线程局部上下文 更多...
#include <log_event.hpp>
静态 Public 成员函数 | |
| static void | put (const string &key, string value) |
| 设置键值对 | |
| static string | get (const string &key) |
| 获取键对应的值 | |
| static void | remove (const string &key) |
| 移除指定的键 | |
| static void | clear () |
| 清除当前线程的所有 MDC 数据 | |
| static bool | empty () |
| 检查当前线程的 MDC 是否为空 | |
| static unordered_map< string, string > | snapshot () |
| 获取当前线程 MDC 的快照 | |
Mapped Diagnostic Context,线程局部上下文
每个线程独立的键值对存储,用于附加请求追踪信息(如 request_id、user)。 日志事件构造时自动将 MDC 内容合并到 event.context 中。
在文件 log_event.hpp 第 124 行定义.
|
static |
检查当前线程的 MDC 是否为空
|
static |
移除指定的键
| key | 键名 |
|
static |
获取当前线程 MDC 的快照