Skip to content

Commit

Permalink
fix null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
SabaPing committed Jun 15, 2021
1 parent 6c76acc commit 6062f29
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions util/logutil/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func initGRPCLogger(cfg *LogConfig) error {
}

func deepcopyLogConfig(o *log.Config) *log.Config {
return &log.Config{
c := &log.Config{
Level: o.Level,
Format: o.Format,
DisableTimestamp: o.DisableTimestamp,
Expand All @@ -156,12 +156,15 @@ func deepcopyLogConfig(o *log.Config) *log.Config {
DisableCaller: o.DisableCaller,
DisableStacktrace: o.DisableStacktrace,
DisableErrorVerbose: o.DisableErrorVerbose,
Sampling: &zap.SamplingConfig{
}
if o.Sampling != nil {
c.Sampling = &zap.SamplingConfig{
Initial: o.Sampling.Initial,
Thereafter: o.Sampling.Thereafter,
Hook: o.Sampling.Hook,
},
}
}
return c
}

// InitZapLogger is delegated to InitLogger.
Expand Down

0 comments on commit 6062f29

Please sign in to comment.