Say we have multiple threads issuing prints. Typically when downloading stuffs as follows:
let url = self.url
print("loadPreview(\(source) for \(url)): ↝start loading \(self.url")
let task = session.downloadTask(with: url) {
(localUrl, response, error) in
print("loadPreview(\(source) for \(url)): == \(self.url")
}
Is there any way to make print atomic and prevent output as follows?
loadPreview(WSJ for www.wsj.co⟷TloadPreview(9loadPreview(appleins for appleinsid⟷n-messages): ↝start loading http://app⟷n-messages