Documentation
¶
Overview ¶
Package logkit provides secret-safe subprocess logging helpers shared by Bomly components: argument and URL sanitizers, standard DEBUG command fields, and a counting stderr writer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandFields ¶
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 SanitizeArgs ¶
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 ¶
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 ¶
func (w *CommandStderr) ByteCount() int64
ByteCount returns the number of bytes written to subprocess stderr.