MCPcopy Create free account
hub / github.com/devspace-sh/devspace / Logs

Method Logs

pkg/devspace/kubectl/logs.go:27–44  ·  view source on GitHub ↗

Logs prints the container logs

(ctx context.Context, namespace, podName, containerName string, lastContainerLog bool, tail *int64, follow bool)

Source from the content-addressed store, hash-verified

25
26// Logs prints the container logs
27func (client *client) Logs(ctx context.Context, namespace, podName, containerName string, lastContainerLog bool, tail *int64, follow bool) (io.ReadCloser, error) {
28 lines := int64(500)
29 if tail != nil {
30 lines = *tail
31 }
32
33 request := client.KubeClient().CoreV1().RESTClient().Get().Namespace(namespace).Name(podName).Resource("pods").SubResource("log").VersionedParams(&v1.PodLogOptions{
34 Container: containerName,
35 TailLines: &lines,
36 Previous: lastContainerLog,
37 Follow: follow,
38 }, scheme.ParameterCodec)
39 if request.URL().String() == "" {
40 return nil, errors.New("Request url is empty")
41 }
42
43 return request.Stream(ctx)
44}

Callers 1

ReadLogsMethod · 0.95

Calls 5

KubeClientMethod · 0.95
NameMethod · 0.65
NamespaceMethod · 0.65
GetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected