The problem is not in the logToFile, since as you mention, #file and #line do the right thing. The problem is on the OSLog side. The log.log("answer: \(42)") logs with the file and line number of the macro, not the calling site. So the linked code location is always in the macro, making the link useless.
Topic:
App & System Services
SubTopic:
Core OS
Tags: