I need to log to OSLog
and into a file in parallel (due to OSLogStore not being able to provide old logs (FB13191608)).
In Objective-C I can accomplish this with a macro using __FILE__
and __LINE__
in the macro implementation which still reference the position in the original code.
I tried to create a Swift macro to make this work from Swift. However, log()
takes the file and line number of the macro definition file instead of the position in the calling code. So when I click on the metadata link, I'm taken to the macro instead of the calling location.
Is there any solution to that? #file
and #line
are correctly set in the macro but there’s no way to specify file and line number to the log()
function (FB13204310).