Skip to content

Hide filepath and function names in release binary #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Client/iOS/NSLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#define LoggerAd(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Ad and Stat", level, __VA_ARGS__)

#else
#define NSLog(...) LogMessageCompat(__VA_ARGS__)
// #define NSLog(...) LogMessageCompat(__VA_ARGS__)
#define LoggerError(...) while(0) {}
#define LoggerApp(level, ...) while(0) {}
#define LoggerView(...) while(0) {}
Expand Down
26 changes: 16 additions & 10 deletions Client/iOS/NSLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,34 +125,40 @@ public final class Logger {
public func log(_ domain: Domain,
_ level: Level,
_ message: @autoclosure () -> String,
_ file: String = #file,
_ file: String = "",
_ line: Int = #line,
_ function: String = #function) {
_ function: String = "") {
whenEnabled {
LogMessage_noFormat(file, line, function, domain.rawValue, level.rawValue, message())
let filePath = #file
let functionName = #function
LogMessage_noFormat(filePath, line, functionName, domain.rawValue, level.rawValue, message())
}
}

public func log(_ domain: Domain,
_ level: Level,
_ image: @autoclosure () -> Image,
_ file: String = #file,
_ file: String = "",
_ line: Int = #line,
_ function: String = #function) {
_ function: String = "") {
whenEnabled {
guard let rawImage = imageData(image()) else { return }
LogImage_noFormat(file, line, function, domain.rawValue, level.rawValue, rawImage.width, rawImage.height, rawImage.data)
let filePath = #file
let functionName = #function
LogImage_noFormat(filePath, line, functionName, domain.rawValue, level.rawValue, rawImage.width, rawImage.height, rawImage.data)
}
}

public func log(_ domain: Domain,
_ level: Level,
_ data: @autoclosure () -> Data,
_ file: String = #file,
_ file: String = "",
_ line: Int = #line,
_ function: String = #function) {
_ function: String = "") {
whenEnabled {
LogData_noFormat(file, line, function, domain.rawValue, level.rawValue, data())
let filePath = #file
let functionName = #function
LogData_noFormat(filePath, line, functionName, domain.rawValue, level.rawValue, data())
}
}
}
Expand Down