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

Method Single

pkg/podlogs/writer.go:47–60  ·  view source on GitHub ↗

Single streams the pod logs and shunts them to the `writer`. If there are multiple containers, it will concatenate all the container streams into the writer

(ctx context.Context, writer io.Writer, opts *corev1.PodLogOptions)

Source from the content-addressed store, hash-verified

45// Single streams the pod logs and shunts them to the `writer`.
46// If there are multiple containers, it will concatenate all the container streams into the writer
47func (spl *Writer) Single(ctx context.Context, writer io.Writer, opts *corev1.PodLogOptions) (err error) {
48 if opts.Container != "" {
49 return spl.sendLogsToWriter(ctx, writer, opts)
50 }
51
52 for _, container := range spl.Pod.Spec.Containers {
53 containerOpts := opts.DeepCopy()
54 containerOpts.Container = container.Name
55 if err := spl.sendLogsToWriter(ctx, writer, containerOpts); err != nil {
56 return err
57 }
58 }
59 return nil
60}
61
62// writerConstructor is the interface representing an object that can spawn writers
63type writerConstructor interface {

Callers 2

writer_test.goFile · 0.80
streamOperatorLogsToZipFunction · 0.80

Calls 2

sendLogsToWriterMethod · 0.95
DeepCopyMethod · 0.45

Tested by

no test coverage detected