util: add WarningLog to log with context

added WarningLog to log with context

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-08-11 17:05:14 +05:30 committed by mergify[bot]
parent b223924044
commit 3d12456493

View File

@ -76,6 +76,12 @@ func WarningLogMsg(message string, args ...interface{}) {
klog.WarningDepth(1, logMessage) klog.WarningDepth(1, logMessage)
} }
// WarningLog helps in logging warnings with context.
func WarningLog(ctx context.Context, message string, args ...interface{}) {
logMessage := fmt.Sprintf(Log(ctx, message), args...)
klog.WarningDepth(1, logMessage)
}
// DefaultLog helps in logging with klog.level 1. // DefaultLog helps in logging with klog.level 1.
func DefaultLog(message string, args ...interface{}) { func DefaultLog(message string, args ...interface{}) {
logMessage := fmt.Sprintf(message, args...) logMessage := fmt.Sprintf(message, args...)