Documentation
¶
Overview ¶
Package debug carries an opt-in, SDK-neutral debug switch through the request context. The root --debug flag (and the SUVE_DEBUG environment variable) turns it on; provider adapters read it to enable their cloud SDK's request/response logging, writing to the supplied writer (stderr in normal use).
Keeping this package free of any cloud SDK is deliberate: both the CLI layer (which sets the switch) and every provider adapter (which acts on it) can depend on it without violating the provider seam that confines each cloud SDK to its own provider package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Enabled reports whether verbose debug logging was requested.
Enabled bool
// Writer is where debug output should go (typically stderr). Callers that
// set Enabled must supply a non-nil Writer.
Writer io.Writer
// NoRedaction, when true, tells provider adapters to log full request and
// response bodies and to stop masking sensitive headers, so the debug output
// includes secret values and live credentials. It is opt-in via
// --no-redaction and only meaningful when Enabled; the zero value keeps the
// safe, redacted default.
NoRedaction bool
}
Config describes the active debug settings pulled from a context.
func From ¶
From returns the Config carried by ctx, or the zero value (disabled) when none is present.
func (Config) Logf ¶
Logf writes a single formatted debug line to the configured Writer, prefixed with "[suve debug <wall clock>] " so every provider's output shares one grep-able, time-correlatable format. It is a no-op when debug is disabled or no Writer is set, so callers can invoke it unconditionally. Centralizing the write here keeps provider adapters free of direct fmt.Fprint* usage (see the output package for the same rationale).
Callers supply the format WITHOUT a prefix or timestamp; multi-line payloads (e.g. HTTP dumps) are prefixed on their first line only.