terraform/internal/logging
James Bardin feb7622846 monitor plugin std outputs for unexpected data
Once a plugin process is started, go-plugin will redirect the stdout and
stderr stream through a grpc service and provide those streams to the
client. This is rarely used, as it is prone to failing with races
because those same file descriptors are needed for the initial handshake
and logging setup, but data may be accidentally sent to these
nonetheless.

The usual culprits are stray `fmt.Print` usage where logging was
intended, or the configuration of a logger after the os.Stderr file
descriptor was replaced by go-plugin. These situations are very hard for
provider developers to debug since the data is discarded entirely.

While there may be improvements to be made in the go-plugin package to
configure this behavior, in the meantime we can add a simple monitoring
io.Writer to the streams which will surface th data as warnings in the
logs instead of writing it to `io.Discard`
2021-05-13 16:57:36 -04:00
..
indent.go move helper/logging to internal 2020-10-19 14:27:53 -04:00
indent_test.go move helper/logging to internal 2020-10-19 14:27:53 -04:00
logging.go monitor plugin std outputs for unexpected data 2021-05-13 16:57:36 -04:00
panic.go hide provider crashes from panicwrap when logging 2020-11-05 10:54:21 -05:00
panic_test.go hide provider crashes from panicwrap when logging 2020-11-05 10:54:21 -05:00