Use trace support in containerd.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
b776e696bd
commit
8925ef90be
@ -28,6 +28,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/containerd/cgroups"
|
"github.com/containerd/cgroups"
|
||||||
|
"github.com/containerd/containerd/log"
|
||||||
"github.com/containerd/containerd/sys"
|
"github.com/containerd/containerd/sys"
|
||||||
runtimespec "github.com/opencontainers/runtime-spec/specs-go"
|
runtimespec "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -35,7 +36,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/util/interrupt"
|
"k8s.io/kubernetes/pkg/util/interrupt"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/cmd/cri-containerd/options"
|
"github.com/containerd/cri-containerd/cmd/cri-containerd/options"
|
||||||
"github.com/containerd/cri-containerd/pkg/log"
|
|
||||||
"github.com/containerd/cri-containerd/pkg/server"
|
"github.com/containerd/cri-containerd/pkg/server"
|
||||||
"github.com/containerd/cri-containerd/pkg/version"
|
"github.com/containerd/cri-containerd/pkg/version"
|
||||||
)
|
)
|
||||||
|
@ -16,31 +16,14 @@ limitations under the License.
|
|||||||
|
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import "github.com/sirupsen/logrus"
|
import "github.com/containerd/containerd/log"
|
||||||
|
|
||||||
// TODO(random-liu): Add trace support in containerd.
|
|
||||||
|
|
||||||
// TraceLevel is the log level for trace.
|
|
||||||
const TraceLevel = logrus.Level(uint32(logrus.DebugLevel + 1))
|
|
||||||
|
|
||||||
// ParseLevel takes a string level and returns the Logrus log level constant.
|
|
||||||
func ParseLevel(lvl string) (logrus.Level, error) {
|
|
||||||
if lvl == "trace" {
|
|
||||||
return TraceLevel, nil
|
|
||||||
}
|
|
||||||
return logrus.ParseLevel(lvl)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trace logs a message at level Trace on the standard logger.
|
// Trace logs a message at level Trace on the standard logger.
|
||||||
func Trace(args ...interface{}) {
|
func Trace(args ...interface{}) {
|
||||||
if logrus.GetLevel() >= TraceLevel {
|
log.Trace(log.L, args...)
|
||||||
logrus.Debug(args...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tracef logs a message at level Trace on the standard logger.
|
// Tracef logs a message at level Trace on the standard logger.
|
||||||
func Tracef(format string, args ...interface{}) {
|
func Tracef(format string, args ...interface{}) {
|
||||||
if logrus.GetLevel() >= TraceLevel {
|
log.Tracef(log.L, format, args...)
|
||||||
logrus.Debugf(format, args...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user