container

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LogTimeFormat is the time format used in the log.
	// It is a modified version of RFC3339Nano that guarantees trailing
	// zeroes are not trimmed, taken from
	// https://github.com/golang/go/issues/19635
	LogTimeFormat = "2006-01-02T15:04:05.000000000Z07:00"

	// PartialLogType signifies a log line that exceeded the buffer
	// length and needed to spill into a new line
	PartialLogType = "P"

	// FullLogType signifies a log line is full
	FullLogType = "F"

	// ANSIEscapeResetCode is a code that resets all colors and text effects
	ANSIEscapeResetCode = "\033[0m"
)

Variables

This section is empty.

Functions

func ExpandContainerCommandOnlyStatic

func ExpandContainerCommandOnlyStatic(containerCommand []string, envs []corev1.EnvVar) (command []string)

ExpandContainerCommandOnlyStatic substitutes only static environment variable values from the container environment definitions. This does *not* include valueFrom substitutions. TODO: callers should use ExpandContainerCommandAndArgs with a fully resolved list of environment.

func ExpandContainerVolumeMounts

func ExpandContainerVolumeMounts(mount corev1.VolumeMount, envs []corev1.EnvVar) (string, error)

ExpandContainerVolumeMounts expands the subpath of the given VolumeMount by replacing variable references with the values of given EnvVar.

func GetTailLog added in v0.1.2

func GetTailLog(path string, tail int) ([]string, error)

Types

type LogLine added in v0.1.2

type LogLine struct {
	Device       string
	ParseLogType string
	Time         time.Time
	Msg          string
	CID          string
	CName        string
	ColorID      int64
}

LogLine describes the information for each line of a log

func NewLogLine added in v0.1.2

func NewLogLine(line string) (*LogLine, error)

NewLogLine creates a logLine struct from a container log string

func (*LogLine) Partial added in v0.1.2

func (l *LogLine) Partial() bool

Partial returns a bool if the log line is a partial log type

func (*LogLine) Since added in v0.1.2

func (l *LogLine) Since(since time.Time) bool

Since returns a bool as to whether a log line occurred after a given time

func (*LogLine) String added in v0.1.2

func (l *LogLine) String(options *LogOptions) string

String converts a log line to a string for output given whether a detail bool is specified.

func (*LogLine) Until added in v0.1.2

func (l *LogLine) Until(until time.Time) bool

Until returns a bool as to whether a log line occurred before a given time

func (*LogLine) Write added in v0.1.2

func (l *LogLine) Write(stdout io.Writer, stderr io.Writer, logOpts *LogOptions)

type LogOptions added in v0.1.2

type LogOptions struct {
	Details    bool
	Follow     bool
	Since      time.Time
	Until      time.Time
	Tail       int64
	Timestamps bool
	Colors     bool
	Multi      bool
	WaitGroup  *sync.WaitGroup
	UseName    bool
}

LogOptions is the options you can use for logs

type ReverseReader added in v0.1.2

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

ReverseReader structure for reading a file backwards

func NewReverseReader added in v0.1.2

func NewReverseReader(reader *os.File) (*ReverseReader, error)

NewReverseReader returns a reader that reads from the end of a file rather than the beginning. It sets the readsize to pagesize and determines the first offset using modulus.

func (*ReverseReader) Read added in v0.1.2

func (r *ReverseReader) Read() (string, error)

ReverseReader reads from a given offset to the previous offset and then sets the newoff set one pagesize less than the previous read.

Jump to

Keyboard shortcuts

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