diff --git a/rust/Cargo.lock b/rust/Cargo.lock --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -569,7 +569,10 @@ name = "rhg" version = "0.1.0" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "hg-core 0.1.0", + "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "micro-timer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/rust/rhg/Cargo.toml b/rust/rhg/Cargo.toml --- a/rust/rhg/Cargo.toml +++ b/rust/rhg/Cargo.toml @@ -7,4 +7,6 @@ edition = "2018" [dependencies] hg-core = { path = "../hg-core"} clap = "2.33.1" - +log = "0.4.11" +micro-timer = "0.3.1" +env_logger = "0.7.1" diff --git a/rust/rhg/src/commands/debugdata.rs b/rust/rhg/src/commands/debugdata.rs --- a/rust/rhg/src/commands/debugdata.rs +++ b/rust/rhg/src/commands/debugdata.rs @@ -5,6 +5,7 @@ use crate::ui::Ui; use hg::operations::{ DebugData, DebugDataError, DebugDataErrorKind, DebugDataKind, }; +use micro_timer::timed; pub const HELP_TEXT: &str = " Dump the contents of a data file revision @@ -22,6 +23,7 @@ impl<'a> DebugDataCommand<'a> { } impl<'a> Command for DebugDataCommand<'a> { + #[timed] fn run(&self, ui: &Ui) -> Result<(), CommandError> { let mut operation = DebugData::new(self.rev, self.kind); let data = diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs +++ b/rust/rhg/src/main.rs @@ -1,3 +1,4 @@ +extern crate log; use clap::App; use clap::AppSettings; use clap::Arg; @@ -15,6 +16,7 @@ use commands::Command; use error::CommandError; fn main() { + env_logger::init(); let app = App::new("rhg") .setting(AppSettings::AllowInvalidUtf8) .setting(AppSettings::SubcommandRequired)