feat(kit): RFC - Unified Logging API proposal #155
+1,561
−0
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.
Description
This PR proposes a unified logging API for Vite DevTools to replace scattered
console.*calls with a consistent, configurable logging system. This is an RFC/proposal for discussion - feedback welcome!Related TODOs in codebase:
// TODO: A unified logger APIinpackages/core/src/client/webcomponents/state/setup-script.ts// TODO: implement logsinpackages/core/src/node/host-docks.tsMotivation
Currently, logging in Vite DevTools is inconsistent:
[VITE DEVTOOLS],[Vite DevTools],[vite-devtools],⬢Proposed API
What's Included
docs/rfcs/0001-unified-logging-api.mddocs/rfcs/0001-unified-logging-api-examples.mdpackages/kit/src/utils/logger-types.tspackages/kit/src/utils/logger-node.tspackages/kit/src/utils/logger-client.tspackages/kit/src/utils/log-collector.tspackages/kit/src/utils/logger.test.tsKey Features
logger.child()debug | info | warn | error | silentwith filteringlogger.info('msg', { key: value })LogCollectorenables the planned "Logs" dock panellogger.setLevel('debug')and env var supportExample Migration
Before:
After:
Open Questions
Next Steps (if approved)
console.*calls across packagesisHidden: false)Looking for feedback on the overall approach before proceeding with the full migration!
Linked Issues
#9
Additional context