github.com/cilium/cilium@v1.16.2/operator/auth/spire/log_wrapper.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package spire 5 6 import "github.com/sirupsen/logrus" 7 8 // spiffeLogWrapper is a log wrapper for the SPIRE client logs 9 // the log levels of this library do not match those from Cilium 10 // this will be used to convert the log levels. 11 type spiffeLogWrapper struct { 12 log logrus.FieldLogger 13 } 14 15 // newSpiffeLogWrapper returns a new spiffeLogWrapper 16 func newSpiffeLogWrapper(log logrus.FieldLogger) *spiffeLogWrapper { 17 return &spiffeLogWrapper{ 18 log: log, 19 } 20 } 21 22 // Debugf logs a debug message 23 func (l *spiffeLogWrapper) Debugf(format string, args ...interface{}) { 24 l.log.Debugf(format, args...) 25 } 26 27 // Infof logs an info message 28 func (l *spiffeLogWrapper) Infof(format string, args ...interface{}) { 29 l.log.Infof(format, args...) 30 } 31 32 // Warnf logs a warning message 33 func (l *spiffeLogWrapper) Warnf(format string, args ...interface{}) { 34 l.log.Warnf(format, args...) 35 } 36 37 // Errorf logs an error message downgraded to a warning as in our case 38 // a connection error on startups is expected on initial start of the oprator 39 // while the SPIRE server is still starting up. Any errors given by spire will 40 // result in an error passed back to the function caller which then is logged 41 // as an error. 42 func (l *spiffeLogWrapper) Errorf(format string, args ...interface{}) { 43 l.log.Warnf(format, args...) 44 }