MCPcopy
hub / github.com/derailed/k9s / showLogs

Method showLogs

internal/view/xray.go:315–338  ·  view source on GitHub ↗
(spec *xray.NodeSpec, prev bool)

Source from the content-addressed store, hash-verified

313}
314
315func (x *Xray) showLogs(spec *xray.NodeSpec, prev bool) {
316 // Need to load and wait for pods
317 path, co := spec.Path(), ""
318 if spec.GVR() == client.CoGVR {
319 _, coName := client.Namespaced(spec.Path())
320 path, co = *spec.ParentPath(), coName
321 }
322
323 ns, _ := client.Namespaced(path)
324 _, err := x.app.factory.CanForResource(ns, client.PodGVR, client.ListAccess)
325 if err != nil {
326 x.app.Flash().Err(err)
327 return
328 }
329
330 opts := dao.LogOptions{
331 Path: path,
332 Container: co,
333 Previous: prev,
334 }
335 if err := x.app.inject(NewLog(client.PodGVR, &opts), false); err != nil {
336 x.app.Flash().Err(err)
337 }
338}
339
340func (x *Xray) shellCmd(*tcell.EventKey) *tcell.EventKey {
341 spec := x.selectedSpec()

Callers 2

logsCmdMethod · 0.95
viewLogsMethod · 0.45

Calls 9

NamespacedFunction · 0.92
ParentPathMethod · 0.80
injectMethod · 0.80
NewLogFunction · 0.70
GVRMethod · 0.65
CanForResourceMethod · 0.65
FlashMethod · 0.65
PathMethod · 0.45
ErrMethod · 0.45

Tested by

no test coverage detected