Documentation
¶
Index ¶
- func Label(ctx context.Context) string
- func LogCommand(cmd string, args ...string) error
- func LogCommandContext(ctx context.Context, cmd string, args ...string) error
- func LogCommandWithInput(in []byte, cmd string, args ...string) error
- func OutCommand(cmd string, args ...string) ([]byte, error)
- func OutLogCommand(cmd string, args ...string) ([]byte, error)
- func WithLabel(ctx context.Context, label string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Label ¶ added in v0.3.2
Label returns the label attached to ctx by WithLabel, or "" if there is none. Components can use it to tag their own log messages the same way their command output is tagged.
func LogCommand ¶
LogCommand runs the specified command but records standard output with log.Info and standard error with log.Warning.
func LogCommandContext ¶ added in v0.3.2
LogCommandContext is LogCommand with any label attached to ctx applied to the logged output.
func LogCommandWithInput ¶
LogCommandWithInput runs the specified command but records standard output with log.Info and standard error with log.Warning. in is sent to the standard input of the command.
func OutCommand ¶
OutCommand runs the specified command and returns any standard output as well as any errors.
func OutLogCommand ¶
OutLogCommand runs the specified command but records standard output with log.Info and standard error with log.Warning. Standard output and standard error are also returned.
func WithLabel ¶ added in v0.3.2
WithLabel returns a copy of ctx that tags the output of commands run with it as coming from label. Callers that run commands concurrently should set a label; without one the interleaved output of several commands is indistinguishable, since every line is attributed only to the binary that produced it.
The label affects logging only. It does not tie the command's lifetime to ctx: commands are not canceled when ctx ends.
Types ¶
This section is empty.