MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / executeGetLogRequest

Function executeGetLogRequest

pkg/podlogs/writer.go:121–139  ·  view source on GitHub ↗
(ctx context.Context, logRequest *rest.Request, writer io.Writer)

Source from the content-addressed store, hash-verified

119}
120
121func executeGetLogRequest(ctx context.Context, logRequest *rest.Request, writer io.Writer) error {
122 logStream, err := logRequest.Stream(ctx)
123 if err != nil {
124 return fmt.Errorf("when opening the log stream: %w", err)
125 }
126 defer func() {
127 innerErr := logStream.Close()
128 if err == nil && innerErr != nil {
129 err = fmt.Errorf("when closing the log stream: %w", innerErr)
130 }
131 }()
132
133 _, err = io.Copy(writer, logStream)
134 if err != nil {
135 return fmt.Errorf("when copying the log stream to the writer: %w", err)
136 }
137 _, _ = writer.Write([]byte("\n"))
138 return nil
139}

Callers 1

sendLogsToWriterMethod · 0.85

Calls 2

CloseMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected