Created
January 23, 2021 17:58
-
-
Save RunesReader/24534950c6cde683674fb0dca5a1751a to your computer and use it in GitHub Desktop.
Debug Log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct Debug { | |
static func nslogDebug(_ message: String, function: String = #function, file: String = #file) { | |
if let range = file.range(of: "([A-z])*.swift", options: String.CompareOptions.regularExpression) { | |
let fileName = file[range.lowerBound..<range.upperBound] | |
logDebug(message: "****: \(fileName) \(function) - \(message)") | |
} | |
else { | |
logDebug(message: "****: \(function) - \(message)") | |
} | |
} | |
static func logDebug(message: String, function: String = #function) { | |
#if DEBUG | |
print("DEBUG: \(function) - \(message)") | |
#elseif STAGING | |
print("DEBUG: \(function) - \(message)") | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment