ReadLogs reads the logs and returns a string
(ctx context.Context, namespace, podName, containerName string, lastContainerLog bool, tail *int64)
| 10 | |
| 11 | // ReadLogs reads the logs and returns a string |
| 12 | func (client *client) ReadLogs(ctx context.Context, namespace, podName, containerName string, lastContainerLog bool, tail *int64) (string, error) { |
| 13 | readCloser, err := client.Logs(ctx, namespace, podName, containerName, lastContainerLog, tail, false) |
| 14 | if err != nil { |
| 15 | return "", err |
| 16 | } |
| 17 | |
| 18 | logs, err := io.ReadAll(readCloser) |
| 19 | if err != nil { |
| 20 | return "", err |
| 21 | } |
| 22 | |
| 23 | return string(logs), nil |
| 24 | } |
| 25 | |
| 26 | // Logs prints the container logs |
| 27 | func (client *client) Logs(ctx context.Context, namespace, podName, containerName string, lastContainerLog bool, tail *int64, follow bool) (io.ReadCloser, error) { |