1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-26 03:52:12 +02:00

fix log appid

This commit is contained in:
felixhao 2019-04-11 17:30:53 +08:00
parent dbdfe47e5b
commit 82f27d7c15
3 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
go.sum go.sum
tool/kratos/kratos

View File

@ -13,8 +13,8 @@ import (
// Config log config. // Config log config.
type Config struct { type Config struct {
Family string AppID string
Host string Host string
// stdout // stdout
Stdout bool Stdout bool
@ -94,8 +94,8 @@ func Init(conf *Config) {
Filter: _filter, Filter: _filter,
} }
} }
if len(env.AppID) != 0 { if conf.AppID == "" && len(env.AppID) != 0 {
conf.Family = env.AppID // for caster conf.AppID = env.AppID
} }
conf.Host = env.Hostname conf.Host = env.Hostname
if len(conf.Host) == 0 { if len(conf.Host) == 0 {

View File

@ -30,7 +30,7 @@ func addExtraField(ctx context.Context, fields map[string]interface{}) {
} }
fields[_deplyEnv] = env.DeployEnv fields[_deplyEnv] = env.DeployEnv
fields[_zone] = env.Zone fields[_zone] = env.Zone
fields[_appID] = c.Family fields[_appID] = c.AppID
fields[_instanceID] = c.Host fields[_instanceID] = c.Host
if metadata.Bool(ctx, metadata.Mirror) { if metadata.Bool(ctx, metadata.Mirror) {
fields[_mirror] = true fields[_mirror] = true