summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mullvad-daemon/src/logging.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/mullvad-daemon/src/logging.rs b/mullvad-daemon/src/logging.rs
index 2168597494..b8cc898bc7 100644
--- a/mullvad-daemon/src/logging.rs
+++ b/mullvad-daemon/src/logging.rs
@@ -113,6 +113,8 @@ impl Formatter {
message: &fmt::Arguments,
record: &log::Record,
) {
+ let message = escape_newlines(format!("{}", message));
+
out.finish(format_args!(
"{}[{}][{}] {}",
chrono::Local::now().format(self.get_timetsamp_fmt()),
@@ -122,3 +124,13 @@ impl Formatter {
))
}
}
+
+#[cfg(not(windows))]
+fn escape_newlines(text: String) -> String {
+ text
+}
+
+#[cfg(windows)]
+fn escape_newlines(text: String) -> String {
+ text.replace("\n", LINE_SEPARATOR)
+}