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
+12 -10

No files matched your search

+11 -9
View File
@@ -30,17 +30,19 @@ class Logger : NSObject, MP42Logging {
}
func write(toLog string: String) {
let output = "\(currentTime()) \(string)\n"
queue.sync {
let output = "\(currentTime()) \(string)\n"
_ = fileURL.withUnsafeFileSystemRepresentation {
if let file = fopen($0, "a") {
fputs(output, file)
fclose(file)
_ = fileURL.withUnsafeFileSystemRepresentation {
if let file = fopen($0, "a") {
fputs(output, file)
fclose(file)
}
}
if let delegate = delegate {
delegate.write(toLog: output)
}
}
if let delegate = delegate {
delegate.write(toLog: output)
}
}
@@ -18,7 +18,7 @@ class MultiSelectViewController : NSViewController {
if numberOfTracks == 1 {
label.stringValue = NSLocalizedString("1 track selected", comment: "")
} else {
label.stringValue = String(format: NSLocalizedString("%lu tracks selected", comment: ""), numberOfTracks)
label.stringValue = String.localizedStringWithFormat(NSLocalizedString("%lu tracks selected", comment: ""), numberOfTracks)
}
}
}