Skip to content

Commit b28af58

Browse files
committed
try new log level scheme
1 parent c09bc38 commit b28af58

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pkg/ansible/events/log_events.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (l loggingEventHandler) Handle(ident string, u *unstructured.Unstructured,
7070
return
7171
}
7272
if e.Event == eventapi.EventRunnerOnOk && debugAction {
73-
logger.Info("[playbook debug]", "EventData.TaskArgs", e.EventData["task_args"])
73+
logger.V(logutil.VDebug).Info("[playbook debug]", "EventData.TaskArgs", e.EventData["task_args"])
7474
return
7575
}
7676
if e.Event == eventapi.EventRunnerOnFailed {

pkg/logutil/log_util.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ import (
2222
// Usage: log.V(LogVerbosity).Info(...)
2323
type LogVerbosity = int
2424

25+
// The default log verbosity, given to the most important log statements,
26+
// is 0: log.V(0).Info(...) == log.Info(...)
27+
//
28+
// HACK: zapr doesn't calculate log levels correctly, so we must set log
29+
// level integers incorrectly (according to logr) for now so they map to zapr's.
2530
const (
26-
// Default of 0. log.V(0).Info(...) == log.Info(...)
27-
_ LogVerbosity = iota
31+
// VDebug == -1. log.V(VDebug).Info(...) == log.Debug(...)
32+
VDebug LogVerbosity = iota - 1
33+
_
2834
// VWarn == 1. log.V(VWarn).Info(...) == log.Warn(...)
2935
VWarn
30-
// VDebug == 2. log.V(VDebug).Info(...) == log.Debug(...)
31-
VDebug
3236
)
3337

3438
// SDKLog is the parent logger for logs generated by operator code.

0 commit comments

Comments
 (0)