Skip to content

[Feature]: Adopt structured logging (log/slog) for all user-facing output #8

Description

@mrhillsman

Problem Statement

All user-facing output uses `fmt.Printf` where structured logging (`log/slog`) would be more appropriate. This affects observability when running in containerized/OpenShift environments where structured JSON logs are expected by log aggregation systems.

Proposed Solution

Adopt `log/slog` (stdlib, available since Go 1.21) with configurable log level via `--verbose` flag. Use structured fields for VM names, namespaces, durations, and error details.

Alternatives Considered

Not provided

Area

CLI / Configuration

Additional Context

Severity: Medium

Files with `fmt.Print` in non-test code:*

  • `cmd/virtwork/main.go` — ~15 `fmt.Fprintf` calls for status, errors, and summary output
  • `internal/wait/wait.go:38` — `fmt.Printf` for retry messages
  • `internal/vm/vm.go` — `fmt.Printf` for retry backoff messages

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.size/LDenotes a PR that changes 100-499 lines, ignoring generated files.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions