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

DefaultTimestampFormat is the default format for outputting a timestamp.


This section is empty.


This section is empty.


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 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.