-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SM-1384] Fix panic on re-registering logger | WASM #935
Conversation
No New Or Fixed Issues Found |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #935 +/- ##
=======================================
Coverage 58.45% 58.45%
=======================================
Files 194 194
Lines 13358 13357 -1
=======================================
Hits 7808 7808
+ Misses 5550 5549 -1 ☔ View full report in Codecov by Sentry. |
crates/bitwarden-wasm/src/client.rs
Outdated
console_log::init_with_level(convert_level(log_level.unwrap_or(LogLevel::Info))) | ||
{ | ||
panic!("failed to initialize logger: {:?}", e); | ||
warn!("Logger already initialized, log level will not be changed."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably going to be confusing to get a warning when you setup multiple sdk clients. If we do want to warn about this we should check if the log level is different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, at the time of looking at the console_log
crate, I didn't think it was possible.
After further research, I found out we can use the log crate functions, and we can just set the level.
Thoughts on this approach?
https://docs.rs/log/0.4.22/log/fn.set_max_level.html
Edit here 3a86e8e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. Do we need to update the other bindings with similar behaviour?
As discussed with the SM team, merging this. QA will handle testing on |
🎟️ Tracking
https://bitwarden.atlassian.net/browse/SM-1384
📔 Objective
When creating multiple WASM clients, a panic occurs
failed to initialize logger: SetLoggerError())
.Looks to be the same thing we fixed:
#181
#676
⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes