Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
urionz committed Apr 22, 2021
1 parent 9c8f9b1 commit 189c513
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ func (logger *Logger) newZapLogger(level zapcore.Level) *zap.Logger {

output := path.Join(logger.app.Storage(), logger.conf.String("logger.output_path", "logs"))

absOutput := logger.conf.String("logger.output_path_abs")

if absOutput != "" {
output = absOutput
}

if logger.conf.String("app.env", "production") == "production" {
conf.EncodeLevel = zapcore.CapitalLevelEncoder
encoder = zapcore.NewJSONEncoder(conf)
Expand Down
2 changes: 1 addition & 1 deletion log/service_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func init() {
# 日志配置
[logger]
# 是否开启日志输出
log.output_enable = true
output_enable = true
# 日志等级 debug|info|warn|error|panic|fatal
level = "debug"
# 时间格式
Expand Down
2 changes: 1 addition & 1 deletion web/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func makeAccessLog(root string, conf contracts.Config) *accesslog.AccessLog {
}
})
if conf.String("app.env", "production") == "production" {
ac.SetFormatter(&accesslog.JSON{Indent: " "})
ac.SetFormatter(&accesslog.JSON{})
}

return ac
Expand Down

0 comments on commit 189c513

Please sign in to comment.