kpt icon indicating copy to clipboard operation
kpt copied to clipboard

Provide better logging utility in Functions SDK/libraries

Open frankfarzan opened this issue 5 years ago • 1 comments

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:

  1. Introduce logger utilities in the libraries as the recommended approach to debug logging
  2. 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

frankfarzan avatar Sep 23 '20 22:09 frankfarzan

@mengqiy feature to keep in mind for when you get to the SDK part of the function work.

mikebz avatar Dec 11 '20 00:12 mikebz