Documentation
¶
Index ¶
- func CommandFields(executable string, args []string, workingDir string) []zap.Field
- func FormatDuration(value time.Duration) string
- func NewConsole(stderr io.Writer, verbosity int, quiet bool) *zap.Logger
- func SanitizeArgs(args []string) []string
- func SanitizeURL(value string) string
- type CommandStderr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandFields ¶ added in v0.20.2
CommandFields returns the standard secret-safe DEBUG fields for a subprocess. Args are sanitized. The executable must be a resolved binary path or name, not a command string containing arguments or credentials.
func FormatDuration ¶
FormatDuration returns a short human-readable duration string for logs.
func NewConsole ¶
NewConsole returns a logger configured for human-readable terminal output. verbosity controls the log level: 0 = warn, 1 = info, 2+ = debug. When quiet is true the logger only emits errors.
func SanitizeArgs ¶ added in v0.20.2
SanitizeArgs returns a copy of args with credential values and URL user information removed. Non-secret arguments remain unchanged so DEBUG logs can still reproduce the command.
func SanitizeURL ¶ added in v0.20.2
SanitizeURL removes user information from a URL before it is logged. It fails closed when URL parsing fails. Query values are not inspected, so callers must not use this helper as a general query-string redactor.
Types ¶
type CommandStderr ¶
type CommandStderr struct {
// contains filtered or unexported fields
}
CommandStderr counts subprocess stderr and optionally mirrors it to the caller's debug output. It does not retain the contents.
func NewCommandStderr ¶
func NewCommandStderr(visible io.Writer, debug bool) *CommandStderr
NewCommandStderr creates a subprocess stderr counter. When debug is true, writes are also forwarded to visible as they arrive.
func (*CommandStderr) ByteCount ¶ added in v0.20.2
func (w *CommandStderr) ByteCount() int64
ByteCount returns the number of bytes written to subprocess stderr.