chezmoilog

package
v2.47.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package chezmoilog contains support for chezmoi logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendExitErrorAttrs added in v2.46.1

func AppendExitErrorAttrs(attrs []slog.Attr, err error) []slog.Attr

func Bytes added in v2.46.1

func Bytes(key string, data []byte) slog.Attr

Bytes returns an slog.Attr with the value data.

func FirstFewBytes

func FirstFewBytes(key string, data []byte) slog.Attr

FirstFewBytes returns an slog.Attr with the value of the first few bytes of data.

func InfoOrError added in v2.46.1

func InfoOrError(logger *slog.Logger, msg string, err error, attrs ...slog.Attr)

func InfoOrErrorContext added in v2.46.1

func InfoOrErrorContext(ctx context.Context, logger *slog.Logger, msg string, err error, attrs ...slog.Attr)

func LogCmdCombinedOutput

func LogCmdCombinedOutput(logger *slog.Logger, cmd *exec.Cmd) ([]byte, error)

LogCmdCombinedOutput calls cmd.CombinedOutput, logs the result, and returns the result.

func LogCmdOutput

func LogCmdOutput(logger *slog.Logger, cmd *exec.Cmd) ([]byte, error)

LogCmdOutput calls cmd.Output, logs the result, and returns the result.

func LogCmdRun

func LogCmdRun(logger *slog.Logger, cmd *exec.Cmd) error

LogCmdRun calls cmd.Run, logs the result, and returns the result.

func LogCmdStart added in v2.40.0

func LogCmdStart(logger *slog.Logger, cmd *exec.Cmd) error

LogCmdStart calls cmd.Start, logs the result, and returns the result.

func LogCmdWait added in v2.40.0

func LogCmdWait(logger *slog.Logger, cmd *exec.Cmd) error

LogCmdWait calls cmd.Wait, logs the result, and returns the result.

func LogHTTPRequest added in v2.9.3

func LogHTTPRequest(ctx context.Context, logger *slog.Logger, client *http.Client, req *http.Request) (*http.Response, error)

LogHTTPRequest calls httpClient.Do, logs the result to logger, and returns the result.

func Stringer added in v2.46.1

func Stringer(key string, value fmt.Stringer) slog.Attr

Stringer returns an slog.Attr with value.

Types

type NullHandler added in v2.46.1

type NullHandler struct{}

A NullHandler implements log/slog.Handler and drops all output.

func (NullHandler) Enabled added in v2.46.1

func (NullHandler) Handle added in v2.46.1

func (NullHandler) WithAttrs added in v2.46.1

func (h NullHandler) WithAttrs([]slog.Attr) slog.Handler

func (NullHandler) WithGroup added in v2.46.1

func (h NullHandler) WithGroup(string) slog.Handler

type OSExecCmdLogValuer added in v2.46.1

type OSExecCmdLogValuer struct {
	*exec.Cmd
}

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

type OSExecExitErrorLogValuer struct {
	*exec.ExitError
}

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.

Jump to

Keyboard shortcuts

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