Skip to content

fix: create spinner-aware logger to more easily avoid jumbled logs#140

Merged
tonzhan2 merged 2 commits intomainfrom
spinner-aware-logger
May 22, 2025
Merged

fix: create spinner-aware logger to more easily avoid jumbled logs#140
tonzhan2 merged 2 commits intomainfrom
spinner-aware-logger

Conversation

@mvirgil
Copy link
Copy Markdown
Contributor

@mvirgil mvirgil commented May 22, 2025

spinner.interrupt functionality already existed, but it required code to manually use it.

createLogger now accepts a spinner, so any calls to such a logger will automatically go through spinner.interrupt for safe logging when a spinner is present

Before (the active spinner text "Uploading ..." stays in the console and jumbles some of the debug logs):

⠸ Uploading dist/multiErrorBundle.js.map | 37.7KB | 2 file(s) remainingDEBUG upload warning check: found source map pair (using standard naming convention)
DEBUG   - dist/clientBundle.js
DEBUG   - dist/clientBundle.js.map
WARN No sourceMapId was found in the related JavaScript file dist/clientBundle.js. Make sure to run the "sourcemaps inject" command in addition to "sourcemaps upload".  Use --help to learn more.
⠼ Uploading dist/multiErrorBundle.js.map | 37.7KB | 2 file(s) remainingDEBUG attachApiInterceptor called with full URL

After (the active spinner text "Uploading..." is no longer present after command is finished, and logs take up their own line as expected):

DEBUG upload warning check: found source map pair (using standard naming convention)
DEBUG   - dist/clientBundle.js
DEBUG   - dist/clientBundle.js.map
WARN No sourceMapId was found in the related JavaScript file dist/clientBundle.js. Make sure to run the "sourcemaps inject" command in addition to "sourcemaps upload".  Use --help to learn more.
DEBUG attachApiInterceptor called with full URL

@mvirgil mvirgil requested review from a team as code owners May 22, 2025 22:23
@mvirgil mvirgil force-pushed the spinner-aware-logger branch from 92fa42f to fdb822c Compare May 22, 2025 22:23
spinner.interrupt functionality already existed, but it required
code to manually use it.

createLogger now accepts a spinner, so any calls to such a logger
will automatically go through spinner.interrupt for safe
logging when a spinner is present
@mvirgil mvirgil force-pushed the spinner-aware-logger branch from fdb822c to dcc8d05 Compare May 22, 2025 22:24
@tonzhan2 tonzhan2 merged commit a0a7a89 into main May 22, 2025
2 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants