remove the global log error/warn etc functions (#41404)

* remove the global log error/warn etc functions and use request context logger whenever possible
This commit is contained in:
ying-jeanne
2021-11-08 17:56:56 +01:00
committed by GitHub
parent bda60f3458
commit 54de1078c8
28 changed files with 88 additions and 93 deletions

View File

@@ -41,6 +41,8 @@ type exitWithCode struct {
var serverFs = flag.NewFlagSet("server", flag.ContinueOnError)
var clilog = log.New("cli")
func (e exitWithCode) Error() string {
return e.reason
}
@@ -133,7 +135,7 @@ func executeServer(configFile, homePath, pidFile, packaging string, traceDiagnos
}
defer func() {
if err := f.Close(); err != nil {
log.Error("Failed to write trace diagnostics", "path", traceDiagnostics.file, "err", err)
clilog.Error("Failed to write trace diagnostics", "path", traceDiagnostics.file, "err", err)
}
}()