summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2020-02-27 11:10:45 +0000
committerEmīls <emils@mullvad.net>2020-02-28 16:46:51 +0000
commit8df4899320a68f5800e197515c35b6ae3d7521d7 (patch)
tree99162b75a102a86918881275c30d92ac764827de
parent96cab3e773169f6be19aee8414265120254a9d6d (diff)
downloadmullvadvpn-8df4899320a68f5800e197515c35b6ae3d7521d7.tar.xz
mullvadvpn-8df4899320a68f5800e197515c35b6ae3d7521d7.zip
Factor exception logging to be multi-platform
-rw-r--r--mullvad-daemon/src/exception_logging/mod.rs11
-rw-r--r--mullvad-daemon/src/exception_logging/unix.rs3
-rw-r--r--mullvad-daemon/src/exception_logging/win.rs (renamed from mullvad-daemon/src/windows_exception_logging.rs)0
-rw-r--r--mullvad-daemon/src/lib.rs1
-rw-r--r--mullvad-daemon/src/main.rs6
5 files changed, 17 insertions, 4 deletions
diff --git a/mullvad-daemon/src/exception_logging/mod.rs b/mullvad-daemon/src/exception_logging/mod.rs
new file mode 100644
index 0000000000..c1962a1ca1
--- /dev/null
+++ b/mullvad-daemon/src/exception_logging/mod.rs
@@ -0,0 +1,11 @@
+#[cfg(windows)]
+mod win;
+
+#[cfg(windows)]
+pub use win::enable;
+
+#[cfg(unix)]
+mod unix;
+
+#[cfg(unix)]
+pub use unix::enable;
diff --git a/mullvad-daemon/src/exception_logging/unix.rs b/mullvad-daemon/src/exception_logging/unix.rs
new file mode 100644
index 0000000000..21514356ad
--- /dev/null
+++ b/mullvad-daemon/src/exception_logging/unix.rs
@@ -0,0 +1,3 @@
+pub fn enable() {
+ log::debug!("ENABLING EXCEPTION HANDLING");
+}
diff --git a/mullvad-daemon/src/windows_exception_logging.rs b/mullvad-daemon/src/exception_logging/win.rs
index c6e2422398..c6e2422398 100644
--- a/mullvad-daemon/src/windows_exception_logging.rs
+++ b/mullvad-daemon/src/exception_logging/win.rs
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index ffce1b4187..aa7912ebf6 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -5,6 +5,7 @@ extern crate serde;
mod account_history;
+pub mod exception_logging;
mod geoip;
pub mod logging;
#[cfg(not(target_os = "android"))]
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index 4928ba277e..8795861dbe 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -10,11 +10,10 @@ use std::{path::PathBuf, thread, time::Duration};
use talpid_types::ErrorExt;
mod cli;
+mod exception_logging;
mod shutdown;
#[cfg(windows)]
mod system_service;
-#[cfg(windows)]
-mod windows_exception_logging;
const DAEMON_LOG_FILENAME: &str = "daemon.log";
@@ -46,8 +45,7 @@ fn init_logging(config: &cli::Config) -> Result<Option<PathBuf>, String> {
)
.map_err(|e| e.display_chain_with_msg("Unable to initialize logger"))?;
log_panics::init();
- #[cfg(windows)]
- windows_exception_logging::enable();
+ exception_logging::enable();
version::log_version();
if let Some(ref log_dir) = log_dir {
info!("Logging to {}", log_dir.display());