log

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package log implements the `kuke log` subcommand. It mirrors `kuke attach`'s flag/arg shape but instead of opening an interactive sbsh session it prints the per-container output stream. By default it dumps the current capture/log file contents and exits; pass `-f`/`--follow` to tail until SIGINT, matching `kubectl logs` / `docker logs` conventions. Bytes never traverse the daemon RPC: the daemon resolves the host path of the relevant stream and this subcommand opens that path directly.

Two paths exist depending on the target container's IO model:

  • Attachable containers route output through sbsh, which writes a tty byte stream to HostCapturePath. `kuke log` reads that file.
  • Non-Attachable containers (including kukeond) have the containerd runtime shim write stdout/stderr to HostLogPath via cio.LogFile. `kuke log` reads that file. Implemented per issue #203.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogCmd

func NewLogCmd() *cobra.Command

NewLogCmd builds the `kuke log` cobra command.

func TailFile added in v0.4.0

func TailFile(ctx context.Context, path string, out io.Writer, follow bool) error

TailFile re-exports tailFile so sibling commands that share the same log-streaming semantics (e.g. `kuke daemon logs`) can dispatch through the same dump-and-exit / follow loop instead of duplicating it.

Types

type MockControllerKey

type MockControllerKey struct{}

MockControllerKey injects a kukeonv1.Client via context for tests.

type MockTailKey

type MockTailKey struct{}

MockTailKey injects a tailFn via context for tests, so the real follow loop (which would block on a real file) can be bypassed.

type TailFn added in v0.4.0

type TailFn = tailFn

TailFn is the exported alias for tailFile-shaped functions: open path, dump current contents to out, and optionally follow until ctx is cancelled. Sibling commands that share `kuke log`'s streaming semantics (e.g. `kuke daemon logs`) accept values of this type for injection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL