Remove most logrus

Signed-off-by: Jin Dong <jin.dong@databricks.com>
This commit is contained in:
Jin Dong
2023-08-26 13:17:03 -04:00
parent 03e4f1e363
commit fc45365fa1
31 changed files with 84 additions and 94 deletions

View File

@@ -167,7 +167,7 @@ func setLogger(ctx context.Context, id string) (context.Context, error) {
FullTimestamp: true,
})
if debugFlag {
l.Logger.SetLevel(logrus.DebugLevel)
l.Logger.SetLevel(log.DebugLevel)
}
f, err := openLog(ctx, id)
if err != nil {
@@ -235,13 +235,13 @@ func run(ctx context.Context, manager Manager, name string, config Config) error
// Handle explicit actions
switch action {
case "delete":
if debugFlag {
logrus.SetLevel(logrus.DebugLevel)
}
logger := log.G(ctx).WithFields(log.Fields{
"pid": os.Getpid(),
"namespace": namespaceFlag,
})
if debugFlag {
logger.Logger.SetLevel(log.DebugLevel)
}
go reap(ctx, logger, signals)
ss, err := manager.Stop(ctx, id)
if err != nil {
@@ -350,7 +350,7 @@ func run(ctx context.Context, manager Manager, name string, config Config) error
}
if src, ok := instance.(TTRPCService); ok {
logrus.WithField("id", id).Debug("registering ttrpc service")
log.G(ctx).WithField("id", id).Debug("registering ttrpc service")
ttrpcServices = append(ttrpcServices, src)
}
@@ -432,7 +432,7 @@ func serve(ctx context.Context, server *ttrpc.Server, signals chan os.Signal, sh
return reap(ctx, logger, signals)
}
func dumpStacks(logger *logrus.Entry) {
func dumpStacks(logger *log.Entry) {
var (
buf []byte
stackSize int

View File

@@ -27,6 +27,7 @@ import (
"os/signal"
"syscall"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/sys/reaper"
"github.com/containerd/fifo"
"github.com/sirupsen/logrus"
@@ -66,7 +67,7 @@ func serveListener(path string) (net.Listener, error) {
if err != nil {
return nil, err
}
logrus.WithField("socket", path).Debug("serving api on socket")
log.L.WithField("socket", path).Debug("serving api on socket")
return l, nil
}