fix: standardize logging across codebase#147
Conversation
- Create utils/logger.ts with centralized logger - Replace console.log/error with report.success/error/info/warn - Use raw() for piped output and complex formatting - Update all 34 files to use new logger - Fixes inconsistent logging patterns across modules
cdadb09 to
8b745a4
Compare
There was a problem hiding this comment.
Pull request overview
This PR standardizes CLI logging by introducing a single logging utility and updating modules/scripts to use structured yurnalist output (report.*) or unformatted output (raw()), instead of direct console.log/console.error.
Changes:
- Add
utils/logger.tsto centralize logging (report+raw()). - Replace most
console.log/console.errorusage across the CLI withreport.success/error/info/warn. - Switch help/script-like output paths to
raw()to avoid reporter formatting where appropriate.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| main.ts | Uses centralized logger for warnings/errors during dispatch. |
| release.ts | Standardizes release script messaging via report.*. |
| test.ts | Switches test runner to centralized report.* for pass/fail output. |
| utils/logger.ts | Introduces centralized logger (report re-export + raw()). |
| utils/release.ts | Replaces release guardrail console.* calls with report.*. |
| utils/spinner.ts | Routes spinner activity through centralized report. |
| modules/update/index.ts | Uses centralized report for update module logs. |
| modules/up/index.ts | Uses centralized report for dependency “up” orchestration. |
| modules/up/node.ts | Uses centralized report for Node dependency install logs. |
| modules/up/python.ts | Uses centralized report for Python dependency install logs. |
| modules/up/ruby.ts | Uses centralized report for Ruby dependency install logs. |
| modules/shell/index.ts | Uses raw() for install scripts and report.* for messaging. |
| modules/shell/help.ts | Standardizes help/generic output through report.info. |
| modules/projects/index.ts | Uses centralized report for module output. |
| modules/open/index.ts | Uses centralized report for module output. |
| modules/open/help.ts | Standardizes help/generic output through report.info. |
| modules/ls/index.ts | Uses centralized report for module output. |
| modules/lan/index.ts | Uses raw() for tabular/piped-style output and report for other logs. |
| modules/lan/help.ts | Standardizes help/generic output through report.info. |
| modules/ip/index.ts | Uses raw() for formatted key/value output and centralized report. |
| modules/help/index.ts | Uses raw() for complex multi-line help rendering and report for errors. |
| modules/default/index.ts | Standardizes default module messaging via report.*. |
| modules/debug/index.ts | Uses raw() for debug output payload instead of console.log. |
| modules/create/index.ts | Uses centralized report for module output. |
| modules/create/help.ts | Standardizes help/generic output through report.info. |
| modules/config/index.ts | Uses centralized report for module output. |
| modules/config/help.ts | Standardizes help/generic output through report.info. |
| modules/clone/index.ts | Uses centralized report for module output. |
| modules/clone/help.ts | Standardizes help/generic output through report.info. |
| modules/clean/index.ts | Uses centralized report for module output. |
| modules/checkout/index.ts | Uses centralized report for module output. |
| modules/checkout/help.ts | Standardizes help/generic output through report.info. |
| modules/cd/index.ts | Uses centralized report for module output. |
| modules/_cd/index.ts | Uses centralized report for module output. |
| modules/_cd/kv.ts | Uses raw() for spacing/newlines and centralized report for messages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| import sudoBlock from "sudo-block"; | ||
|
|
||
| import { report } from "./utils/logger.ts"; |
There was a problem hiding this comment.
This PR aims to standardize logging, but main.ts still writes version output via console.log(getCurrentVersion()). Consider switching that to the centralized raw() logger (and import raw here) so all CLI output routes through utils/logger.ts while still keeping the --version output unformatted/pipeline-friendly.
| import path from "path"; | ||
| import report from "yurnalist"; | ||
| import { report } from "./utils/logger.ts"; | ||
| import process from "process"; |
There was a problem hiding this comment.
test.ts still uses direct console.log for blank lines and catch(console.error) at the end. To fully apply the new logging rules described in the PR, route these through raw() (for the newline spacing) and report.error (for the catch handler) so logging is consistently centralized.
Summary
utils/logger.tswith centralized loggerconsole.log/console.errorwithreport.success/error/info/warnraw()for piped output and complex formattingChanges
New File
utils/logger.ts- Centralized logger withreport(yurnalist) +raw()(console.log)Logging Rules Applied
report.success()report.error()report.info()report.warn()raw()raw()Files Updated (34 files)
main.tsrelease.ts,test.tsutils/logger.ts,utils/release.ts,utils/spinner.tsTesting