MCPcopy
hub / github.com/kubernetes-sigs/kwok / FromContext

Function FromContext

pkg/log/logger.go:47–52  ·  view source on GitHub ↗

FromContext returns the Logger associated with ctx, or the default logger.

(ctx context.Context)

Source from the content-addressed store, hash-verified

45
46// FromContext returns the Logger associated with ctx, or the default logger.
47func FromContext(ctx context.Context) *Logger {
48 if l, ok := ctx.Value(contextKey{}).(*Logger); ok {
49 return l
50 }
51 return wrapSlog(slog.Default().Handler(), LevelInfo)
52}
53
54// NewContext returns a new context with the given logger.
55func NewContext(ctx context.Context, logger *Logger) context.Context {

Callers 15

manageMethod · 0.92
deleteResourceMethod · 0.92
preprocessWorkerMethod · 0.92
preprocessMethod · 0.92
playStageWorkerMethod · 0.92
playStageMethod · 0.92
applyResourceMethod · 0.92
patchResourceMethod · 0.92
watchResourcesMethod · 0.92
recyclingPodIPMethod · 0.92
markPodIPMethod · 0.92
addStageJobMethod · 0.92

Calls 2

wrapSlogFunction · 0.85
ValueMethod · 0.45

Tested by 1

TestMainFunction · 0.74