Summary
Three helpers each handle nil-logger differently:
platform/data/addDataToContext.go:28-31 — falls back to slog.Default(), carries a live // TODO: remove or use logger more effectively.
platform/data/loadInputData.go:16-18 — falls back to slog.Default() silently.
internal/helpers/logger.go (SetupLogger) — creates a default text handler over stdout/stderr and logs a warning that the handler was nil.
A library should not write to stderr unless the consumer asks for it. Pick one strategy ("nil = use a discard handler") and apply it everywhere.
Also clean up
While we're in the area, two more TODOs in non-test code:
engines/extism/compiler/compiler.go:54 — // TODO: Some error paths are difficult to test with the current design
engines/extism/evaluator/evaluator.go:133 — // TODO: Some error paths in this method are hard to test with the current design
Resolve them by either making the code testable (probably mocking the Extism SDK plugin / instance) or by removing the TODOs once we're satisfied with coverage. The output-on-non-zero-exit TODO at engines/extism/evaluator/evaluator.go:80 is tracked separately in #94.
Files
internal/helpers/logger.go
platform/data/addDataToContext.go
platform/data/loadInputData.go
engines/extism/compiler/compiler.go
engines/extism/evaluator/evaluator.go
Summary
Three helpers each handle nil-logger differently:
platform/data/addDataToContext.go:28-31— falls back toslog.Default(), carries a live// TODO: remove or use logger more effectively.platform/data/loadInputData.go:16-18— falls back toslog.Default()silently.internal/helpers/logger.go(SetupLogger) — creates a default text handler over stdout/stderr and logs a warning that the handler was nil.A library should not write to stderr unless the consumer asks for it. Pick one strategy ("nil = use a discard handler") and apply it everywhere.
Also clean up
While we're in the area, two more TODOs in non-test code:
engines/extism/compiler/compiler.go:54—// TODO: Some error paths are difficult to test with the current designengines/extism/evaluator/evaluator.go:133—// TODO: Some error paths in this method are hard to test with the current designResolve them by either making the code testable (probably mocking the Extism SDK plugin / instance) or by removing the TODOs once we're satisfied with coverage. The output-on-non-zero-exit TODO at
engines/extism/evaluator/evaluator.go:80is tracked separately in #94.Files
internal/helpers/logger.goplatform/data/addDataToContext.goplatform/data/loadInputData.goengines/extism/compiler/compiler.goengines/extism/evaluator/evaluator.go