Skip to content

Commit 75fd7a5

Browse files
committed
pkg/shim: remove logrus imports
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent ab61734 commit 75fd7a5

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

pkg/shim/shim.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import (
4343
"github.com/containerd/plugin"
4444
"github.com/containerd/plugin/registry"
4545
"github.com/containerd/ttrpc"
46-
"github.com/sirupsen/logrus"
4746
)
4847

4948
// Publisher for events
@@ -171,12 +170,9 @@ func setRuntime() {
171170

172171
func setLogger(ctx context.Context, id string) (context.Context, error) {
173172
l := log.G(ctx)
174-
l.Logger.SetFormatter(&logrus.TextFormatter{
175-
TimestampFormat: log.RFC3339NanoFixed,
176-
FullTimestamp: true,
177-
})
173+
_ = log.SetFormat(log.TextFormat)
178174
if debugFlag {
179-
l.Logger.SetLevel(log.DebugLevel)
175+
_ = log.SetLevel("debug")
180176
}
181177
f, err := openLog(ctx, id)
182178
if err != nil {

pkg/shim/shim_unix.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"github.com/containerd/containerd/v2/pkg/sys/reaper"
3131
"github.com/containerd/fifo"
3232
"github.com/containerd/log"
33-
"github.com/sirupsen/logrus"
3433
"golang.org/x/sys/unix"
3534
)
3635

@@ -71,7 +70,7 @@ func serveListener(path string) (net.Listener, error) {
7170
return l, nil
7271
}
7372

74-
func reap(ctx context.Context, logger *logrus.Entry, signals chan os.Signal) error {
73+
func reap(ctx context.Context, logger *log.Entry, signals chan os.Signal) error {
7574
logger.Debug("starting signal loop")
7675

7776
for {
@@ -92,7 +91,7 @@ func reap(ctx context.Context, logger *logrus.Entry, signals chan os.Signal) err
9291
}
9392
}
9493

95-
func handleExitSignals(ctx context.Context, logger *logrus.Entry, cancel context.CancelFunc) {
94+
func handleExitSignals(ctx context.Context, logger *log.Entry, cancel context.CancelFunc) {
9695
ch := make(chan os.Signal, 32)
9796
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
9897

pkg/shim/shim_windows.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import (
2323
"os"
2424

2525
"github.com/containerd/errdefs"
26+
"github.com/containerd/log"
2627
"github.com/containerd/ttrpc"
27-
"github.com/sirupsen/logrus"
2828
)
2929

3030
func setupSignals(config Config) (chan os.Signal, error) {
@@ -46,11 +46,11 @@ func serveListener(path string) (net.Listener, error) {
4646
return nil, errdefs.ErrNotImplemented
4747
}
4848

49-
func reap(ctx context.Context, logger *logrus.Entry, signals chan os.Signal) error {
49+
func reap(ctx context.Context, logger *log.Entry, signals chan os.Signal) error {
5050
return errdefs.ErrNotImplemented
5151
}
5252

53-
func handleExitSignals(ctx context.Context, logger *logrus.Entry, cancel context.CancelFunc) {
53+
func handleExitSignals(ctx context.Context, logger *log.Entry, cancel context.CancelFunc) {
5454
}
5555

5656
func openLog(ctx context.Context, _ string) (io.Writer, error) {

0 commit comments

Comments
 (0)