You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/07/01 08:36:18 UTC

[GitHub] [skywalking-banyandb] lujiajing1126 commented on a change in pull request #12: Feat: switch to zerolog

lujiajing1126 commented on a change in pull request #12:
URL: https://github.com/apache/skywalking-banyandb/pull/12#discussion_r662094318



##########
File path: pkg/logger/setting.go
##########
@@ -66,24 +68,16 @@ func Init(cfg Logging) (err error) {
 
 // getLogger initializes a root logger
 func getLogger(cfg Logging) (*Logger, error) {
-	// parse logging level
-	level := zap.NewAtomicLevelAt(zapcore.InfoLevel)
-	if err := level.UnmarshalText([]byte(cfg.Level)); err != nil {
+	lvl, err := zerolog.ParseLevel(cfg.Level)
+	if err != nil {
 		return nil, err
 	}
-	var encoderConfig zap.Config
+	w := io.Writer(os.Stderr)
 	switch cfg.Env {
 	case "dev":
-		encoderConfig = zap.NewDevelopmentConfig()
-		encoderConfig.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
-		break
+		w = zerolog.ConsoleWriter{Out: os.Stderr}

Review comment:
       Fixed.
   
   ```
   2021-07-01T16:32:43+08:00 | DEBUG | ***register flags**** module:STANDALONE name:DATABASE registered:1 total:3
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org