-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add production logs and refactor Logger (RMCCX-6877)
- Loading branch information
1 parent
98aecaf
commit 9950e87
Showing
5 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
import Foundation | ||
|
||
extension OSLog { | ||
static let sdk = OSLog(category: "RInAppMessaging SDK") | ||
Check notice Code scanning / mobsfscan The App logs information. Sensitive information should never be logged. Note
The App logs information. Sensitive information should never be logged.
|
||
|
||
private convenience init(category: String, bundle: Bundle = Bundle(for: Logger.self)) { | ||
let identifier = bundle.infoDictionary?["CFBundleIdentifier"] as? String | ||
self.init(subsystem: (identifier ?? "").appending(".logs"), category: category) | ||
} | ||
} | ||
|
||
class Logger { | ||
// Debug Logging | ||
class func debug(_ message: String) { | ||
#if DEBUG | ||
print("InAppMessaging: " + message) | ||
#else | ||
os_log("%s", log: OSLog.sdk, type: .error, message) | ||
#endif | ||
} | ||
|
||
class func debugLog(_ message: String) { | ||
#if DEBUG | ||
// do nothing | ||
#else | ||
os_log("%s", log: OSLog.sdk, type: .error, message) | ||
#endif | ||
} | ||
} |