Skip to content

Commit

Permalink
fix log appid
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhao committed Apr 11, 2019
1 parent dbdfe47 commit 82f27d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
go.sum
tool/kratos/kratos
8 changes: 4 additions & 4 deletions pkg/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

// Config log config.
type Config struct {
Family string
Host string
AppID string
Host string

// stdout
Stdout bool
Expand Down Expand Up @@ -94,8 +94,8 @@ func Init(conf *Config) {
Filter: _filter,
}
}
if len(env.AppID) != 0 {
conf.Family = env.AppID // for caster
if conf.AppID == "" && len(env.AppID) != 0 {
conf.AppID = env.AppID
}
conf.Host = env.Hostname
if len(conf.Host) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/log/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func addExtraField(ctx context.Context, fields map[string]interface{}) {
}
fields[_deplyEnv] = env.DeployEnv
fields[_zone] = env.Zone
fields[_appID] = c.Family
fields[_appID] = c.AppID
fields[_instanceID] = c.Host
if metadata.Bool(ctx, metadata.Mirror) {
fields[_mirror] = true
Expand Down

0 comments on commit 82f27d7

Please sign in to comment.