Documentation
¶
Index ¶
- func BuildHostSink(service string, mode SinkMode, stdout, stderr io.Writer, color bool, ...) (outW, errW io.Writer, closeFn func() error, err error)
- func BuildSink(service string, mode SinkMode, inline io.Writer, color bool, ...) (io.Writer, func() error, error)
- func ColorEnabled() bool
- func OpenServiceLog(service string) (*os.File, error)
- func ServiceLogPath(service string) string
- func TailContainerCrashLogs(runtime, containerName string, lines int)
- func TailHostCrashLogs(serviceName string, lines int)
- type ColorPicker
- type LineWriter
- type LogLine
- type Model
- type SecretRedactor
- type SinkMode
- type Streamer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHostSink ¶ added in v0.56.0
func BuildHostSink(service string, mode SinkMode, stdout, stderr io.Writer, color bool, redactor *SecretRedactor) (outW, errW io.Writer, closeFn func() error, err error)
BuildHostSink is like BuildSink but returns separate stdout and stderr writers. A host child process is the only producer with distinct stdout/stderr streams; in raw mode (the host default) its stderr must stay on os.Stderr to preserve today's behavior (e.g. `devx up 2>err.log`). In prefixed mode both streams share one mutex-guarded LineWriter (the unified inline view); in off mode both are file-only. The same log file backs both writers.
func BuildSink ¶ added in v0.56.0
func BuildSink(service string, mode SinkMode, inline io.Writer, color bool, redactor *SecretRedactor) (io.Writer, func() error, error)
BuildSink returns the writer a producer should write log bytes to, plus a closer. It always writes the service's log file (the devx-logs fan-out) and, per mode, also writes inline (raw or prefixed) to the provided inline writer (normally os.Stdout). color toggles ANSI for the prefixed mode; redactor may be nil. For LogOffMode the inline writer is omitted (file only).
func ColorEnabled ¶ added in v0.56.0
func ColorEnabled() bool
ColorEnabled reports whether inline log prefixes should be colored. Disabled when NO_COLOR is set (https://no-color.org). Callers pass the result to NewLineWriter.
func OpenServiceLog ¶ added in v0.56.0
OpenServiceLog creates/truncates the per-service log file (fresh per `up` run).
func ServiceLogPath ¶ added in v0.56.0
ServiceLogPath is the per-service log file path consumed by `devx logs`.
func TailContainerCrashLogs ¶ added in v0.25.0
TailContainerCrashLogs fetches the last N lines from a crashed container and prints them in a styled error box for immediate developer context.
func TailHostCrashLogs ¶ added in v0.25.0
TailHostCrashLogs reads the last N lines from a host process log file and prints them in a styled error box.
Types ¶
type ColorPicker ¶ added in v0.56.0
type ColorPicker struct {
// contains filtered or unexported fields
}
ColorPicker assigns a stable lipgloss color to each service name, cycling through the palette. Safe for concurrent use.
func NewColorPicker ¶ added in v0.56.0
func NewColorPicker() *ColorPicker
type LineWriter ¶ added in v0.56.0
type LineWriter struct {
// contains filtered or unexported fields
}
LineWriter wraps a destination writer and, on each complete '\n'-terminated line, prepends a "[service] " prefix (colored when color==true), applies secret redaction, and writes the result. Partial lines are buffered until the next newline. Safe for concurrent Writes from multiple goroutines.
func NewLineWriter ¶ added in v0.56.0
func NewLineWriter(dst io.Writer, service string, color bool, redactor *SecretRedactor) *LineWriter
NewLineWriter builds a LineWriter for a service. color toggles ANSI coloring (callers pass ColorEnabled()). redactor may be nil.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func InitialModel ¶
func InitialModel(rt provider.ContainerRuntime) Model
func InitialModelWithRedactor ¶ added in v0.25.0
func InitialModelWithRedactor(r *SecretRedactor, rt provider.ContainerRuntime) Model
InitialModelWithRedactor creates the TUI model with secret redaction enabled. All log lines will be scrubbed for known secret values before display.
type SecretRedactor ¶ added in v0.25.0
type SecretRedactor struct {
// contains filtered or unexported fields
}
SecretRedactor replaces known secret values in log output with a redaction marker. Because devx centrally loads all secrets via vault/env integration, it can perform exact-match replacement rather than relying on pattern-based heuristics.
func NewSecretRedactor ¶ added in v0.25.0
func NewSecretRedactor() *SecretRedactor
NewSecretRedactor builds a redactor from the current environment. It collects all env-var values and filters out obviously non-sensitive short values (length <= 3) and common system paths to avoid false positives.
func NewSecretRedactorFromPairs ¶ added in v0.25.0
func NewSecretRedactorFromPairs(pairs []string) *SecretRedactor
NewSecretRedactorFromPairs builds a redactor from explicit KEY=VALUE pairs. Useful for testing or when secrets come from a vault loader rather than the process environment.
func (*SecretRedactor) Redact ¶ added in v0.25.0
func (r *SecretRedactor) Redact(s string) string
Redact replaces all known secret values in the input string.
type SinkMode ¶ added in v0.56.0
type SinkMode int
SinkMode mirrors orchestrator.LogMode without importing it (logs must not depend on orchestrator). The orchestrator maps its LogMode to these.
type Streamer ¶
type Streamer struct {
Lines chan LogLine
Errors chan error
Redactor *SecretRedactor
Runtime provider.ContainerRuntime
// contains filtered or unexported fields
}
func NewStreamer ¶
func NewStreamer(rt provider.ContainerRuntime) *Streamer