Repository navigation
refactor(#10567): run logger plugins in production builds - #10645
Draft
nowgnuesLee wants to merge 1 commit into
Draft
nowgnuesLee wants to merge 1 commit into
nowgnuesLee wants to merge 1 commit into
Conversation
Logger.enabled is false in production, and logging() returned before any plugin ran, so a plugin registered with logger.use() never saw a log in a production build. Console output and plugin dispatch are now separate: beforeLog/afterLog/onError always run, and only the console call is gated by `enabled`, so the production console stays silent. With no plugin registered and the console disabled, logging() still returns immediately. BAIErrorBoundary now reports the render errors it catches through useBAILogger at ERROR level, with the component stack as the logger context, so a logger plugin (the analytics error reporter in the next layer) sees them. Adds a focused vitest for the dispatch rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
PR Analysis Report📚 Storybook PreviewGitHub Pages may take up to a minute to hydrate after the deploy. 🧩 Changed ComponentsNo component files changed in 2 other changed file(s) in
|
| File | Size | Gzip |
|---|---|---|
backend.ai-ui.js |
1338.0 kB | 322.8 kB |
dayjs.min-BjziuPGY.js |
98.5 kB | 27.7 kB |
th-DW1HC9yT.js |
46.4 kB | 9.8 kB |
el-DwFHFBMc.js |
40.7 kB | 10.9 kB |
ru-CD4r8kTm.js |
38.0 kB | 10.3 kB |
mn-Bcxmv4aG.js |
37.6 kB | 10.1 kB |
ja-DeIS-xF6.js |
32.5 kB | 9.5 kB |
vi-DvrElrOT.js |
30.7 kB | 9.1 kB |
fr-DLezUzhq.js |
29.6 kB | 9.1 kB |
ko-CVYezqMU.js |
29.1 kB | 9.1 kB |
es-DOGqPBB4.js |
28.8 kB | 8.8 kB |
de-Cxv_DDJp.js |
28.7 kB | 9.1 kB |
it-CxuP9FYL.js |
28.6 kB | 8.8 kB |
pt-BR-Cmj1Srfe.js |
28.4 kB | 8.7 kB |
pt-B1Vcq00v.js |
28.3 kB | 8.7 kB |
pl-D9BdB3IU.js |
28.2 kB | 9.2 kB |
tr-CFtJvQYC.js |
27.8 kB | 8.9 kB |
fi-Bkkfb504.js |
27.6 kB | 8.8 kB |
ms-BMskjiqC.js |
26.9 kB | 8.4 kB |
id-Yctu6r5_.js |
26.9 kB | 8.4 kB |
zh-TW-0jTqNnLf.js |
25.3 kB | 9.1 kB |
zh-CN-Do_WZ2ss.js |
25.1 kB | 9.0 kB |
No base measurement — the merge-base build was skipped (dependency changes, or the base build failed).
Contributor
Coverage Report for backend-ai-ui-coverage (./packages/backend.ai-ui)
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Contributor
Coverage Report for react-coverage (./react)
File Coverage
|
||||||||||||||||||||||||||||||||||||||
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #10567
useBAILoggerreturned before running any plugin when its console output was off, and console output is off in every production build. A plugin registered withlogger.use()therefore never saw a production log. This PR keeps the console silent in production but always runs the plugin hooks; with no plugin registered and the console off,logging()still returns immediately, so the default build pays nothing.It also makes
BAIErrorBoundarylog the error it catches at ERROR level, with the component stack as logger context, so render errors reach logger plugins (PostHog error tracking in an analytics build, #10644).Testing:
VERIFY_TESTS=1 bash scripts/verify.sh→=== ALL PASS ===packages/backend.ai-ui/src/hooks/useBAILogger.test.ts(5 cases): console output when enabled; plugins run while the console stays silent when disabled;beforeLogaborting skips the console andafterLog;withContextmetadata reaches plugins and is cleared afterwards; plugin failures reachonError.Risk:
Logger plugins now run in production builds; nothing registers one unless the analytics build does.
How to revert:
Revert the merged commit(s) of this PR.
Checklist: (if applicable)
pnpm run dev-env compat, not a number in the repository)E2E flow
Compared: none
Result: no flow change
Reason: logging internals only; no screen or step changes.