Adopt consolidated logging mechanism (#4370)

* Adopted the new MXLog and replaced NSLog throughout the application - vector-im/element-ios/issues/4351
* Replaced NSLog() and print() usages with MXLog.debug()
* Added swiftlint rules for NSLog(), print(), println() and os_log()
* Escape paths used to run script build phases for swiftlint and swiftgen
This commit is contained in:
Stefan Ceriu
2021-06-03 11:30:07 +03:00
committed by GitHub
parent f70b6df6c9
commit 43f6c44c78
94 changed files with 689 additions and 630 deletions
@@ -168,7 +168,7 @@ final class KeyVerificationCoordinator: KeyVerificationCoordinatorType {
// In the case of the complete security flow, come back to the root screen if any child flow
// like device verification has been cancelled
if self.completeSecurityCoordinator != nil && childCoordinators.count > 1 {
NSLog("[KeyVerificationCoordinator] didCancel: popToRootModule")
MXLog.debug("[KeyVerificationCoordinator] didCancel: popToRootModule")
self.navigationRouter.popToRootModule(animated: true)
return
}
@@ -307,7 +307,7 @@ extension KeyVerificationCoordinator: KeyVerificationDataLoadingCoordinatorDeleg
if let sasTransaction = transaction as? MXSASTransaction {
self.showVerifyBySAS(transaction: sasTransaction, animated: true)
} else {
NSLog("[KeyVerificationCoordinator] Transaction \(transaction) is not supported")
MXLog.debug("[KeyVerificationCoordinator] Transaction \(transaction) is not supported")
self.didCancel()
}
}
@@ -59,7 +59,7 @@ final class KeyVerificationCoordinatorBridgePresenter: NSObject {
func present(from viewController: UIViewController, otherUserId: String, otherDeviceId: String, animated: Bool) {
NSLog("[KeyVerificationCoordinatorBridgePresenter] Present from \(viewController)")
MXLog.debug("[KeyVerificationCoordinatorBridgePresenter] Present from \(viewController)")
let keyVerificationCoordinator = KeyVerificationCoordinator(session: self.session, flow: .verifyDevice(userId: otherUserId, deviceId: otherDeviceId))
self.present(coordinator: keyVerificationCoordinator, from: viewController, animated: animated)
@@ -67,7 +67,7 @@ final class KeyVerificationCoordinatorBridgePresenter: NSObject {
func present(from viewController: UIViewController, roomMember: MXRoomMember, animated: Bool) {
NSLog("[KeyVerificationCoordinatorBridgePresenter] Present from \(viewController)")
MXLog.debug("[KeyVerificationCoordinatorBridgePresenter] Present from \(viewController)")
let keyVerificationCoordinator = KeyVerificationCoordinator(session: self.session, flow: .verifyUser(roomMember))
self.present(coordinator: keyVerificationCoordinator, from: viewController, animated: animated)
@@ -75,7 +75,7 @@ final class KeyVerificationCoordinatorBridgePresenter: NSObject {
func present(from viewController: UIViewController, incomingTransaction: MXIncomingSASTransaction, animated: Bool) {
NSLog("[KeyVerificationCoordinatorBridgePresenter] Present incoming verification from \(viewController)")
MXLog.debug("[KeyVerificationCoordinatorBridgePresenter] Present incoming verification from \(viewController)")
let keyVerificationCoordinator = KeyVerificationCoordinator(session: self.session, flow: .incomingSASTransaction(incomingTransaction))
self.present(coordinator: keyVerificationCoordinator, from: viewController, animated: animated)
@@ -83,7 +83,7 @@ final class KeyVerificationCoordinatorBridgePresenter: NSObject {
func present(from viewController: UIViewController, incomingKeyVerificationRequest: MXKeyVerificationRequest, animated: Bool) {
NSLog("[KeyVerificationCoordinatorBridgePresenter] Present incoming key verification request from \(viewController)")
MXLog.debug("[KeyVerificationCoordinatorBridgePresenter] Present incoming key verification request from \(viewController)")
let keyVerificationCoordinator = KeyVerificationCoordinator(session: self.session, flow: .incomingRequest(incomingKeyVerificationRequest))
self.present(coordinator: keyVerificationCoordinator, from: viewController, animated: animated)
@@ -91,7 +91,7 @@ final class KeyVerificationCoordinatorBridgePresenter: NSObject {
func presentCompleteSecurity(from viewController: UIViewController, isNewSignIn: Bool, animated: Bool) {
NSLog("[KeyVerificationCoordinatorBridgePresenter] Present complete security from \(viewController)")
MXLog.debug("[KeyVerificationCoordinatorBridgePresenter] Present complete security from \(viewController)")
let keyVerificationCoordinator = KeyVerificationCoordinator(session: self.session, flow: .completeSecurity(isNewSignIn))
self.present(coordinator: keyVerificationCoordinator, from: viewController, animated: animated)
@@ -99,7 +99,7 @@ final class KeyVerificationCoordinatorBridgePresenter: NSObject {
func pushCompleteSecurity(from navigationController: UINavigationController, isNewSignIn: Bool, animated: Bool) {
NSLog("[KeyVerificationCoordinatorBridgePresenter] Push complete security from \(navigationController)")
MXLog.debug("[KeyVerificationCoordinatorBridgePresenter] Push complete security from \(navigationController)")
let navigationRouter = NavigationRouter(navigationController: navigationController)
@@ -115,7 +115,7 @@ final class KeyVerificationCoordinatorBridgePresenter: NSObject {
return
}
NSLog("[KeyVerificationCoordinatorBridgePresenter] Dismiss")
MXLog.debug("[KeyVerificationCoordinatorBridgePresenter] Dismiss")
coordinator.toPresentable().dismiss(animated: animated) {
self.coordinator = nil
@@ -112,7 +112,7 @@ final class KeyVerificationDataLoadingViewModel: KeyVerificationDataLoadingViewM
let otherUserId = self.otherUserId,
let otherDeviceId = self.otherDeviceId else {
self.update(viewState: .errorMessage(VectorL10n.deviceVerificationErrorCannotLoadDevice))
NSLog("[KeyVerificationDataLoadingViewModel] Error session.crypto is nil")
MXLog.debug("[KeyVerificationDataLoadingViewModel] Error session.crypto is nil")
return
}
@@ -174,7 +174,7 @@ final class KeyVerificationVerifyByScanningViewModel: KeyVerificationVerifyBySca
self.removePendingQRCodeTransaction()
if keyVerificationTransaction is MXOutgoingSASTransaction == false {
NSLog("[KeyVerificationVerifyByScanningViewModel] SAS transaction should be outgoing")
MXLog.debug("[KeyVerificationVerifyByScanningViewModel] SAS transaction should be outgoing")
self.unregisterTransactionDidStateChangeNotification()
self.update(viewState: .error(KeyVerificationVerifyByScanningViewModelError.unknown))
}
@@ -204,7 +204,7 @@ final class KeyVerificationVerifyByScanningViewModel: KeyVerificationVerifyBySca
}
guard self.keyVerificationRequest.requestId == transaction.transactionId else {
NSLog("[KeyVerificationVerifyByScanningViewModel] transactionDidStateChange: Not for our transaction (\(self.keyVerificationRequest.requestId)): \(transaction.transactionId)")
MXLog.debug("[KeyVerificationVerifyByScanningViewModel] transactionDidStateChange: Not for our transaction (\(self.keyVerificationRequest.requestId)): \(transaction.transactionId)")
return
}