Migrate to structured logging (klog)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-09-27 17:32:40 -03:00
parent 93ac8d5a21
commit 108637bb1c
31 changed files with 161 additions and 171 deletions

View file

@ -187,7 +187,7 @@ https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-g
flag.CommandLine.Parse([]string{})
pflag.VisitAll(func(flag *pflag.Flag) {
klog.V(2).Infof("FLAG: --%s=%q", flag.Name, flag.Value)
klog.V(2).InfoS("FLAG", flag.Name, flag.Value)
})
if *showVersion {
@ -202,12 +202,12 @@ https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-g
}
if *ingressClass != "" {
klog.Infof("Watching for Ingress class: %s", *ingressClass)
klog.InfoS("Watching for Ingress", "class", *ingressClass)
if *ingressClass != class.DefaultClass {
klog.Warningf("Only Ingresses with class %q will be processed by this Ingress controller", *ingressClass)
} else {
klog.Warning("Ingresses with an empty class will also be processed by this Ingress controller", *ingressClass)
klog.Warning("Ingresses with an empty class will also be processed by this Ingress controller")
}
class.IngressClass = *ingressClass
@ -248,10 +248,6 @@ https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-g
return false, nil, fmt.Errorf("port %v is already in use. Please check the flag --ssl-passthrough-proxy-port", *sslProxyPort)
}
if !*enableSSLChainCompletion {
klog.Warningf("SSL certificate chain completion is disabled (--enable-ssl-chain-completion=false)")
}
if *publishSvc != "" && *publishStatusAddress != "" {
return false, nil, fmt.Errorf("flags --publish-service and --publish-status-address are mutually exclusive")
}
@ -307,9 +303,9 @@ https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-g
if err := nginx.ValidateGeoLite2DBEditions(); err != nil {
return false, nil, err
}
klog.Info("downloading maxmind GeoIP2 databases...")
klog.InfoS("downloading maxmind GeoIP2 databases")
if err := nginx.DownloadGeoLite2DB(); err != nil {
klog.Errorf("unexpected error downloading GeoIP2 database: %v", err)
klog.ErrorS(err, "unexpected error downloading GeoIP2 database")
}
config.MaxmindEditionFiles = nginx.MaxmindEditionFiles
}