logs

package
v4.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 10 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

This section is empty.

Types

type LogLine

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 GetLogFile

func GetLogFile(path string, options *LogOptions) (*tail.Tail, []*LogLine, error)

GetLogFile returns an hp tail for a container given options

func NewJournaldLogLine

func NewJournaldLogLine(line string, withID bool) (*LogLine, error)

NewJournaldLogLine creates a LogLine from the specified line from journald. Note that if withID is set, the first item of the message is considerred to be the container ID and set as such.

func NewLogLine

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

NewLogLine creates a logLine struct from a container log string

func (*LogLine) Partial

func (l *LogLine) Partial() bool

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

func (*LogLine) Since

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

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

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

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

type LogOptions

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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