Log a command invocation. Non-blocking and best-effort — failures are silently ignored to avoid disrupting the user's workflow.
(
&self,
command: &str,
duration: Duration,
success: bool,
error_code: Option<u32>,
)
| 158 | /// Non-blocking and best-effort — failures are silently ignored |
| 159 | /// to avoid disrupting the user's workflow. |
| 160 | pub fn log_command( |
| 161 | &self, |
| 162 | command: &str, |
| 163 | duration: Duration, |
| 164 | success: bool, |
| 165 | error_code: Option<u32>, |
| 166 | ) { |
| 167 | let entry = json!({ |
| 168 | "timestamp": SystemTime::now() |
| 169 | .duration_since(UNIX_EPOCH) |
| 170 | .map(|d| d.as_secs_f64()) |
| 171 | .unwrap_or(0.0), |
| 172 | "command": command, |
| 173 | "duration_ms": duration.as_millis() as u64, |
| 174 | "success": success, |
| 175 | "error_code": error_code, |
| 176 | }); |
| 177 | self.worker.send(LogEntry { |
| 178 | path: self.log_path(), |
| 179 | line: entry.to_string(), |
| 180 | }); |
| 181 | } |
| 182 | |
| 183 | /// Shut down the telemetry worker gracefully. |
| 184 | /// |
no test coverage detected