@@ -36,7 +36,6 @@ import (
3636 srvconfig "github.com/containerd/containerd/services/server/config"
3737 "github.com/containerd/containerd/sys"
3838 "github.com/containerd/containerd/version"
39- "github.com/sirupsen/logrus"
4039 "github.com/urfave/cli"
4140 "google.golang.org/grpc/grpclog"
4241)
@@ -150,7 +149,7 @@ can be used and modified as necessary as a custom configuration.`
150149 // Stop if we are registering or unregistering against Windows SCM.
151150 stop , err := registerUnregisterService (config .Root )
152151 if err != nil {
153- logrus .Fatal (err )
152+ log . L .Fatal (err )
154153 }
155154 if stop {
156155 return nil
@@ -203,7 +202,7 @@ can be used and modified as necessary as a custom configuration.`
203202
204203 // Launch as a Windows Service if necessary
205204 if err := launchService (server , done ); err != nil {
206- logrus .Fatal (err )
205+ log . L .Fatal (err )
207206 }
208207 select {
209208 case <- ctx .Done ():
@@ -352,11 +351,7 @@ func setLogLevel(context *cli.Context, config *srvconfig.Config) error {
352351 l = config .Debug .Level
353352 }
354353 if l != "" {
355- lvl , err := logrus .ParseLevel (l )
356- if err != nil {
357- return err
358- }
359- logrus .SetLevel (lvl )
354+ return log .SetLevel (l )
360355 }
361356 return nil
362357}
@@ -367,21 +362,7 @@ func setLogFormat(config *srvconfig.Config) error {
367362 f = log .TextFormat
368363 }
369364
370- switch f {
371- case log .TextFormat :
372- logrus .SetFormatter (& logrus.TextFormatter {
373- TimestampFormat : log .RFC3339NanoFixed ,
374- FullTimestamp : true ,
375- })
376- case log .JSONFormat :
377- logrus .SetFormatter (& logrus.JSONFormatter {
378- TimestampFormat : log .RFC3339NanoFixed ,
379- })
380- default :
381- return fmt .Errorf ("unknown log format: %s" , f )
382- }
383-
384- return nil
365+ return log .SetFormat (f )
385366}
386367
387368func dumpStacks (writeToFile bool ) {
@@ -396,7 +377,7 @@ func dumpStacks(writeToFile bool) {
396377 bufferLen *= 2
397378 }
398379 buf = buf [:stackSize ]
399- logrus .Infof ("=== BEGIN goroutine stack dump ===\n %s\n === END goroutine stack dump ===" , buf )
380+ log . L .Infof ("=== BEGIN goroutine stack dump ===\n %s\n === END goroutine stack dump ===" , buf )
400381
401382 if writeToFile {
402383 // Also write to file to aid gathering diagnostics
@@ -407,6 +388,6 @@ func dumpStacks(writeToFile bool) {
407388 }
408389 defer f .Close ()
409390 f .WriteString (string (buf ))
410- logrus .Infof ("goroutine stack dump written to %s" , name )
391+ log . L .Infof ("goroutine stack dump written to %s" , name )
411392 }
412393}
0 commit comments