feat: show "WARN" and "ERRO" log level

Signed-off-by: 24sama <jacksama@foxmail.com>
This commit is contained in:
24sama 2022-06-09 09:42:51 +08:00
parent d49557706c
commit 0684d2c392
2 changed files with 6 additions and 5 deletions

View File

@ -18,12 +18,14 @@ package logger
import (
"fmt"
"github.com/kubesphere/kubekey/pkg/core/common"
"path/filepath"
"time"
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
"github.com/rifflock/lfshook"
"github.com/sirupsen/logrus"
"path/filepath"
"time"
"github.com/kubesphere/kubekey/pkg/core/common"
)
var Log *KubeKeyLog
@ -41,7 +43,7 @@ func NewLogger(outputPath string, verbose bool) *KubeKeyLog {
HideKeys: true,
TimestampFormat: "15:04:05 MST",
NoColors: true,
ShowLevel: logrus.FatalLevel,
ShowLevel: logrus.WarnLevel,
FieldsDisplayWithOrder: []string{common.Pipeline, common.Module, common.Task, common.Node},
}
logger.SetFormatter(formatter)

View File

@ -26,7 +26,6 @@ var log = NewLogger("", true)
func TestKubeKey_Print(t *testing.T) {
wg := &sync.WaitGroup{}
for i := 0; i < 5; i++ {
Log.Info("begin")
log.Info("empty fields")
l1 := *log