feat: Log warnings once - #2536
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
aklinker1
left a comment
There was a problem hiding this comment.
Looks good other than the callback setup you're using. It adds a bit of overhead every time wxt.logger is accessed - see comments for recommended changes
Thank you for review this PR. Let me update it. Thank you. |
d284646 to
71d1c25
Compare
71d1c25 to
644b8f4
Compare
There was a problem hiding this comment.
I cleaned up the tests a little - mocked dependencies for the resolve-config.test.ts (e2e tests setup directories, not unit), and used mock instead of fully defining a fake logger instance. I also changed the logic to share the warn set between all instances of WxtLogger, not per-instance.
@wxt-dev/analytics
@wxt-dev/auto-icons
@wxt-dev/browser
@wxt-dev/i18n
@wxt-dev/is-background
@wxt-dev/module-react
@wxt-dev/module-solid
@wxt-dev/module-svelte
@wxt-dev/module-vue
@wxt-dev/runner
@wxt-dev/storage
@wxt-dev/unocss
@wxt-dev/webextension-polyfill
wxt
commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2536 +/- ##
==========================================
+ Coverage 79.18% 79.37% +0.19%
==========================================
Files 133 134 +1
Lines 3982 3996 +14
Branches 923 924 +1
==========================================
+ Hits 3153 3172 +19
+ Misses 733 729 -4
+ Partials 96 95 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for helping make WXT better! |
Overview
wxt.loggerwithcreateWxtLoggerto addwarnOnce(the Logger type itself stays unchanged)Setis created once inregisterWxtand delegates through a closure that always reads the currentwxt.config.loggerreloadConfig(), somanifest.tswarnings no longer repeat on dev-server restartsManual Testing
warnOncewarnonly once, on the first call, with those exact argumentsdelegationdebug/log/info/error/fatal/successare all passed straight through to the underlying loggerlevelis reflected on the underlying loggerRelated Issue
This PR closes #2507