Skip to content

Commit e0d7ed1

Browse files
author
John Howard
committed
Windows: Enable ETW logging
Signed-off-by: John Howard <[email protected]>
1 parent fd6ac5d commit e0d7ed1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

cmd/containerd/command/main_windows.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"unsafe"
2525

2626
winio "github.com/Microsoft/go-winio"
27+
"github.com/Microsoft/go-winio/pkg/etwlogrus"
2728
"github.com/containerd/containerd/log"
2829
"github.com/containerd/containerd/services/server"
2930
"github.com/sirupsen/logrus"
@@ -89,3 +90,12 @@ func setupDumpStacks() {
8990
}
9091
}()
9192
}
93+
94+
func init() {
95+
// Provider ID: {2acb92c0-eb9b-571a-69cf-8f3410f383ad}
96+
// Hook isn't closed explicitly, as it will exist until process exit.
97+
// GUID is generated based on name - see Microsoft/go-winio/tools/etw-provider-gen.
98+
if hook, err := etwlogrus.NewHook("ContainerD"); err == nil {
99+
logrus.AddHook(hook)
100+
}
101+
}

0 commit comments

Comments
 (0)