fix log appid

pull/13/head
felixhao 6 years ago
parent dbdfe47e5b
commit 82f27d7c15
  1. 1
      .gitignore
  2. 8
      pkg/log/log.go
  3. 2
      pkg/log/util.go

1
.gitignore vendored

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

@ -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 {

@ -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

Loading…
Cancel
Save