Documentation
¶
Overview ¶
Package chezmoilog contains support for chezmoi logging.
Index ¶
- func AppendExitErrorAttrs(attrs []slog.Attr, err error) []slog.Attr
- func Bytes(key string, data []byte) slog.Attr
- func FirstFewBytes(key string, data []byte) slog.Attr
- func InfoOrError(logger *slog.Logger, msg string, err error, attrs ...slog.Attr)
- func InfoOrErrorContext(ctx context.Context, logger *slog.Logger, msg string, err error, ...)
- func LogCmdCombinedOutput(logger *slog.Logger, cmd *exec.Cmd) ([]byte, error)
- func LogCmdOutput(logger *slog.Logger, cmd *exec.Cmd) ([]byte, error)
- func LogCmdRun(logger *slog.Logger, cmd *exec.Cmd) error
- func LogCmdStart(logger *slog.Logger, cmd *exec.Cmd) error
- func LogCmdWait(logger *slog.Logger, cmd *exec.Cmd) error
- func LogHTTPRequest(ctx context.Context, logger *slog.Logger, client *http.Client, ...) (*http.Response, error)
- func Stringer(key string, value fmt.Stringer) slog.Attr
- type NullHandler
- type OSExecCmdLogValuer
- type OSExecExitErrorLogValuer
- type OSProcessStateLogValuer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendExitErrorAttrs ¶ added in v2.46.1
func FirstFewBytes ¶
FirstFewBytes returns an slog.Attr with the value of the first few bytes of data.
func InfoOrError ¶ added in v2.46.1
func InfoOrErrorContext ¶ added in v2.46.1
func LogCmdCombinedOutput ¶
LogCmdCombinedOutput calls cmd.CombinedOutput, logs the result, and returns the result.
func LogCmdOutput ¶
LogCmdOutput calls cmd.Output, logs the result, and returns the result.
func LogCmdStart ¶ added in v2.40.0
LogCmdStart calls cmd.Start, logs the result, and returns the result.
func LogCmdWait ¶ added in v2.40.0
LogCmdWait calls cmd.Wait, logs the result, and returns the result.
Types ¶
type NullHandler ¶ added in v2.46.1
type NullHandler struct{}
A NullHandler implements log/slog.Handler and drops all output.
type OSExecCmdLogValuer ¶ added in v2.46.1
An OSExecCmdLogValuer wraps an *os/exec.Cmd and adds log/slog.LogValuer functionality.
func (OSExecCmdLogValuer) LogValuer ¶ added in v2.46.1
func (cmd OSExecCmdLogValuer) LogValuer() slog.Value
LogValuer implements log/slog.LogValuer.LogValue.
type OSExecExitErrorLogValuer ¶ added in v2.46.1
An OSExecExitErrorLogValuer wraps an *os/exec.ExitError and adds log/slog.LogValuer.
func (OSExecExitErrorLogValuer) LogValuer ¶ added in v2.46.1
func (err OSExecExitErrorLogValuer) LogValuer() slog.Value
LogValuer implements log/slog.LogValuer.LogValue.
type OSProcessStateLogValuer ¶ added in v2.46.1
type OSProcessStateLogValuer struct {
*os.ProcessState
}
An OSProcessStateLogValuer wraps an *os.ProcessState and adds log/slog.LogValuer functionality.
func (OSProcessStateLogValuer) LogValue ¶ added in v2.46.1
func (p OSProcessStateLogValuer) LogValue() slog.Value
LogValue implements log/slog.LogValuer.LogValue.