From 3d124564933dc9a7b1de952c5e46a50f92752039 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 11 Aug 2020 17:05:14 +0530 Subject: [PATCH] util: add WarningLog to log with context added WarningLog to log with context Signed-off-by: Madhu Rajanna --- internal/util/log.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/util/log.go b/internal/util/log.go index 2a89a6155..471955fc0 100644 --- a/internal/util/log.go +++ b/internal/util/log.go @@ -76,6 +76,12 @@ func WarningLogMsg(message string, args ...interface{}) { 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. func DefaultLog(message string, args ...interface{}) { logMessage := fmt.Sprintf(message, args...)