MCPcopy Create free account
hub / github.com/flant/shell-operator / lazydebug

Method lazydebug

pkg/task/queue/task_queue.go:750–754  ·  view source on GitHub ↗

lazydebug evaluates args only if debug log is enabled. It is used to avoid unnecessary allocations when logging is disabled. Queue MUST remain fast and not allocate memory when logging is disabled.

(msg string, argsFn func() []any)

Source from the content-addressed store, hash-verified

748// It is used to avoid unnecessary allocations when logging is disabled.
749// Queue MUST remain fast and not allocate memory when logging is disabled.
750func (q *TaskQueue) lazydebug(msg string, argsFn func() []any) {
751 if q.logger != nil && q.logger.Enabled(context.Background(), slog.LevelDebug) {
752 q.logger.Debug(msg, argsFn()...)
753 }
754}
755
756func (q *TaskQueue) Start(ctx context.Context) {
757 if q.started.Load() {

Callers 2

AddLastMethod · 0.95
processOneMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected