Kaynağa Gözat

Add verbose level to logger

tags/0.9
9seconds 8 yıl önce
ebeveyn
işleme
2cc845f158
1 değiştirilmiş dosya ile 6 ekleme ve 0 silme
  1. 6
    0
      main.go

+ 6
- 0
main.go Dosyayı Görüntüle

25
 		Short('d').
25
 		Short('d').
26
 		Envar("MTG_DEBUG").
26
 		Envar("MTG_DEBUG").
27
 		Bool()
27
 		Bool()
28
+	verbose = app.Flag("verbose", "Run in verbose mode.").
29
+		Short('v').
30
+		Envar("MTG_VERBOSE").
31
+		Bool()
28
 	bindIP = app.Flag("bind-ip", "Which IP to bind to.").
32
 	bindIP = app.Flag("bind-ip", "Which IP to bind to.").
29
 		Short('i').
33
 		Short('i').
30
 		Envar("MTG_IP").
34
 		Envar("MTG_IP").
69
 	atom := zap.NewAtomicLevel()
73
 	atom := zap.NewAtomicLevel()
70
 	if *debug {
74
 	if *debug {
71
 		atom.SetLevel(zapcore.DebugLevel)
75
 		atom.SetLevel(zapcore.DebugLevel)
76
+	} else if *verbose {
77
+		atom.SetLevel(zapcore.InfoLevel)
72
 	} else {
78
 	} else {
73
 		atom.SetLevel(zapcore.ErrorLevel)
79
 		atom.SetLevel(zapcore.ErrorLevel)
74
 	}
80
 	}

Loading…
İptal
Kaydet