commit
b93b5b62d1
|
@ -45,6 +45,7 @@ import (
|
|||
"github.com/moby/buildkit/util/appdefaults"
|
||||
"github.com/moby/buildkit/util/archutil"
|
||||
"github.com/moby/buildkit/util/grpcerrors"
|
||||
_ "github.com/moby/buildkit/util/log"
|
||||
"github.com/moby/buildkit/util/profiler"
|
||||
"github.com/moby/buildkit/util/resolver"
|
||||
"github.com/moby/buildkit/util/stack"
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package log
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
func init() {
|
||||
log.G = GetLogger
|
||||
}
|
||||
|
||||
func GetLogger(ctx context.Context) *logrus.Entry {
|
||||
l := log.GetLogger(ctx)
|
||||
|
||||
spanContext := trace.SpanFromContext(ctx).SpanContext()
|
||||
|
||||
if spanContext.IsValid() {
|
||||
return l.WithFields(logrus.Fields{
|
||||
"traceID": spanContext.TraceID(),
|
||||
"spanID": spanContext.SpanID(),
|
||||
})
|
||||
}
|
||||
|
||||
return l
|
||||
}
|
Loading…
Reference in New Issue