diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-06-21 19:46:50 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-06-25 14:43:18 +0000 |
| commit | 7f6eb7d0d506e2055bc789a08693c6f8cb0b70f0 (patch) | |
| tree | 549c5a12ccc29dc9017660a7ef88b2a3db12c490 | |
| parent | 58590ea31af530bca88b155d33aedc5d53a8b9c7 (diff) | |
| download | mullvadvpn-7f6eb7d0d506e2055bc789a08693c6f8cb0b70f0.tar.xz mullvadvpn-7f6eb7d0d506e2055bc789a08693c6f8cb0b70f0.zip | |
Include logcat in collected problem report logs
| -rw-r--r-- | Cargo.lock | 1 | ||||
| -rw-r--r-- | mullvad-problem-report/Cargo.toml | 4 | ||||
| -rw-r--r-- | mullvad-problem-report/src/lib.rs | 16 |
3 files changed, 21 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock index 5aab93823a..f98147de1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1196,6 +1196,7 @@ version = "2019.5.0" dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "duct 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "err-derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml index b62350797b..30748fdde2 100644 --- a/mullvad-problem-report/Cargo.toml +++ b/mullvad-problem-report/Cargo.toml @@ -32,6 +32,10 @@ mullvad-rpc = { path = "../mullvad-rpc" } talpid-types = { path = "../talpid-types" } +[target.'cfg(target_os = "android")'.dependencies] +duct = "0.12" + + [target.'cfg(target_os = "linux")'.dependencies] rs-release = { git = "https://github.com/mullvad/rs-release", branch = "snailquote-unescape" } diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs index 4fa42413fa..d18467c069 100644 --- a/mullvad-problem-report/src/lib.rs +++ b/mullvad-problem-report/src/lib.rs @@ -151,6 +151,11 @@ pub fn collect_report( } None => {} } + #[cfg(target_os = "android")] + match write_logcat_to_file() { + Ok(logcat_path) => problem_report.add_log(&logcat_path), + Err(error) => problem_report.add_error("Failed to collect logcat", &error), + } problem_report.add_logs(extra_logs); @@ -229,6 +234,17 @@ fn is_tunnel_log(path: &Path) -> bool { } } +#[cfg(target_os = "android")] +fn write_logcat_to_file() -> Result<PathBuf, io::Error> { + let logcat_path = PathBuf::from("/data/data/net.mullvad.mullvadvpn/logcat.txt"); + + duct::cmd!("logcat", "-d") + .stderr_to_stdout() + .stdout(&logcat_path) + .run() + .map(|_| logcat_path) +} + pub fn send_problem_report( user_email: &str, user_message: &str, |
