| 120 | |
| 121 | impl CommandLog { |
| 122 | pub(crate) fn start(matches: &clap::ArgMatches) -> Self { |
| 123 | let span = tracing::info_span!("atomic", cmd = %command_path(matches)).entered(); |
| 124 | let cwd = std::env::current_dir() |
| 125 | .map(|dir| dir.display().to_string()) |
| 126 | .unwrap_or_default(); |
| 127 | tracing::info!( |
| 128 | target: COMMAND_TARGET, |
| 129 | version = env!("CARGO_PKG_VERSION"), |
| 130 | cwd = %cwd, |
| 131 | "command started" |
| 132 | ); |
| 133 | Self { _span: span } |
| 134 | } |
| 135 | |
| 136 | /// Log the outcome. The span closes when `self` drops here, logging how |
| 137 | /// long the command took. URLs in the error lose their credentials. |