refactor: replace fmt.Print* with log/slog for structured logging#14
refactor: replace fmt.Print* with log/slog for structured logging#14
Conversation
There was a problem hiding this comment.
💡 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.
|
@codex review pleased |
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 👍 / 👎.
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.