Skip to content

Commit 2840bdd

Browse files
committed
refator(common): Rename TracingTimer::new_debug.
This patch renames `TracingTiming::new_debug` to `new`. The documentation claims it sets the log level to `debug` while the `level` is actually an argument of the constructor. It's then wrong, and the constructor must be renamed.
1 parent e74511b commit 2840bdd

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

crates/matrix-sdk-common/src/tracing_timer.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl std::fmt::Debug for TracingTimer {
3333

3434
impl Drop for TracingTimer {
3535
fn drop(&mut self) {
36-
let message = format!("`{}` finished in {:?}", self.id, self.start.elapsed());
36+
let message = format!("{} finished in {:?}", self.id, self.start.elapsed());
3737

3838
let enabled = tracing::level_enabled!(self.level) && {
3939
let interest = self.callsite.interest();
@@ -62,12 +62,8 @@ impl Drop for TracingTimer {
6262
}
6363

6464
impl TracingTimer {
65-
/// Create a new `TracingTimer` at the `debug` log level.
66-
pub fn new_debug(
67-
callsite: &'static DefaultCallsite,
68-
id: String,
69-
level: tracing::Level,
70-
) -> Self {
65+
/// Create a new `TracingTimer`.
66+
pub fn new(callsite: &'static DefaultCallsite, id: String, level: tracing::Level) -> Self {
7167
Self { id, callsite, start: Instant::now(), level }
7268
}
7369
}
@@ -111,7 +107,7 @@ macro_rules! timer {
111107
fields: []
112108
};
113109

114-
$crate::tracing_timer::TracingTimer::new_debug(&__CALLSITE, $string.into(), $level)
110+
$crate::tracing_timer::TracingTimer::new(&__CALLSITE, $string.into(), $level)
115111
}};
116112

117113
($string:expr) => {

0 commit comments

Comments
 (0)