ReqIDFromContext 从 dispatch ctx 中取出当前请求的 reqID(若无返回空串)。
(ctx context.Context)
| 273 | |
| 274 | // ReqIDFromContext 从 dispatch ctx 中取出当前请求的 reqID(若无返回空串)。 |
| 275 | func ReqIDFromContext(ctx context.Context) string { |
| 276 | if ctx == nil { |
| 277 | return "" |
| 278 | } |
| 279 | v, _ := ctx.Value(reqIDCtxKey{}).(string) |
| 280 | return v |
| 281 | } |