mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-03 11:45:45 +00:00
Use the new plog pkg in auth_handler.go
- Add a new helper method to plog to make a consistent way to log expected errors at the info level (as opposed to unexpected system errors that would be logged using plog.Error) Signed-off-by: Ryan Richard <richardry@vmware.com>
This commit is contained in:
committed by
Ryan Richard
parent
b9726615dd
commit
005225d5f9
@@ -5,6 +5,7 @@ package plog
|
||||
|
||||
import "k8s.io/klog/v2"
|
||||
|
||||
// Use Error to log an unexpected system error.
|
||||
func Error(err error, msg string, keysAndValues ...interface{}) {
|
||||
klog.ErrorS(err, msg, keysAndValues...)
|
||||
}
|
||||
@@ -22,6 +23,11 @@ func Info(msg string, keysAndValues ...interface{}) {
|
||||
klog.V(klogLevelInfo).InfoS(msg, keysAndValues...)
|
||||
}
|
||||
|
||||
// Use InfoErr to log an expected error, e.g. validation failure of an http parameter.
|
||||
func InfoErr(msg string, err error, keysAndValues ...interface{}) {
|
||||
klog.V(klogLevelInfo).InfoS(msg, append([]interface{}{"error", err}, keysAndValues)...)
|
||||
}
|
||||
|
||||
func Debug(msg string, keysAndValues ...interface{}) {
|
||||
klog.V(klogLevelDebug).InfoS(msg, keysAndValues...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user