mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-22 06:43:28 +00:00
Migrate to containerd v1.7.0 and update dependencies
* Updates containerd to v1.7.0 and new binary for 32-bit Arm OSes. * Updates Go dependencies - openfaas and external Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
9efd019e86
commit
c41c2cd9fc
45
vendor/github.com/Microsoft/hcsshim/internal/log/hook.go
generated
vendored
Normal file
45
vendor/github.com/Microsoft/hcsshim/internal/log/hook.go
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"github.com/Microsoft/hcsshim/internal/logfields"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
||||
// Hook serves to intercept and format `logrus.Entry`s before they are passed
|
||||
// to the ETW hook.
|
||||
//
|
||||
// The containerd shim discards the (formatted) logrus output, and outputs only via ETW.
|
||||
// The Linux GCS outputs logrus entries over stdout, which is consumed by the shim and
|
||||
// then re-output via the ETW hook.
|
||||
type Hook struct{}
|
||||
|
||||
var _ logrus.Hook = &Hook{}
|
||||
|
||||
func NewHook() *Hook {
|
||||
return &Hook{}
|
||||
}
|
||||
|
||||
func (h *Hook) Levels() []logrus.Level {
|
||||
return logrus.AllLevels
|
||||
}
|
||||
|
||||
func (h *Hook) Fire(e *logrus.Entry) (err error) {
|
||||
h.addSpanContext(e)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Hook) addSpanContext(e *logrus.Entry) {
|
||||
ctx := e.Context
|
||||
if ctx == nil {
|
||||
return
|
||||
}
|
||||
span := trace.FromContext(ctx)
|
||||
if span == nil {
|
||||
return
|
||||
}
|
||||
sctx := span.SpanContext()
|
||||
e.Data[logfields.TraceID] = sctx.TraceID.String()
|
||||
e.Data[logfields.SpanID] = sctx.SpanID.String()
|
||||
}
|
Reference in New Issue
Block a user