lifetime_tracer/lib.rs
1pub struct InfoGuard {
2 instant: std::time::Instant,
3 message: String,
4}
5
6impl InfoGuard {
7 pub fn new(message: String) -> InfoGuard {
8 InfoGuard {
9 instant: std::time::Instant::now(),
10 message,
11 }
12 }
13}
14
15impl Drop for InfoGuard {
16 fn drop(&mut self) {
17 tracing::info!(message=self.message.as_str(), elapsed=tracing::field::debug(self.instant.elapsed()));
18 }
19}