提交 846c04b1 作者: Forrest Weston 提交者: ForrestWeston

Added uuid loggable (requestId) to root context

Every log event resulting from a command will have a uuid associated with it

License: MIT
Signed-off-by: 's avatarForrest Weston <forrest@protocol.ai>
上级 115998d2
......@@ -17,6 +17,7 @@ import (
cors "gx/ipfs/QmPG2kW5t27LuHgHnvhUwbHCNHAt2eUcb4gPHqofrESUdB/cors"
logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
loggables "gx/ipfs/QmT4PgCNdv73hnFAqzHqwW44q7M9PWpykSswHDxndquZbc/go-libp2p-loggables"
)
var log = logging.Logger("commands/http")
......@@ -137,6 +138,7 @@ func (i internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
ctx, cancel := context.WithCancel(node.Context())
ctx = logging.ContextWithLoggable(ctx, loggables.Uuid("requestId"))
defer cancel()
if cn, ok := w.(http.CloseNotifier); ok {
clientGone := cn.CloseNotify()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论