Skip to content

Commit aeec80f

Browse files
authored
Merge pull request containerd#3773 from Random-Liu/use-logrus-trace
Use logrus trace support.
2 parents 0c01992 + 20e844a commit aeec80f

File tree

5 files changed

+6
-36
lines changed

5 files changed

+6
-36
lines changed

cmd/containerd/command/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func setLevel(context *cli.Context, config *srvconfig.Config) error {
284284
l = config.Debug.Level
285285
}
286286
if l != "" {
287-
lvl, err := log.ParseLevel(l)
287+
lvl, err := logrus.ParseLevel(l)
288288
if err != nil {
289289
return err
290290
}

log/context.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package log
1818

1919
import (
2020
"context"
21-
"sync/atomic"
2221

2322
"github.com/sirupsen/logrus"
2423
)
@@ -38,23 +37,10 @@ type (
3837
loggerKey struct{}
3938
)
4039

41-
// TraceLevel is the log level for tracing. Trace level is lower than debug level,
42-
// and is usually used to trace detailed behavior of the program.
43-
const TraceLevel = logrus.Level(uint32(logrus.DebugLevel + 1))
44-
4540
// RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to
4641
// ensure the formatted time is always the same number of characters.
4742
const RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
4843

49-
// ParseLevel takes a string level and returns the Logrus log level constant.
50-
// It supports trace level.
51-
func ParseLevel(lvl string) (logrus.Level, error) {
52-
if lvl == "trace" {
53-
return TraceLevel, nil
54-
}
55-
return logrus.ParseLevel(lvl)
56-
}
57-
5844
// WithLogger returns a new context with the provided logger. Use in
5945
// combination with logger.WithField(s) for great effect.
6046
func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context {
@@ -72,19 +58,3 @@ func GetLogger(ctx context.Context) *logrus.Entry {
7258

7359
return logger.(*logrus.Entry)
7460
}
75-
76-
// Trace logs a message at level Trace with the log entry passed-in.
77-
func Trace(e *logrus.Entry, args ...interface{}) {
78-
level := logrus.Level(atomic.LoadUint32((*uint32)(&e.Logger.Level)))
79-
if level >= TraceLevel {
80-
e.Debug(args...)
81-
}
82-
}
83-
84-
// Tracef logs a message at level Trace with the log entry passed-in.
85-
func Tracef(e *logrus.Entry, format string, args ...interface{}) {
86-
level := logrus.Level(atomic.LoadUint32((*uint32)(&e.Logger.Level)))
87-
if level >= TraceLevel {
88-
e.Debugf(format, args...)
89-
}
90-
}

vendor.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ github.com/russross/blackfriday v1.5.2
5252
github.com/google/uuid v1.1.1
5353

5454
# cri dependencies
55-
github.com/containerd/cri 0ebf032aac5f6029f95a94e42161e9db7a7e84df # release/1.3+
55+
github.com/containerd/cri 8ce2ad6b7c9a83f830684d1025034fb3ad2ec375 # master
5656
github.com/containerd/go-cni 0d360c50b10b350b6bb23863fd4dfb1c232b01c9
5757
github.com/containernetworking/cni v0.7.1
5858
github.com/containernetworking/plugins v0.7.6

vendor/github.com/containerd/cri/cri.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/containerd/cri/vendor.conf

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)