Serialize the logger write method.

This commit is contained in:
Damiano Galassi committed 2017-10-24 09:24:01 +02:00
1 parent 5adafe89b4
commit a6d090c8ed
2 files changed
+3 -1

No files matched your search

+2
View File
@@ -30,6 +30,7 @@ class Logger : NSObject, MP42Logging {
} }
func write(toLog string: String) { func write(toLog string: String) {
queue.sync {
let output = "\(currentTime()) \(string)\n" let output = "\(currentTime()) \(string)\n"
_ = fileURL.withUnsafeFileSystemRepresentation { _ = fileURL.withUnsafeFileSystemRepresentation {
@@ -43,6 +44,7 @@ class Logger : NSObject, MP42Logging {
delegate.write(toLog: output) delegate.write(toLog: output)
} }
} }
}
func writeError(toLog error: Error) { func writeError(toLog error: Error) {
write(toLog: error.localizedDescription) write(toLog: error.localizedDescription)
@@ -18,7 +18,7 @@ class MultiSelectViewController : NSViewController {
if numberOfTracks == 1 { if numberOfTracks == 1 {
label.stringValue = NSLocalizedString("1 track selected", comment: "") label.stringValue = NSLocalizedString("1 track selected", comment: "")
} else { } else {
label.stringValue = String(format: NSLocalizedString("%lu tracks selected", comment: ""), numberOfTracks) label.stringValue = String.localizedStringWithFormat(NSLocalizedString("%lu tracks selected", comment: ""), numberOfTracks)
} }
} }
} }