CS-10695: Use @cardstack/logger for software factory logging#4360
CS-10695: Use @cardstack/logger for software factory logging#4360
Conversation
…ftware-factory Replace all console.log, console.error, and console.warn calls across 25 files in packages/software-factory/ with categorized @cardstack/logger instances. Each module gets a named logger (e.g., 'factory-entrypoint', 'serve-realm', 'factory-skill-smoke') for level-controlled, filterable output. - Add setup-logger import as first import in all entry points (CLI scripts, smoke tests, test runner, harness scripts) - Replace console calls in library modules (realm-operations, test-run-execution, factory-implement, factory-tool-builder, factory-skill-loader, etc.) - Default test log level to *=error for quieter test output - Leave test file that mocks console.warn untouched (factory-skill-loader.test.ts) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR standardizes logging in packages/software-factory/ by replacing console.* usage with categorized @cardstack/logger instances, and ensures logger configuration is initialized early via setup-logger imports.
Changes:
- Replace
console.log/error/warnwithlogger('<category>').info/warn/erroracross CLI entrypoints, harness, and scripts. - Add
setup-loggerside-effect import near the top of CLI/scripts/smoke-test entrypoints to configure log levels fromLOG_LEVELS. - Adjust test runner defaults to reduce noise (defaulting
LOG_LEVELSto*=errorfor tests).
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/software-factory/src/harness/support-services.ts | Routes prerender child process output through categorized logger. |
| packages/software-factory/src/cli/smoke-test-realm.ts | Switches smoke-test CLI output to logger and initializes setup-logger. |
| packages/software-factory/src/cli/smoke-realm.ts | Switches smoke CLI output to logger and initializes setup-logger. |
| packages/software-factory/src/cli/serve-support.ts | Uses logger and initializes setup-logger; prints support payload. |
| packages/software-factory/src/cli/serve-realm.ts | Uses logger and initializes setup-logger; prints realm payload. |
| packages/software-factory/src/cli/factory-entrypoint.ts | Replaces stderr logging helper with categorized logger and initializes setup-logger. |
| packages/software-factory/src/cli/cache-realm.ts | Uses logger and initializes setup-logger; prints cache/template payload. |
| packages/software-factory/scripts/test.ts | Sets quieter default log levels for tests and switches error reporting to logger. |
| packages/software-factory/scripts/smoke-tests/factory-tools-smoke.ts | Switches smoke-test output to logger and initializes setup-logger. |
| packages/software-factory/scripts/smoke-tests/factory-skill-smoke.ts | Switches smoke-test output to logger and initializes setup-logger. |
| packages/software-factory/scripts/smoke-tests/factory-prompt-smoke.ts | Switches smoke-test output to logger and initializes setup-logger. |
| packages/software-factory/scripts/smoke-tests/factory-loop-smoke.ts | Switches smoke-test output to logger and initializes setup-logger. |
| packages/software-factory/scripts/smoke-tests/factory-context-smoke.ts | Switches smoke-test output to logger and initializes setup-logger. |
| packages/software-factory/scripts/smoke-tests/factory-agent-smoke.ts | Switches smoke-test output to logger and initializes setup-logger. |
| packages/software-factory/scripts/run-realm-tests.ts | Switches final summary output to logger and initializes setup-logger. |
| packages/software-factory/scripts/pick-ticket.ts | Initializes setup-logger and routes error output through logger. |
| packages/software-factory/scripts/lib/test-run-execution.ts | Adds categorized logger and replaces console forwarding with logger calls. |
| packages/software-factory/scripts/lib/realm-operations.ts | Adds categorized logger and replaces warning logs. |
| packages/software-factory/scripts/lib/factory-tool-builder.ts | Adds categorized logger for schema/tool omissions. |
| packages/software-factory/scripts/lib/factory-skill-loader.ts | Adds categorized logger for missing skills and budget drops. |
| packages/software-factory/scripts/lib/factory-implement.ts | Adds categorized logger and replaces console logging in implement flow. |
| packages/software-factory/scripts/lib/darkfactory-schemas.ts | Adds categorized logger for schema fetch/parse warnings. |
| packages/software-factory/scripts/lib/boxel.ts | Updates printJson to go through logger. |
| packages/software-factory/scripts/boxel-session.ts | Initializes setup-logger and routes error output through logger. |
| packages/software-factory/scripts/boxel-search.ts | Initializes setup-logger and routes error output through logger. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd0106bc20
ℹ️ 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".
- Fix prettier violations: collapse multi-line template literals to single lines - Remove zero-argument log.info() calls (logger requires at least 1 arg) - Update test mocks: console.warn → console.error since @cardstack/logger routes all output through console.error Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Rename 'boxel' logger category to 'software-factory' (less ambiguous) - Remove redundant hardcoded category prefixes from log messages (logger already adds the category name) - Use process.stdout.write for machine-readable JSON output in CLI scripts (printJson, serve-realm, serve-support, cache-realm, run-realm-tests) so it isn't prefixed/filtered by the logger - Fix log levels: use info for progress/status messages, debug for forwarded browser console output, keep error only for actual failures - Add error.stack logging in catch handlers (serve-realm, factory-entrypoint) - Fix test.ts: use explicit configureLogger() call instead of relying on process.env before static import (import hoisting) - Remove unused log imports from boxel.ts and run-realm-tests.ts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- factory-entrypoint: use console.log for --help usage text (stdout, not logger/stderr) so the integration test can find it on result.stdout - factory-skill-loader: use console.warn for skill budget/loader warnings since tests mock console.warn to verify them, and log.warn is suppressed by LOG_LEVELS='*=error' in the test runner - Revert test mocks back to console.warn accordingly Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
console.log,console.error, andconsole.warncalls inpackages/software-factory/with categorized@cardstack/loggerinstancessetup-loggerimport as first import in all entry points (CLI commands, scripts, smoke tests)*=errorfor quieter test outputconsole.*calls remaining insrc/andscripts/(test mocking infactory-skill-loader.test.tsintentionally preserved)Closes CS-10695
🤖 Generated with Claude Code