Skip to content

fix: standardize logging across codebase#147

Open
amir-s wants to merge 2 commits into
mainfrom
fix/logging-consistency
Open

fix: standardize logging across codebase#147
amir-s wants to merge 2 commits into
mainfrom
fix/logging-consistency

Conversation

@amir-s
Copy link
Copy Markdown
Owner

@amir-s amir-s commented Mar 9, 2026

Summary

  • Create utils/logger.ts with centralized logger
  • Replace console.log/console.error with report.success/error/info/warn
  • Use raw() for piped output and complex formatting
  • Update all 34 files to use new logger

Changes

New File

  • utils/logger.ts - Centralized logger with report (yurnalist) + raw() (console.log)

Logging Rules Applied

Output Type Method
Success report.success()
Error report.error()
Info report.info()
Warning report.warn()
Raw/piped output raw()
Complex help text raw()

Files Updated (34 files)

  • main.ts
  • release.ts, test.ts
  • utils/logger.ts, utils/release.ts, utils/spinner.ts
  • All module index.ts and help.ts files

Testing

  • ✅ Type check passes
  • ✅ All 13 tests pass
  • ✅ Help command works correctly

amir-s added 2 commits March 9, 2026 17:02
- 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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.ts to centralize logging (report + raw()).
  • Replace most console.log/console.error usage across the CLI with report.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.

Comment thread main.ts

import sudoBlock from "sudo-block";

import { report } from "./utils/logger.ts";
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment thread test.ts
Comment on lines 1 to 3
import path from "path";
import report from "yurnalist";
import { report } from "./utils/logger.ts";
import process from "process";
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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.

2 participants