MCPcopy
hub / github.com/argoproj/argo-workflows / RequireLoggerFromContext

Function RequireLoggerFromContext

util/logging/logging.go:173–187  ·  view source on GitHub ↗

RequireLoggerFromContext returns a logger from context, panics if not found This should be used almost

(ctx context.Context)

Source from the content-addressed store, hash-verified

171// RequireLoggerFromContext returns a logger from context, panics if not found
172// This should be used almost
173func RequireLoggerFromContext(ctx context.Context) Logger {
174 val := getLoggerFromContext(ctx)
175 if val == nil {
176 const size = 64 << 10
177 stackTraceBuffer := make([]byte, size)
178 stackSize := runtime.Stack(stackTraceBuffer, false)
179 // Free up the unused spaces
180 stackTraceBuffer = stackTraceBuffer[:stackSize]
181 fmt.Fprintf(os.Stderr, "no logger in context Call stack:\n%s",
182 stackTraceBuffer)
183
184 panic("logger not found in context")
185 }
186 return val
187}
188
189// GetLoggerFromContextOrNil returns a logger from context, returns nil if not found
190// You probably should use one of the other functions that return a logger instead of this one

Callers 15

newContextFunction · 0.92
EventStreamReaderMethod · 0.92
doMethod · 0.92
RecvEventMethod · 0.92
GetPluginNamesMethod · 0.92
SetMethod · 0.92
DeleteMethod · 0.92
IsPartOfExitHandlerMethod · 0.92
mainFunction · 0.92
streamMethod · 0.92
NewPersistenceFunction · 0.92
NewEmissaryCommandFunction · 0.92

Calls 1

getLoggerFromContextFunction · 0.85

Tested by 15

streamMethod · 0.74
interceptFunction · 0.74
newServerFunction · 0.74
TestGetTemplateByNameFunction · 0.74
TestGetTemplateFromRefFunction · 0.74
TestGetTemplateFunction · 0.74
TestWithTemplateHolderFunction · 0.74
TestResolveTemplateFunction · 0.74
TestWithTemplateBaseFunction · 0.74
TestOnWorkflowTemplateFunction · 0.74