summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadLogging/LogFileOutputStream.swift
diff options
context:
space:
mode:
Diffstat (limited to 'ios/MullvadLogging/LogFileOutputStream.swift')
-rw-r--r--ios/MullvadLogging/LogFileOutputStream.swift7
1 files changed, 7 insertions, 0 deletions
diff --git a/ios/MullvadLogging/LogFileOutputStream.swift b/ios/MullvadLogging/LogFileOutputStream.swift
index 17d335849e..7f4eec3a0b 100644
--- a/ios/MullvadLogging/LogFileOutputStream.swift
+++ b/ios/MullvadLogging/LogFileOutputStream.swift
@@ -75,6 +75,13 @@ class LogFileOutputStream: TextOutputStream {
}
}
+ /// Waits for write operations to finish by issuing a synchronous closure.
+ /// - Note: This function is mainly used in unit tests to facilitate acting
+ /// on disk writes. It should typically not be used in production code.
+ func synchronize() {
+ queue.sync {}
+ }
+
private func writeOnQueue(_ string: String) {
guard let data = string.data(using: encoding) else { return }