logs

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flags

func Flags(options *Options) *pflag.FlagSet

func ParseTail added in v0.22.0

func ParseTail(tail string) (int, error)

func TimeRange added in v0.22.0

func TimeRange(since, until string, now time.Time) (string, string, error)

TimeRange resolves log filters that could be RFC 3339, timestamp, or relative duration to UTC timestamps. Dates without a timezone use now's location. Relative durations are computed from now.

Types

type Duration added in v0.22.0

type Duration = time.Duration

Duration is an extended standard time.Duration that also supports days as a unit.

func ParseDuration added in v0.22.0

func ParseDuration(value string) (Duration, error)

ParseDuration parses a Go duration with the additional unit d, meaning exactly 24 hours. Days can be fractional or combined with other units, such as "1.5d" or "2d3h".

type Formatter

type Formatter struct {
	// contains filtered or unexported fields
}

Formatter handles formatting and printing of log entries with dynamic column alignment.

func NewFormatter

func NewFormatter(machineNames, serviceNames []string, utc bool) *Formatter

func (*Formatter) PrintEntry

func (f *Formatter) PrintEntry(entry api.ServiceLogEntry)

PrintEntry prints a single log entry with proper formatting.

type Options

type Options struct {
	Files    []string
	Follow   bool
	Tail     string
	Since    string
	Until    string
	UTC      bool
	Machines []string
}

Options describes how and what logs we are requesting.

func (Options) TailLines added in v0.22.0

func (opts Options) TailLines() (int, error)

TailLines resolves the default tail limit after parsing flags. An empty opts.Tail means the user did not specify a limit, so --since can select all matching logs without overriding an explicit --tail.

type ServiceArg

type ServiceArg struct {
	Service    string
	Containers []string
}

ServiceArg pairs a service name with the list of container filters parsed from `uc service logs` arguments. An empty Containers slice means "stream logs from all containers of this service".

func ParseServiceArgs

func ParseServiceArgs(args []string) ([]ServiceArg, error)

ParseServiceArgs groups raw `uc service logs` positional arguments into per-service entries, preserving first-seen order. Each argument is either a service name (e.g. "web") or a service/container reference (e.g. "web/61d57fd3428f"). Arguments for the same service are merged: if any argument for a service lacks a container suffix, all containers of that service are streamed regardless of any other service/container arguments for it.

Jump to

Keyboard shortcuts

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