Skip to content

refactor: replace fmt.Print* with log/slog for structured logging#14

Merged
STRRL merged 1 commit intomasterfrom
adopt-slog
Feb 28, 2026
Merged

refactor: replace fmt.Print* with log/slog for structured logging#14
STRRL merged 1 commit intomasterfrom
adopt-slog

Conversation

@STRRL
Copy link
Owner

@STRRL STRRL commented Feb 28, 2026

Migrate all CLI output from fmt.Printf/Println/Fprintf to slog.Info/Warn
with structured key-value attributes for consistent, structured logging
across all commands. Also fix fmt.Errorf usages to use errors.Errorf and
exclude pkg/multiline (vendored copy-as-is code) from golangci-lint.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74e3edc96e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Migrate all fmt.Printf/Println/Fprintf calls to slog.Info/Warn with
structured key-value attributes across CLI commands and analyzer package.
@STRRL
Copy link
Owner Author

STRRL commented Feb 28, 2026

@codex review pleased

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3748c8ca31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

fmt.Println(result)
slog.Info(result)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Print analyze output to stdout

analyze's primary payload is the model's final answer, but this now goes through slog.Info, which uses the default logger and writes via the log package to stderr by default; this breaks scripting/piping (lapp analyze ... > answer.txt captures nothing) and also prefixes the response with log metadata instead of returning raw analysis text.

Useful? React with 👍 / 👎.

}

fmt.Println(result)
slog.Info(result)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Print debug-run agent result to stdout

debug run previously emitted the agent result as command output, but replacing it with slog.Info sends it to stderr (default logger behavior) and adds log prefixes, so command substitution and redirection workflows cannot reliably consume the generated analysis.

Useful? React with 👍 / 👎.

pType = "-"
}
fmt.Printf("%-12s %-6s %-22s %-6d %s\n", ts.PatternUUIDString, pType, semanticID, ts.Count, desc)
slog.Info("template",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Emit template rows on stdout

The templates command is documented to list discovered templates, but rows are now emitted with slog.Info; with default slog configuration these records go to stderr, so lapp templates > templates.txt produces an empty file and downstream tooling can no longer consume template listings as command output.

Useful? React with 👍 / 👎.

@STRRL STRRL merged commit 3d123c6 into master Feb 28, 2026
2 checks passed
@STRRL STRRL deleted the adopt-slog branch February 28, 2026 01:38
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3748c8ca31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


fmt.Fprintf(os.Stderr, "Workspace created at: %s\n", outDir)
fmt.Println(outDir)
slog.Info("Workspace created", "dir", outDir)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep workspace directory path on stdout

In runDebugWorkspace, the only post-success output is now slog.Info("Workspace created", "dir", outDir), which goes through the default slog logger and is written to stderr with log metadata; this removes the plain stdout path that callers could reliably capture when --output is omitted. As a result, shell workflows like workdir=$(lapp debug workspace app.log) (and chaining into debug run) now get an empty variable and fail to locate the generated workspace.

Useful? React with 👍 / 👎.

pType = "-"
}
fmt.Printf("%-12s %-6s %-22s %-6d %s\n", ts.PatternUUIDString, pType, semanticID, ts.Count, desc)
slog.Info("template",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Emit template rows on stdout, not structured logs

The templates subcommand now emits each template via slog.Info instead of writing rows to stdout, so the command’s data output is redirected to stderr and prefixed by logger formatting rather than remaining a clean stream. This breaks common non-interactive usage (lapp templates > templates.txt, piping into text tools) because stdout is no longer the source of template data.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant