MCPcopy Index your code
hub / github.com/coder/coder / logWriter

Function logWriter

provisioner/terraform/executor.go:603–608  ·  view source on GitHub ↗

logWriter creates a WriteCloser that will log each line of text at the given level. The WriteCloser must be closed by the caller to end logging, after which the returned channel will be closed to indicate that logging of the written data has finished. Failure to close the WriteCloser will leak a g

(sink logSink, level proto.LogLevel)

Source from the content-addressed store, hash-verified

601// by the caller to end logging, after which the returned channel will be closed to indicate that logging of the written
602// data has finished. Failure to close the WriteCloser will leak a goroutine.
603func logWriter(sink logSink, level proto.LogLevel) (io.WriteCloser, <-chan any) {
604 r, w := io.Pipe()
605 done := make(chan any)
606 go readAndLog(sink, r, done, level)
607 return w, done
608}
609
610func readAndLog(sink logSink, r io.Reader, done chan<- any, level proto.LogLevel) {
611 defer close(done)

Callers 5

initMethod · 0.70
planMethod · 0.70
logDriftMethod · 0.70
applyMethod · 0.70
TestLogWriter_MainlineFunction · 0.70

Calls 1

readAndLogFunction · 0.85

Tested by 1

TestLogWriter_MainlineFunction · 0.56