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)
| 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 |
| 47 | func (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 |
| 63 | type writerConstructor interface { |
no test coverage detected