monitorcmd

package
v0.1.44 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimestampFormat = "2006-01-02 15:04:05.000"

DefaultTimestampFormat is the default format for outputting a timestamp.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

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

Cmd represents a command.

func Cmds

func Cmds() []*Cmd

Cmds returns a slice of all available commands, sorted in increasing order by command name.

func Get

func Get(name string) (*Cmd, bool)

Get returns the command with the given name, if any.

func (*Cmd) Description

func (c *Cmd) Description() string

Description returns a brief one-line description of the command.

func (*Cmd) Parse

func (c *Cmd) Parse(args []string) (RunFunc, error)

Parse attempts to generate a run function from the given command-line arguments.

func (*Cmd) String

func (c *Cmd) String() string

String returns the command name.

type EntryPrinter

type EntryPrinter interface {
	WriteEntry(monitor.Entry) error // Write writes the given entry.
}

EntryPrinter is the interface satisfied by an object that can output log entries.

func NewCSVPrinter added in v0.1.25

func NewCSVPrinter(w io.Writer, format string) EntryPrinter

NewCSVPrinter returns a new EntryPrinter that outputs log entries in CSV format. The timestamp will be formatted according to 'format'.

func NewTabPrinter

func NewTabPrinter(w io.Writer, format string) EntryPrinter

NewTabPrinter returns a new EntryPrinter that uses tabs to separate the information in a log entry. The timestamp will be formatted according to 'format'.

type RunFunc

type RunFunc func(context.Context, monitor.Connection) error

RunFunc is a function that can be run on the given connection to execute a command.

Jump to

Keyboard shortcuts

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