@cryptotaxi247 / kubo / commits / 846c04b13

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: Forrest Weston <forrest@protocol.ai>

Forrest Weston committed Nov 14, 2017 at 17:33 UTC 846c04b131d7ef9557bcaf80359af4b7b46102c1
1 file changed +2
commands/http/handler.go
+2
@@ -17,6 +17,7 @@ import (
17
18 cors "gx/ipfs/QmPG2kW5t27LuHgHnvhUwbHCNHAt2eUcb4gPHqofrESUdB/cors"
19 logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
20 + loggables "gx/ipfs/QmT4PgCNdv73hnFAqzHqwW44q7M9PWpykSswHDxndquZbc/go-libp2p-loggables"
21 )
22
23 var log = logging.Logger("commands/http")
@@ -137,6 +138,7 @@ func (i internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
138 }
139
140 ctx, cancel := context.WithCancel(node.Context())
141 + ctx = logging.ContextWithLoggable(ctx, loggables.Uuid("requestId"))
142 defer cancel()
143 if cn, ok := w.(http.CloseNotifier); ok {
144 clientGone := cn.CloseNotify()