From cc0278b3da86d8f554b5165153c99edee4c6fb40 Mon Sep 17 00:00:00 2001 From: Justin Hsu Date: Mon, 8 Jun 2020 16:32:42 -0400 Subject: [PATCH] Refactored to use new logging and remove os.log. (#243) --- CoEpi/api/AlamofireLogger.swift | 13 +++++-------- CoEpi/bg task/BackgroundTask.swift | 1 - CoEpi/bg task/BackgroundTaskScheduler.swift | 9 ++++----- .../bg task/alerts/FetchAlertsBackgroundTask.swift | 3 +-- CoEpi/ble/BleAdapter.swift | 5 ++--- CoEpi/cross/PeriodicAlertsFetcher.swift | 1 - CoEpi/cross/ReportsHandler.swift | 3 +-- CoEpi/cross/ScannedCensHandler.swift | 7 +++---- CoEpi/dao/AlertDao.swift | 5 ++--- CoEpi/dao/RealmCENReportDao.swift | 9 ++++----- CoEpi/native/LibResult.swift | 4 +--- CoEpi/repo/AlertRepo.swift | 5 ++--- CoEpi/repo/SymptomRepo.swift | 1 - CoEpi/ui/alerts/AlertsViewModel.swift | 3 +-- CoEpi/ui/home/HomeViewModel.swift | 3 +-- CoEpi/ui/notifications/AppBadgeUpdater.swift | 3 +-- CoEpi/ui/notifications/NotificationShower.swift | 3 +-- CoEpi/ui/notifications/NotificationsDelegate.swift | 3 +-- CoEpi/ui/permissions/StartPermissions.swift | 3 +-- .../FollowUp/Cough/CoughDaysViewModel.swift | 3 +-- .../FollowUp/Cough/CoughHowViewModel.swift | 1 - .../FollowUp/Cough/CoughTypeViewModel.swift | 1 - .../FollowUp/Fever/FeverDaysViewModel.swift | 3 +-- .../FollowUp/Fever/FeverTempViewModel.swift | 3 +-- .../FollowUp/Fever/FeverTodayViewModel.swift | 1 - .../FollowUp/Fever/FeverWhereViewModel.swift | 1 - .../FollowUp/Fever/FeverWhereViewModelOther.swift | 1 - .../FollowUp/SymptomStartDaysViewModel.swift | 3 +-- CoEpi/ui/symptomReport/SymptomReportViewModel.swift | 1 - CoEpi/ui/thankYou/ThankYouViewModel.swift | 1 - SymptomFlow.swift | 5 ++--- SymptomFlowManager.swift | 7 +++---- 32 files changed, 40 insertions(+), 75 deletions(-) diff --git a/CoEpi/api/AlamofireLogger.swift b/CoEpi/api/AlamofireLogger.swift index 38fd18e..ae66668 100644 --- a/CoEpi/api/AlamofireLogger.swift +++ b/CoEpi/api/AlamofireLogger.swift @@ -1,26 +1,23 @@ import Alamofire -import os.log import Foundation final class AlamofireLogger: EventMonitor { func requestDidResume(_ request: Request) { let body = request.request.flatMap { $0.httpBody.map { String(decoding: $0, as: UTF8.self) } } ?? "None" - os_log("Request Started: %{public}@, body: %{public}@", log: networkingLog, type: .debug, "\(request)", - "\(body)") + + log.d("Request Started: \(request), body: \(body)") } func request(_ request: DataRequest, didParseResponse response: DataResponse) { - os_log("Response Received: %{public}@", log: networkingLog, type: .debug, "\(request)") + log.d("Request Received: \(request)") } func request(_ request: DataRequest, didParseResponse response: DataResponse) { - os_log("Response Received (unserialized): %{public}@", log: networkingLog, type: .debug, - response.debugDescription) + log.d("Request Received (unserialized): \(response.debugDescription)") } func requestDidFinish(_ request: Request) { - os_log("Request did finish: %{public}@", log: networkingLog, type: .debug, - request.response.debugDescription) + log.d("Request did finish: \(request.response.debugDescription)") } } diff --git a/CoEpi/bg task/BackgroundTask.swift b/CoEpi/bg task/BackgroundTask.swift index 71e9d49..cb3180b 100644 --- a/CoEpi/bg task/BackgroundTask.swift +++ b/CoEpi/bg task/BackgroundTask.swift @@ -1,6 +1,5 @@ import Foundation import BackgroundTasks -import os.log import RxSwift /// Long running background task diff --git a/CoEpi/bg task/BackgroundTaskScheduler.swift b/CoEpi/bg task/BackgroundTaskScheduler.swift index 3c20283..8fe3641 100644 --- a/CoEpi/bg task/BackgroundTaskScheduler.swift +++ b/CoEpi/bg task/BackgroundTaskScheduler.swift @@ -1,6 +1,5 @@ import UIKit import BackgroundTasks -import os.log /// Registers and schedules background processing tasks class BackgroundTaskScheduler { @@ -26,7 +25,7 @@ class BackgroundTaskScheduler { } private func handleTask(task: BGProcessingTask) { - os_log("handleTask: ", log: servicesLog, type: .debug, "\(task)") + log.d("handleTask: \(task)") schedule(delay: self.task.scheduleInterval) @@ -34,12 +33,12 @@ class BackgroundTaskScheduler { task.expirationHandler = { task.setTaskCompleted(success: false) - os_log("Background task expired", log: servicesLog, type: .debug) + log.d("Background task expired") } } private func schedule(delay: TimeInterval) { - os_log("Scheduling BG task. Delay: %{public}@", log: servicesLog, type: .debug, "\(delay)") + log.d("Scheduling BG task. Delay: \(delay)") let request = BGProcessingTaskRequest(identifier: task.identifier) request.earliestBeginDate = Date(timeIntervalSinceNow: delay) @@ -49,7 +48,7 @@ class BackgroundTaskScheduler { // TODO flag to use bg thread. Or maybe just use always thread. try BGTaskScheduler.shared.submit(request) } catch let e { - os_log("Unable to submit task: %{public}@, error: %{public}@", log: servicesLog, type: .debug, "\(request)", "\(e)") + log.e("Unable to submit task: \(request), error: \(e)") } } } diff --git a/CoEpi/bg task/alerts/FetchAlertsBackgroundTask.swift b/CoEpi/bg task/alerts/FetchAlertsBackgroundTask.swift index 7439a4c..aee5400 100644 --- a/CoEpi/bg task/alerts/FetchAlertsBackgroundTask.swift +++ b/CoEpi/bg task/alerts/FetchAlertsBackgroundTask.swift @@ -1,5 +1,4 @@ import RxSwift -import os.log import BackgroundTasks import Action @@ -25,7 +24,7 @@ class FetchAlertsBackgroundTask: BackgroundTask { } func execute(task: BGProcessingTask) { - os_log("Starting fetch alerts bg task...", log: servicesLog, type: .debug) + log.d("Starting fetch alerts bg task...") fetchAlertsAction.execute() } diff --git a/CoEpi/ble/BleAdapter.swift b/CoEpi/ble/BleAdapter.swift index 2395af4..9645d3f 100644 --- a/CoEpi/ble/BleAdapter.swift +++ b/CoEpi/ble/BleAdapter.swift @@ -1,7 +1,6 @@ import Foundation import TCNClient import RxSwift -import os.log class BleAdapter { private let tcnService: TCNBluetoothService @@ -12,7 +11,7 @@ class BleAdapter { init(tcnGenerator: TcnGenerator) { tcnService = TCNBluetoothService(tcnGenerator: { [myTcn] in let tcnResult = tcnGenerator.generateTcn() - os_log("Generated TCN: %{public}@", type: .error, "\(tcnResult)") + log.d("Generated TCN: \(tcnResult)") return { switch tcnResult { @@ -28,7 +27,7 @@ class BleAdapter { discovered.onNext(data) }) { error in // TODO What kind of errors? Should we notify the user? - os_log("TCN service error: %{public}@", type: .error, "\(error)") + log.e("TCN service error: \(error)") } tcnService.start() diff --git a/CoEpi/cross/PeriodicAlertsFetcher.swift b/CoEpi/cross/PeriodicAlertsFetcher.swift index 4d984d9..ca88a1f 100644 --- a/CoEpi/cross/PeriodicAlertsFetcher.swift +++ b/CoEpi/cross/PeriodicAlertsFetcher.swift @@ -1,6 +1,5 @@ import Foundation import RxSwift -import os.log class PeriodicAlertsFetcher { private let disposeBag = DisposeBag() diff --git a/CoEpi/cross/ReportsHandler.swift b/CoEpi/cross/ReportsHandler.swift index d33e6c0..15d497b 100644 --- a/CoEpi/cross/ReportsHandler.swift +++ b/CoEpi/cross/ReportsHandler.swift @@ -1,5 +1,4 @@ import Foundation -import os.log protocol MatchingReportsHandler { func handleMatchingReports(reports: [ReceivedCenReport]) @@ -25,7 +24,7 @@ class MatchingReportsHandlerImpl: MatchingReportsHandler { notifiyNewAlerts(count: insertedCount) } - os_log("Alerts update task finished. Saved new reports: %{public}d", log: servicesLog, type: .debug, insertedCount) + log.d("Alerts update task finished. Saved new reports: \(insertedCount)") } private func notifiyNewAlerts(count: Int) { diff --git a/CoEpi/cross/ScannedCensHandler.swift b/CoEpi/cross/ScannedCensHandler.swift index 91832ef..7869bdd 100644 --- a/CoEpi/cross/ScannedCensHandler.swift +++ b/CoEpi/cross/ScannedCensHandler.swift @@ -1,5 +1,4 @@ import Foundation -import os.log import RxSwift class ScannedCensHandler { @@ -20,16 +19,16 @@ class ScannedCensHandler { .distinctUntilChanged() .subscribe(onNext: { [tcnsRecorder] data in - os_log("Observed CEN: %{public}@", log: bleLog, "\(data.toHex())") + log.d("Observed CEN: \(data.toHex())") let res = tcnsRecorder.recordTcn(tcn: data) if (!res.isSuccess()) { - os_log("Error recording TCN: %{public}@", log: bleLog, type: .debug, "\(res)") + log.e("Error recording TCN: \(res)") } }, onError: { error in - os_log("Error in central cen observer: %{public}@", log: bleLog, error.localizedDescription) + log.e("Error in central cen observer: \(error.localizedDescription)") }).disposed(by: disposeBag) } diff --git a/CoEpi/dao/AlertDao.swift b/CoEpi/dao/AlertDao.swift index 2243026..f105695 100644 --- a/CoEpi/dao/AlertDao.swift +++ b/CoEpi/dao/AlertDao.swift @@ -1,5 +1,4 @@ import Foundation -import os.log import RealmSwift import RxSwift @@ -54,10 +53,10 @@ class RealmAlertDao: AlertDao, RealmDao { } func delete(alert: Alert) { - os_log("ACKing alert: %{public}@", type: .debug, "\(alert)") + log.d("ACKing alert: \(alert)") guard let realmAlert = findAlertBy(id: alert.id) else { - os_log("Couldn't find alert to delete: %{public}@", type: .error, "\(alert)") + log.e("Couldn't find alert to delete: \(alert)") return } diff --git a/CoEpi/dao/RealmCENReportDao.swift b/CoEpi/dao/RealmCENReportDao.swift index 01e7b68..948179e 100644 --- a/CoEpi/dao/RealmCENReportDao.swift +++ b/CoEpi/dao/RealmCENReportDao.swift @@ -1,7 +1,6 @@ import Foundation import RealmSwift import RxSwift -import os.log // TODO remove, move functionality to RawAlertDao protocol CENReportDao { @@ -38,7 +37,7 @@ class RealmCENReportDao: CENReportDao, RealmDao { func insert(report: ReceivedCenReport) -> Bool { let result = realm.objects(RealmCENReport.self).filter("id = %@", report.report.id) if result.count == 0 { - os_log("Report didn't exist in db, inserting: %{public}@", type: .debug, report.description) + log.d("Report didn't exist in db, inserting: \(report.description)") let newCENReport = RealmCENReport(report) write { realm.add(newCENReport) @@ -46,16 +45,16 @@ class RealmCENReportDao: CENReportDao, RealmDao { return true } else { //duplicate entry: skipping - os_log("Report already in db, id = %{public}@", type: .debug, report.report.id) + log.d("Report already in db, id = \(report.report.id)") return false } } func delete(report: ReceivedCenReport) { - os_log("ACKing report: %{public}@", type: .debug, "\(report)") + log.d("ACKing report: \(report)") guard let realmReport = findReportBy(id: report.report.id) else { - os_log("Couldn't find report to delete: %{public}@", type: .error, "\(report)") + log.e("Couldn't find report to delete: \(report)") return } diff --git a/CoEpi/native/LibResult.swift b/CoEpi/native/LibResult.swift index 7f82d8a..1c3beee 100644 --- a/CoEpi/native/LibResult.swift +++ b/CoEpi/native/LibResult.swift @@ -1,5 +1,4 @@ import Foundation -import os.log struct LibResult: Decodable { let status: Int @@ -43,8 +42,7 @@ extension Unmanaged where Instance == CFString { let resultValue: CFString = takeRetainedValue() let resultString = resultValue as String - os_log("Deserializing native core result: %{public}@", log: servicesLog, - type: .debug, "\(resultString)") + log.d("Deserializing native core result: \(resultString)") // TODO review safety of utf-8 force unwrap let data = resultString.data(using: .utf8)! diff --git a/CoEpi/repo/AlertRepo.swift b/CoEpi/repo/AlertRepo.swift index cff705b..992d1bd 100644 --- a/CoEpi/repo/AlertRepo.swift +++ b/CoEpi/repo/AlertRepo.swift @@ -1,7 +1,6 @@ import Foundation import RxCocoa import RxSwift -import os.log protocol AlertRepo { var alerts: Observable<[Alert]> { get } @@ -45,13 +44,13 @@ class AlertRepoImpl: AlertRepo { // TODO so we have to update "last fetched time segment" only if alerts save was success // TODO NOTE that storage will likely be moved to Rust. Let's wait until this is cleared. if alertDao.insert(alert: alert) { - os_log("Inserted new alert: %{alert}@", log: servicesLog, type: .debug, "\(alert)") + log.d("Inserted new alert: \(alert)") } } updateReportsStateSubject.accept(.success(data: ())) case .failure(let error): - os_log("Error fetching alerts: %{public}@", log: servicesLog, type: .debug, "\(error)") + log.e("Error fetching alerts: \(error)") updateReportsStateSubject.accept(OperationState.failure(error: error)) } diff --git a/CoEpi/repo/SymptomRepo.swift b/CoEpi/repo/SymptomRepo.swift index 3eeab22..ff32454 100644 --- a/CoEpi/repo/SymptomRepo.swift +++ b/CoEpi/repo/SymptomRepo.swift @@ -1,6 +1,5 @@ import Foundation import RxSwift -import os.log protocol SymptomRepo { func symptoms() -> [Symptom] diff --git a/CoEpi/ui/alerts/AlertsViewModel.swift b/CoEpi/ui/alerts/AlertsViewModel.swift index ca04bcb..48e7393 100644 --- a/CoEpi/ui/alerts/AlertsViewModel.swift +++ b/CoEpi/ui/alerts/AlertsViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log import Foundation class AlertsViewModel { @@ -22,7 +21,7 @@ class AlertsViewModel { updateStatusText = alertRepo.updateReportsState .do(onNext: { result in - os_log("Got alerts result in view model: %{public}@", log: servicesLog, type: .debug, "\(result)") + log.d("Got alerts result in view model: \(result)") }) .filter { $0.shouldShowText() } .map { $0.asText() } diff --git a/CoEpi/ui/home/HomeViewModel.swift b/CoEpi/ui/home/HomeViewModel.swift index 520b32c..f995c16 100644 --- a/CoEpi/ui/home/HomeViewModel.swift +++ b/CoEpi/ui/home/HomeViewModel.swift @@ -1,5 +1,4 @@ import RxSwift -import os.log class HomeViewModel { let title = L10n.Ux.Home.title @@ -12,7 +11,7 @@ class HomeViewModel { self.rootNav = rootNav startPermissions.granted.subscribe(onNext: { granted in - os_log("Start permissions granted: %{public}@", log: servicesLog, type: .debug, "\(granted)") + log.d("Start permissions granted: \(granted)") }).disposed(by: disposeBag) startPermissions.request() diff --git a/CoEpi/ui/notifications/AppBadgeUpdater.swift b/CoEpi/ui/notifications/AppBadgeUpdater.swift index 6cf5950..387edca 100644 --- a/CoEpi/ui/notifications/AppBadgeUpdater.swift +++ b/CoEpi/ui/notifications/AppBadgeUpdater.swift @@ -1,6 +1,5 @@ import Foundation import UserNotifications -import os.log import UIKit protocol AppBadgeUpdater { @@ -22,7 +21,7 @@ class AppBadgeUpdaterImpl: AppBadgeUpdater { else { return } DispatchQueue.main.async { - os_log("Updating app badge: %{public}@", log: servicesLog, type: .debug, "\(number)") + log.d("Updating app badge: \(number)") UIApplication.shared.applicationIconBadgeNumber = number } } diff --git a/CoEpi/ui/notifications/NotificationShower.swift b/CoEpi/ui/notifications/NotificationShower.swift index 21541c7..d4a8ead 100644 --- a/CoEpi/ui/notifications/NotificationShower.swift +++ b/CoEpi/ui/notifications/NotificationShower.swift @@ -1,5 +1,4 @@ import UIKit -import os.log protocol NotificationShower { func showNotification(data: NotificationData) @@ -25,7 +24,7 @@ class NotificationShowerImpl: NotificationShower { } private func showNotification(data: NotificationData, canPlaySound: Bool) { - os_log("Showing notification", log: servicesLog, type: .debug) + log.d("Showing notification") let content = UNMutableNotificationContent() content.title = data.title diff --git a/CoEpi/ui/notifications/NotificationsDelegate.swift b/CoEpi/ui/notifications/NotificationsDelegate.swift index 3935ec7..416aedc 100644 --- a/CoEpi/ui/notifications/NotificationsDelegate.swift +++ b/CoEpi/ui/notifications/NotificationsDelegate.swift @@ -1,6 +1,5 @@ import UIKit import UserNotifications -import os.log class NotificationsDelegate: NSObject, UNUserNotificationCenterDelegate { @@ -26,7 +25,7 @@ class NotificationsDelegate: NSObject, UNUserNotificationCenterDelegate { let identifierStr = response.notification.request.identifier guard let identifier = NotificationId(rawValue: identifierStr) else { - os_log("Selected notification with unknown id: %{public}@", log: servicesLog, type: .debug, identifierStr) + log.d("Selected notification with unknown id: \(identifierStr)") return } diff --git a/CoEpi/ui/permissions/StartPermissions.swift b/CoEpi/ui/permissions/StartPermissions.swift index 42b0b1b..003afcb 100644 --- a/CoEpi/ui/permissions/StartPermissions.swift +++ b/CoEpi/ui/permissions/StartPermissions.swift @@ -1,7 +1,6 @@ import UIKit import RxSwift import RxCocoa -import os.log protocol StartPermissions { var granted: Observable { get } @@ -21,7 +20,7 @@ class StartPermissionsImpl: StartPermissions { func request() { UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in if let error = error { - os_log("Error requesting permission: %{public}@", log: servicesLog, type: .debug, "\(error)") + log.e("Error requesting permission: \(error)") } self.grantedSubject.accept(granted) } diff --git a/CoEpi/ui/symptomReport/FollowUp/Cough/CoughDaysViewModel.swift b/CoEpi/ui/symptomReport/FollowUp/Cough/CoughDaysViewModel.swift index 74efb29..b5d296a 100644 --- a/CoEpi/ui/symptomReport/FollowUp/Cough/CoughDaysViewModel.swift +++ b/CoEpi/ui/symptomReport/FollowUp/Cough/CoughDaysViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log class CoughDaysViewModel { private let symptomFlowManager: SymptomFlowManager @@ -30,7 +29,7 @@ class CoughDaysViewModel { symptomFlowManager.setCoughDays(.some(SymptomInputs.Days(value: days))).expect() } else { // TODO handle - os_log("Invalid input: %{public}@ TODO handle", log: servicesLog, type: .debug, "\(daysStr)") + log.d("Invalid input: \(daysStr) TODO handle") } } daysIsEmpty.accept(daysStr.isEmpty) diff --git a/CoEpi/ui/symptomReport/FollowUp/Cough/CoughHowViewModel.swift b/CoEpi/ui/symptomReport/FollowUp/Cough/CoughHowViewModel.swift index 4a6bad4..6c202a6 100644 --- a/CoEpi/ui/symptomReport/FollowUp/Cough/CoughHowViewModel.swift +++ b/CoEpi/ui/symptomReport/FollowUp/Cough/CoughHowViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log class CoughHowViewModel { private let symptomFlowManager: SymptomFlowManager diff --git a/CoEpi/ui/symptomReport/FollowUp/Cough/CoughTypeViewModel.swift b/CoEpi/ui/symptomReport/FollowUp/Cough/CoughTypeViewModel.swift index cdce76a..53241a1 100644 --- a/CoEpi/ui/symptomReport/FollowUp/Cough/CoughTypeViewModel.swift +++ b/CoEpi/ui/symptomReport/FollowUp/Cough/CoughTypeViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log class CoughTypeViewModel { private let symptomFlowManager: SymptomFlowManager diff --git a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverDaysViewModel.swift b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverDaysViewModel.swift index 7b1f028..02bc235 100644 --- a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverDaysViewModel.swift +++ b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverDaysViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log class FeverDaysViewModel { private let symptomFlowManager: SymptomFlowManager @@ -31,7 +30,7 @@ class FeverDaysViewModel { symptomFlowManager.setFeverDays(.some(SymptomInputs.Days(value: days))).expect() } else { // TODO handle - os_log("Invalid input: %{public}@ TODO handle", log: servicesLog, type: .debug, "\(daysStr)") + log.d("Invalid input: \(daysStr) TODO handle") } } daysIsEmpty.accept(daysStr.isEmpty) diff --git a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverTempViewModel.swift b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverTempViewModel.swift index 3e12003..e43ef16 100644 --- a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverTempViewModel.swift +++ b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverTempViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log class FeverTempViewModel { private let symptomFlowManager: SymptomFlowManager @@ -101,7 +100,7 @@ private func toTemperature(unit: TemperatureUnit, tempStr: String) -> UserInput< case .fahrenheit: return .some(.fahrenheit(value: temp)) } } else { - os_log("WARN: Not numeric temperature input: %{public}@", log: servicesLog, tempStr) + log.w("WARN: Not numeric temperature input: \(tempStr)") return .none } } diff --git a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverTodayViewModel.swift b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverTodayViewModel.swift index 9150423..0597281 100644 --- a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverTodayViewModel.swift +++ b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverTodayViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log class FeverTodayViewModel { private let symptomFlowManager: SymptomFlowManager diff --git a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverWhereViewModel.swift b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverWhereViewModel.swift index 13e233a..9a8fab8 100644 --- a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverWhereViewModel.swift +++ b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverWhereViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log class FeverWhereViewModel { private let symptomFlowManager: SymptomFlowManager diff --git a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverWhereViewModelOther.swift b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverWhereViewModelOther.swift index 9789a00..ade1d62 100644 --- a/CoEpi/ui/symptomReport/FollowUp/Fever/FeverWhereViewModelOther.swift +++ b/CoEpi/ui/symptomReport/FollowUp/Fever/FeverWhereViewModelOther.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log // TODO disable, will not be used for now class FeverWhereViewModelOther { diff --git a/CoEpi/ui/symptomReport/FollowUp/SymptomStartDaysViewModel.swift b/CoEpi/ui/symptomReport/FollowUp/SymptomStartDaysViewModel.swift index 7ac3714..9a505b8 100644 --- a/CoEpi/ui/symptomReport/FollowUp/SymptomStartDaysViewModel.swift +++ b/CoEpi/ui/symptomReport/FollowUp/SymptomStartDaysViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log class SymptomStartDaysViewModel { private let symptomFlowManager: SymptomFlowManager @@ -36,7 +35,7 @@ class SymptomStartDaysViewModel { symptomFlowManager.setEarliestSymptomStartedDaysAgo(.some(days)).expect() } else { // TODO handle - os_log("Invalid input: %{public}@ TODO handle", log: servicesLog, type: .debug, "\(daysStr)") + log.d("Invalid input: \(daysStr) TODO handle") } } daysIsEmpty.accept(daysStr.isEmpty) diff --git a/CoEpi/ui/symptomReport/SymptomReportViewModel.swift b/CoEpi/ui/symptomReport/SymptomReportViewModel.swift index 482676c..be8e220 100644 --- a/CoEpi/ui/symptomReport/SymptomReportViewModel.swift +++ b/CoEpi/ui/symptomReport/SymptomReportViewModel.swift @@ -2,7 +2,6 @@ import Dip import RxCocoa import RxSwift import RxSwiftExt -import os.log import Foundation class SymptomReportViewModel: UINotifier { diff --git a/CoEpi/ui/thankYou/ThankYouViewModel.swift b/CoEpi/ui/thankYou/ThankYouViewModel.swift index 74d8d66..8e3b57f 100644 --- a/CoEpi/ui/thankYou/ThankYouViewModel.swift +++ b/CoEpi/ui/thankYou/ThankYouViewModel.swift @@ -1,7 +1,6 @@ import Dip import RxCocoa import RxSwift -import os.log class ThankYouViewModel { private let rootNav: RootNav diff --git a/SymptomFlow.swift b/SymptomFlow.swift index 562fa6c..40011bc 100644 --- a/SymptomFlow.swift +++ b/SymptomFlow.swift @@ -1,5 +1,4 @@ import Foundation -import os.log import RxSwift class SymptomFlow { @@ -34,13 +33,13 @@ class SymptomFlow { static func create(symptomIds: [SymptomId]) -> SymptomFlow? { if (symptomIds.isEmpty) { - os_log("Symptoms ids empty") + log.d("Symptoms ids empty") return nil } let steps = toSteps(symptomIds: symptomIds) if (steps.isEmpty) { - os_log("Symptoms have no steps. Not creating a flow.") + log.d("Symptoms have no steps. Not creating a flow.") return nil } diff --git a/SymptomFlowManager.swift b/SymptomFlowManager.swift index 6e2707e..6e8a78e 100644 --- a/SymptomFlowManager.swift +++ b/SymptomFlowManager.swift @@ -1,4 +1,3 @@ -import os.log import RxCocoa import RxSwift @@ -38,7 +37,7 @@ class SymptomFlowManager { func startFlow(symptomIds: [SymptomId]) -> Bool { if (symptomIds.isEmpty) { - os_log("Symptoms ids is empty", log: servicesLog, type: .debug) + log.d("Symptoms ids is empty") return false } @@ -64,7 +63,7 @@ class SymptomFlowManager { func updateNavigation() { guard let symptomFlow = symptomFlow else { - os_log("No symptom inputs. Showing thanks screen.", log: servicesLog, type: .debug) + log.d("No symptom inputs. Showing thanks screen.") finishFlowTrigger.accept(()) return } @@ -96,7 +95,7 @@ class SymptomFlowManager { return } if symptomFlow.previous() == nil { - os_log("No previous step.", log: servicesLog, type: .debug) + log.d("No previous step.") } }