-
Notifications
You must be signed in to change notification settings - Fork 25
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
fix: logify could panic if truncating mid-code point #70
Conversation
This pull request has been linked to Shortcut Story #226261: Fix logify panic in rust eventsource. |
@@ -79,13 +79,9 @@ pub struct Event { | |||
} | |||
|
|||
const LOGIFY_MAX_CHARS: usize = 100; | |||
fn logify(bytes: &[u8]) -> &str { | |||
fn logify(bytes: &[u8]) -> String { |
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.
At the default logging level how often do we call this function?
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.
We only call this method for trace and debug, so it shouldn't be executed at all with a default logging configuration, I wouldn't think.
Wanting to drop this truncation functionality entirely?
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.
I was just checking that it wasn't all the time. I am down with this change.
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.
I do think we should consider an alternative longer term. (dropping it and doing it in a logger or something.)
🤖 I have created a release *beep* *boop* --- ## [0.12.1](0.12.0...0.12.1) (2023-12-12) ### Bug Fixes * logify could panic if truncating mid-code point ([#70](#70)) ([37316c4](37316c4)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
No description provided.