Merge pull request #9016 from djdongjin/remove-most-logrus

Remove most logrus import
This commit is contained in:
Akihiro Suda
2023-09-05 16:09:12 +09:00
committed by GitHub
31 changed files with 84 additions and 94 deletions

View File

@@ -30,9 +30,9 @@ import (
"time"
"github.com/containerd/continuity/fs/fstest"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/mount"
"github.com/containerd/containerd/snapshots"
"github.com/containerd/containerd/snapshots/devmapper"
@@ -54,7 +54,9 @@ func init() {
flag.StringVar(&nativeRootPath, "native.rootPath", "", "Root dir for native snapshotter")
// Avoid mixing benchmark output and INFO messages
logrus.SetLevel(logrus.ErrorLevel)
if err := log.SetLevel("error"); err != nil {
panic(fmt.Sprintf("failed to set up log level: %v", err))
}
}
func BenchmarkNative(b *testing.B) {

View File

@@ -27,9 +27,9 @@ import (
"time"
"github.com/containerd/continuity/fs/fstest"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/mount"
"github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/pkg/testutil"
@@ -41,7 +41,7 @@ import (
func TestSnapshotterSuite(t *testing.T) {
testutil.RequiresRoot(t)
logrus.SetLevel(logrus.DebugLevel)
assert.NoError(t, log.SetLevel("debug"))
snapshotterFn := func(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) {
poolName := fmt.Sprintf("containerd-snapshotter-suite-pool-%d", time.Now().Nanosecond())
@@ -138,7 +138,7 @@ func TestMkfsXfsNonDefault(t *testing.T) {
func TestMultipleXfsMounts(t *testing.T) {
testutil.RequiresRoot(t)
logrus.SetLevel(logrus.DebugLevel)
assert.NoError(t, log.SetLevel("debug"))
ctx := context.Background()
ctx = namespaces.WithNamespace(ctx, "testsuite")

View File

@@ -32,7 +32,6 @@ import (
"github.com/containerd/containerd/snapshots/overlay/overlayutils"
"github.com/containerd/containerd/snapshots/storage"
"github.com/containerd/continuity/fs"
"github.com/sirupsen/logrus"
)
// upperdirKey is a key of an optional label to each snapshot.
@@ -137,7 +136,7 @@ func NewSnapshotter(root string, opts ...Opt) (snapshots.Snapshotter, error) {
// figure out whether "userxattr" option is recognized by the kernel && needed
userxattr, err := overlayutils.NeedsUserXAttr(root)
if err != nil {
logrus.WithError(err).Warnf("cannot detect whether \"userxattr\" option needs to be used, assuming to be %v", userxattr)
log.L.WithError(err).Warnf("cannot detect whether \"userxattr\" option needs to be used, assuming to be %v", userxattr)
}
if userxattr {
config.mountOptions = append(config.mountOptions, "userxattr")