-
Notifications
You must be signed in to change notification settings - Fork 543
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
feat: lazy formatted log #1441
feat: lazy formatted log #1441
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1441 +/- ##
==========================================
+ Coverage 35.91% 43.53% +7.62%
==========================================
Files 69 76 +7
Lines 11576 12320 +744
==========================================
+ Hits 4157 5364 +1207
+ Misses 7104 6621 -483
- Partials 315 335 +20 |
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.
log和logf有必要合并下么?比如
fn log(&self, level: LogLevel, msg: &str) {
self.logf(level, format_args!("{}", msg));
}
现在通用格式化format!("[{}] {}", self.plugin_name, msg);
和level转换写在了两个地方,如果后面想改格式的话需要改多处
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.
LGTM
Ⅰ. Describe what this PR did
Current logging in wasm-rust needs to be formatted before level checking, it means even log level is less than configured, but the cost of formatting is wasted.
Provides a serials of
format log
methods, which usingArgument
as args and formatting message after level checking success.Ⅱ. Does this pull request fix one issue?
None
Ⅲ. Why don't you add test cases (unit test/integration test)?
None
Ⅳ. Describe how to verify it
None
Ⅴ. Special notes for reviews
None