kpt
kpt copied to clipboard
Provide better logging utility in Functions SDK/libraries
A problem that function developers run into: Emitting a debug log message to stdout. Because stdout is used for machine-to-machine protocol [1], it leads to cryptic failures from kpt fn. In Typescript, we actually override console.log to write to stderr, but we need a more uniform solution across different languages.
Consider:
- Introduce logger utilities in the libraries as the recommended approach to debug logging
- Improve the error message when the developer accidentally writes to stdout when do they don't use the logging utility provided.
[1] https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md
@mengqiy feature to keep in mind for when you get to the SDK part of the function work.