Browse Source

bin: fix log's level & caller

pull/19/head
miraclesu 8 years ago
parent
commit
7f5c0f5531
  1. 4
      bin/node/server.go
  2. 4
      bin/web/server.go

4
bin/node/server.go

@ -17,7 +17,7 @@ import (
)
var (
level = flag.Int("l", -2, "log level, -1:debug, -2:info, -3:warn, -4:error")
level = flag.Int("l", 0, "log level, -1:debug, 0:info, 1:warn, 2:error")
)
func main() {
@ -26,7 +26,7 @@ func main() {
lcf := zap.NewDevelopmentConfig()
lcf.Level.SetLevel(zapcore.Level(*level))
lcf.Development = false
logger, err := lcf.Build()
logger, err := lcf.Build(zap.AddCallerSkip(1))
if err != nil {
slog.Fatalln("new log err:", err.Error())
}

4
bin/web/server.go

@ -18,7 +18,7 @@ import (
)
var (
level = flag.Int("l", -2, "log level, -1:debug, -2:info, -3:warn, -4:error")
level = flag.Int("l", 0, "log level, -1:debug, 0:info, 1:warn, 2:error")
)
func main() {
@ -27,7 +27,7 @@ func main() {
lcf := zap.NewDevelopmentConfig()
lcf.Level.SetLevel(zapcore.Level(*level))
lcf.Development = false
logger, err := lcf.Build()
logger, err := lcf.Build(zap.AddCallerSkip(1))
if err != nil {
slog.Fatalln("new log err:", err.Error())
}

Loading…
Cancel
Save