Address review comments a.d. logging.

This commit is contained in:
Piotr Tabor
2021-04-15 17:54:37 +02:00
parent fad6391745
commit b47c5fcc12
3 changed files with 19 additions and 6 deletions

View File

@@ -57,8 +57,9 @@ func startEtcdOrProxyV2(args []string) {
err := cfg.parse(args[1:])
lg := cfg.ec.GetLogger()
cfg.ec.SetupGlobalLoggers()
// If we failed to parse the whole configuration, print the error using
// preferably the resolved logger from the config,
// but if does not exists, create a new temporary logger.
if lg == nil {
var zapError error
// use this logger
@@ -78,6 +79,8 @@ func startEtcdOrProxyV2(args []string) {
os.Exit(1)
}
cfg.ec.SetupGlobalLoggers()
defer func() {
logger := cfg.ec.GetLogger()
if logger != nil {