-
Notifications
You must be signed in to change notification settings - Fork 268
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
Implement a custom event formatter for javascript logging #2856
Conversation
Somehow `fmt::pretty` manages to be both overcomplicated and not flexible enough. The driver here is that I want to put the event "fields" on a separate line to the message.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2856 +/- ##
==========================================
- Coverage 82.33% 82.18% -0.16%
==========================================
Files 211 211
Lines 21620 21659 +39
==========================================
- Hits 17801 17800 -1
- Misses 3819 3859 +40 ☔ View full report in Codecov by Sentry. |
I think the coverage metrics must be wrong here. There is definitely a test that runs this code and checks the result. I think it is run here although the test name seems to have sprouted an |
We don't (and probably can't) collect coverage on WASM-only code. You can change the |
Is that the right thing to do? If we're unable to measure code coverage on a portion of our code, it's probably better that our metrics reflect that, even if it means overriding the coverage check on PRs that touch that code? |
I don't think I have the authority to answer that question 😄 I'm fine merging with or without that. |
In this case, it should be possible to test |
The other argument can be made as well, if we know that the code is tested, why do we want code coverage to tell us it isn't? I think it's fine to disable coverage collection in this case, because:
Out of those, no 3 sounds the worst to me. Disabling the gathering with a comment explaining that we have tests sounds sensible to avoid this situation. What exactly do we gain from not disabling it? On the other hand, I have trouble understanding why this piece of code is even in the SDK repo. |
Those are fair arguments, particularly because in this case it is, in fact, tested. The counterpoint is if we start to accumulate (even more) cruft in this module which is not tested, and the metric won't pick it up. But let's agree not to do that.
Fair question. The reason that |
It sounds like you'd like to put this into a separate crate, the IndexedDB crate and the WASM bindings can then use this new crate. Something like https://github.com/jquesada2016/tracing_subscriber_wasm or https://github.com/old-storyai/tracing-wasm might also be interesting for the IndexedDB/tests case. In any case, I'm fine with disabling the gathering of the coverage and moving forward with this PR. |
Hrm yes. I hadn't found those before. One thing I wanted to achieve with I also like
Ok thanks; that is what I have done for now. |
/// An implementation of [`FormatEvent`] which formats events in a sensible way | ||
/// for sending events to the JS console. | ||
#[derive(Debug, Default)] | ||
pub struct JsEventFormatter {} |
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.
pub struct JsEventFormatter {} | |
#[non_exhaustive] | |
pub struct JsEventFormatter {} |
If we want to enforce that ::new()
is the way to create an instance.
Co-authored-by: Jonas Platte <[email protected]>
Somehow
fmt::pretty
manages to be both overcomplicated and not flexible enough.The driver here is that I want to put the event "fields" on a separate line to the message.