Skip to content

Conversation

@matejchalk
Copy link
Collaborator

@matejchalk matejchalk commented Oct 17, 2025

Part of #888

This PR implements and tests a new custom Logger class, intended to replace our current logging with @poppinss/cliui, multi-progress-bars, etc. To minimize the scope of this PR, the new logger is unused. I've included a demo script and have tested the implementation manually in GitHub Actions and GitLab CI/CD. There's a comprehensive integration test suite and documentation.

Features

  • Standardized colors for log levels (ansis).
  • Automatically toggles debug logs depending on --verbose flag or CP_VERBOSE environment variable.
  • Renders spinners for asynchronous tasks (ora).
  • Render log groups, useful for executing plugins.
    • Supports spinners within groups.
    • Prefers native collapsible log groups if GITHUB_ACTIONS or GITLAB_CI environment detected.
  • Automatically logs durations for async spinners and groups.
  • Handles errors to ensure it's clear in which task an error was thrown. Also handles signal interruption.
  • Propagates state (group, verbosity) to other logger instances, so logs from plugins should be rendered properly.

Examples

🎥 Default (local) - colors, spinners, groups
screen-capture.-.2025-10-17T175651.556.webm
🎥 Verbose - debug logs
screen-capture.-.2025-10-17T175515.228.webm
🎥 CI - spinners disabled
screen-capture.-.2025-10-17T180140.476.webm
🖼️ GitHub Actions - groups log lines using workflow commands (always collapsed by default) image

source: workflow run

🖼️ GitLab CI/CD - renders collapsible sections (collapsed by default, unless verbose) image

source: pipeline run

🎥 Error handling in plugin - completes spinner and group before re-throw
screen-capture.-.2025-10-17T180300.976.webm
🎥 Error handling in core - completes spinner before re-throw
screen-capture.-.2025-10-17T180344.316.webm
🎥 Error handling for SIGINT cancellation - completes spinner before exiting
screen-capture.-.2025-10-17T180603.703.webm

@nx-cloud
Copy link

nx-cloud bot commented Oct 17, 2025

View your CI Pipeline Execution ↗ for commit d3ff1a9

Command Status Duration Result
nx code-pushup --nx-bail -- compare ✅ Succeeded 49s View ↗
nx code-pushup --nx-bail -- ✅ Succeeded 1m 3s View ↗
nx code-pushup --nx-bail -- print-config --outp... ✅ Succeeded 3m 49s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-17 17:55:21 UTC

@nx-cloud
Copy link

nx-cloud bot commented Oct 17, 2025

View your CI Pipeline Execution ↗ for commit 963eebd

Command Status Duration Result
nx affected -t unit-test --parallel=3 ❌ Failed 8s View ↗
nx affected -t int-test --parallel=3 ✅ Succeeded 6s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-17 15:44:27 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 17, 2025

Open in StackBlitz

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1129

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1129

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1129

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1129

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1129

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1129

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1129

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1129

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1129

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1129

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1129

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1129

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1129

@code-pushup/models-transformers

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models-transformers@1129

commit: d3ff1a9

@matejchalk matejchalk force-pushed the logger-implementation branch from 963eebd to f525e5c Compare October 17, 2025 16:57
@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 2025

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit d073ab6 with previous commit 42fa531.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Documentation 🔴 24 🔴 36 ↑ +11.2
Performance 🔴 35 🔴 34 ↓ −1
Updates 🟡 81 🟡 81 ↑ +0.5
Code coverage 🟡 90 🟢 90 ↑ +0.3
Security 🟡 56 🟡 56
Accessibility 🟢 92 🟢 92
Best Practices 🟢 100 🟢 100
SEO 🟡 61 🟡 61
Type Safety 🟢 100 🟢 100
Bug prevention 🟢 100 🟢 100
Miscellaneous 🟢 100 🟢 100
Code style 🟢 100 🟢 100
👍 3 groups improved, 👎 1 group regressed, 👍 9 audits improved, 👎 4 audits regressed, 15 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
JSDoc coverage Documentation coverage 🔴 24 🔴 36 ↑ +11.2
Lighthouse Performance 🔴 35 🔴 34 ↓ −1
JS Packages NPM outdated dependencies 🟡 81 🟡 81 ↑ +0.5
Code coverage Code coverage metrics 🟡 90 🟢 90 ↑ +0.3

17 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
JSDoc coverage Methods coverage 🟥 1 undocumented methods 🟨 9 undocumented methods ↑ +800 %
JSDoc coverage Classes coverage 🟥 8 undocumented classes 🟥 8 undocumented classes  +0 %
Lighthouse First Contentful Paint 🟥 3.3 s 🟥 3.1 s ↓ −3.9 %
Lighthouse Total Blocking Time 🟥 1,870 ms 🟥 2,420 ms ↑ +29.6 %
Lighthouse Speed Index 🟥 7.2 s 🟥 7.3 s ↑ +2.1 %
Lighthouse Time to Interactive 🟥 13.5 s 🟥 13.3 s ↓ −1 %
JS Packages Outdated NPM prod dependencies. 🟨 16 outdated package versions (4 major, 8 minor, 4 patch) 🟨 16 outdated package versions (4 major, 8 minor, 4 patch)  +0 %
JSDoc coverage Variables coverage 🟥 292 undocumented variables 🟥 293 undocumented variables ↑ +0.3 %
Code coverage Branch coverage 🟨 85.5 % 🟨 85.8 % ↑ +0.4 %
Code coverage Line coverage 🟨 86.3 % 🟨 86.6 % ↑ +0.3 %
Code coverage Function coverage 🟩 92.5 % 🟩 92.8 % ↑ +0.3 %
JSDoc coverage Types coverage 🟥 241 undocumented types 🟥 243 undocumented types ↑ +0.8 %
JSDoc coverage Functions coverage 🟥 520 undocumented functions 🟥 525 undocumented functions ↑ +1 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,033 KiB 🟩 Total size was 2,029 KiB ↓ −0.2 %
Lighthouse Minimizes main-thread work 🟥 12.6 s 🟥 14.0 s ↑ +11.7 %
Lighthouse Uses efficient cache policy on static assets 🟨 30 resources found 🟨 30 resources found ↑ +0.1 %
Lighthouse Server Backend Latencies 🟩 2,070 ms 🟩 1,230 ms ↓ −40.6 %
Lighthouse JavaScript execution time 🟥 5.0 s 🟥 5.6 s ↑ +12.5 %
Lighthouse Largest Contentful Paint 🟥 12.0 s 🟥 11.4 s ↓ −4.7 %
Lighthouse Initial server response time was short 🟥 Root document took 660 ms 🟥 Root document took 800 ms ↑ +21.2 %
Lighthouse Metrics 🟩 100% 🟩 100% ↓ −1 %
Lighthouse Remove duplicate modules in JavaScript bundles 🟥 Potential savings of 99 KiB 🟥 Potential savings of 99 KiB ↑ +40.6 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 180 KiB 🟥 Potential savings of 180 KiB ↓ −5.3 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 102 KiB 🟥 Potential savings of 102 KiB ↓ −4.8 %
Lighthouse Max Potential First Input Delay 🟥 1,410 ms 🟥 1,430 ms ↑ +1.7 %
Lighthouse Network Round Trip Times 🟩 50 ms 🟩 70 ms ↑ +45.5 %
JSDoc coverage Properties coverage 🟥 4 undocumented properties 🟥 14 undocumented properties ↑ +250 %
Lighthouse Cumulative Layout Shift 🟩 0 🟩 0 ↓ −100 %

582 other audits are unchanged.

@matejchalk matejchalk force-pushed the logger-implementation branch 3 times, most recently from 1b97d8c to 4fd1e6c Compare October 17, 2025 17:23
@matejchalk matejchalk force-pushed the logger-implementation branch from 4fd1e6c to d3ff1a9 Compare October 17, 2025 17:40
@matejchalk matejchalk marked this pull request as ready for review October 17, 2025 17:55
@matejchalk matejchalk requested a review from BioPhoton as a code owner October 17, 2025 17:55
@matejchalk matejchalk added the ➕ enhancement new feature or request label Oct 17, 2025
Copy link
Collaborator

@vmasek vmasek left a comment

Choose a reason for hiding this comment

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

awesome work 👏🏻

@matejchalk matejchalk merged commit a0057fe into main Oct 22, 2025
22 checks passed
@matejchalk matejchalk deleted the logger-implementation branch October 22, 2025 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants