Commit 3511376c authored by yangjianbo's avatar yangjianbo
Browse files

chore(logging): 默认使用 console 普通日志输出

- 将配置默认 log.format 从 json 调整为 console\n- 将 logger 初始化兜底默认格式调整为 console\n- 同步更新 deploy 配置示例
parent 584cfc3d
...@@ -866,7 +866,7 @@ func setDefaults() { ...@@ -866,7 +866,7 @@ func setDefaults() {
// Log // Log
viper.SetDefault("log.level", "info") viper.SetDefault("log.level", "info")
viper.SetDefault("log.format", "json") viper.SetDefault("log.format", "console")
viper.SetDefault("log.service_name", "sub2api") viper.SetDefault("log.service_name", "sub2api")
viper.SetDefault("log.env", "production") viper.SetDefault("log.env", "production")
viper.SetDefault("log.caller", true) viper.SetDefault("log.caller", true)
......
...@@ -53,7 +53,7 @@ func (o InitOptions) normalized() InitOptions { ...@@ -53,7 +53,7 @@ func (o InitOptions) normalized() InitOptions {
} }
out.Format = strings.ToLower(strings.TrimSpace(out.Format)) out.Format = strings.ToLower(strings.TrimSpace(out.Format))
if out.Format == "" { if out.Format == "" {
out.Format = "json" out.Format = "console"
} }
out.ServiceName = strings.TrimSpace(out.ServiceName) out.ServiceName = strings.TrimSpace(out.ServiceName)
if out.ServiceName == "" { if out.ServiceName == "" {
......
...@@ -296,7 +296,7 @@ log: ...@@ -296,7 +296,7 @@ log:
level: "info" level: "info"
# Log format: json/console # Log format: json/console
# 日志格式:json/console # 日志格式:json/console
format: "json" format: "console"
# Service name field written into each log line # Service name field written into each log line
# 每条日志都会附带 service 字段 # 每条日志都会附带 service 字段
service_name: "sub2api" service_name: "sub2api"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment