Open
Description
In Objective C if I use the macros defined in NSLogger.h completely disable NSLogger and logging message strings don't show up in the release binary.
In Swift, in the release binary, the logging functionality is disabled but the logging message strings remain hardcoded in the released binary.
Is there any way to strip those logging strings completely from the release binary?
Metadata
Metadata
Assignees
Labels
No labels
Activity
fpillet commentedon Feb 10, 2020
That's a very good question. This is interesting because last time I checked the call was optimized out completely. This may be an issue with the Swift optimizer which eliminates the call a point-of-log, but may not remove the closure it auto-generates from the string... Thanks for pointing this out!
As of now, I don't have a hint at how one could fix it.
Tibbs commentedon Feb 10, 2020
Thank you @fpillet. This is what I thought.
Hopefully, someone will suggest an easy fix. I will look into this as well.
Tibbs commentedon Feb 13, 2020
I couldn't find a solution for the text in the closure, but I also noticed that #file and #function attributes are behaving the same way, leaving the absolute path and function name in the binary. It increases the size of the binary and exposes the user name of the developer.
It is much easier to fix. For example, changing the code in NSLogger.swift from this:
to this resolves this issue:
Tibbs commentedon Jun 16, 2020
Pull request to remove #file and #function strings from release binary
#292