diff options
author | 2020-10-30 17:06:04 +0100 | |
---|---|---|
committer | 2020-11-05 13:53:05 +0100 | |
commit | 5fe9e1b7c43fc1a34b38899a2a055540cc30ac81 (patch) | |
tree | 5a83d0219fa03f0d280db61ed44f64d377a04138 /certServiceK8sExternalProvider/src/cmpv2controller/logger/certificate_request_logger.go | |
parent | 15446c2ccfc117a0feb5a5249c2e62714b2cd3d7 (diff) |
[OOM-K8S-CERT-EXTERNAL-PROVIDER] Change logger implementation provider
Issue-ID: OOM-2559
Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Change-Id: I717dfcfd74a01ccb81b2eb03c52be2c90fc3a9c5
Diffstat (limited to 'certServiceK8sExternalProvider/src/cmpv2controller/logger/certificate_request_logger.go')
-rw-r--r-- | certServiceK8sExternalProvider/src/cmpv2controller/logger/certificate_request_logger.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/certServiceK8sExternalProvider/src/cmpv2controller/logger/certificate_request_logger.go b/certServiceK8sExternalProvider/src/cmpv2controller/logger/certificate_request_logger.go index 0aaf48d3..786557c1 100644 --- a/certServiceK8sExternalProvider/src/cmpv2controller/logger/certificate_request_logger.go +++ b/certServiceK8sExternalProvider/src/cmpv2controller/logger/certificate_request_logger.go @@ -26,8 +26,8 @@ import ( "net/url" "strconv" - "github.com/go-logr/logr" cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1" + "onap.org/oom-certservice/k8s-external-provider/src/leveledlogger" ) const ( @@ -35,13 +35,13 @@ const ( CMPv2ServerName = "CMPv2 Server" ) -func LogCertRequestProperties(log logr.Logger, request *cmapi.CertificateRequest, csr *x509.CertificateRequest) { +func LogCertRequestProperties(log leveledlogger.Logger, request *cmapi.CertificateRequest, csr *x509.CertificateRequest) { logSupportedProperties(log, request, csr) logPropertiesNotSupportedByCertService(log, request, csr) logPropertiesOverriddenByCMPv2Server(log, request) } -func logSupportedProperties(log logr.Logger, request *cmapi.CertificateRequest, csr *x509.CertificateRequest) { +func logSupportedProperties(log leveledlogger.Logger, request *cmapi.CertificateRequest, csr *x509.CertificateRequest) { logSupportedProperty(log, csr.Subject.Organization, "organization") logSupportedProperty(log, csr.Subject.OrganizationalUnit, "organization unit") logSupportedProperty(log, csr.Subject.Country, "country") @@ -50,13 +50,13 @@ func logSupportedProperties(log logr.Logger, request *cmapi.CertificateRequest, logSupportedProperty(log, csr.DNSNames, "dns names") } -func logSupportedProperty(log logr.Logger, values []string, propertyName string) { +func logSupportedProperty(log leveledlogger.Logger, values []string, propertyName string) { if len(values) > 0 { log.Info(getSupportedMessage(propertyName, extractStringArray(values))) } } -func logPropertiesOverriddenByCMPv2Server(log logr.Logger, request *cmapi.CertificateRequest) { +func logPropertiesOverriddenByCMPv2Server(log leveledlogger.Logger, request *cmapi.CertificateRequest) { if request.Spec.Duration != nil && len(request.Spec.Duration.String()) > 0 { log.Info(getOverriddenMessage("duration", request.Spec.Duration.Duration.String())) } @@ -73,36 +73,36 @@ func extractUsages(usages []cmapi.KeyUsage) string { return values } -func logPropertiesNotSupportedByCertService(log logr.Logger, request *cmapi.CertificateRequest, csr *x509.CertificateRequest) { +func logPropertiesNotSupportedByCertService(log leveledlogger.Logger, request *cmapi.CertificateRequest, csr *x509.CertificateRequest) { //IP addresses in SANs if len(csr.IPAddresses) > 0 { - log.Info(getNotSupportedMessage("ipAddresses", extractIPAddresses(csr.IPAddresses))) + log.Warning(getNotSupportedMessage("ipAddresses", extractIPAddresses(csr.IPAddresses))) } //URIs in SANs if len(csr.URIs) > 0 { - log.Info(getNotSupportedMessage("uris", extractURIs(csr.URIs))) + log.Warning(getNotSupportedMessage("uris", extractURIs(csr.URIs))) } //Email addresses in SANs if len(csr.EmailAddresses) > 0 { - log.Info(getNotSupportedMessage("emailAddresses", extractStringArray(csr.EmailAddresses))) + log.Warning(getNotSupportedMessage("emailAddresses", extractStringArray(csr.EmailAddresses))) } if request.Spec.IsCA == true { - log.Info(getNotSupportedMessage("isCA", strconv.FormatBool(request.Spec.IsCA))) + log.Warning(getNotSupportedMessage("isCA", strconv.FormatBool(request.Spec.IsCA))) } if len(csr.Subject.StreetAddress) > 0 { - log.Info(getNotSupportedMessage("subject.streetAddress", extractStringArray(csr.Subject.StreetAddress))) + log.Warning(getNotSupportedMessage("subject.streetAddress", extractStringArray(csr.Subject.StreetAddress))) } if len(csr.Subject.PostalCode) > 0 { - log.Info(getNotSupportedMessage("subject.postalCodes", extractStringArray(csr.Subject.PostalCode))) + log.Warning(getNotSupportedMessage("subject.postalCodes", extractStringArray(csr.Subject.PostalCode))) } if len(csr.Subject.SerialNumber) > 0 { - log.Info(getNotSupportedMessage("subject.serialNumber", csr.Subject.SerialNumber)) + log.Warning(getNotSupportedMessage("subject.serialNumber", csr.Subject.SerialNumber)) } } |