merge refactor IOS-1521
authorbuff <andreas@pep-project.org>
Wed, 08 May 2019 12:01:12 +0200
branchIOS-1521
changeset 852570d607f356db
parent 8518 f04742aafea1
parent 8522 2a942d9e828e
child 8526 eaff3abb2511
merge refactor
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOS/AppDelegate.swift
pEpForiOS/UI/Compose/Util/ComposeUtil.swift
pEpForiOS/UI/Compose/ViewModel/ComposeViewModel.swift
pEpForiOS/UI/Compose/ViewModel/ComposeViewModelState.swift
pEpForiOS/UI/EmailDisplay/EmailViewController.swift
pEpForiOS/UI/EmailDisplay/Stuff that is named Compose but is used only in EmailView/ComposeDataSource.swift
pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift
pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift
pEpForiOS/UI/EmailDisplayList/PepPictureComposer.swift
pEpForiOS/UI/Filter/FilterTableViewController.swift
pEpForiOS/UI/Filter/ViewModel/FilterSectionViewModel.swift
pEpForiOS/UI/Filter/ViewModel/FilterViewModel.swift
pEpForiOS/UI/Folder/FolderTableViewController.swift
pEpForiOS/UI/Folder/ViewModel/FolderSectionViewModel.swift
pEpForiOS/UI/Handshake/ViewModel/HandshakePartnerTableViewCellViewModel.swift
pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift
pEpForiOS/UI/SplitView/PrimarySplitViewcontroller+ScreenComposerProtocol.swift
pEpForiOS/UI/Thread/ThreadViewController+SegueHandlerType.swift
pEpForiOS/UI/Thread/ThreadViewController.swift
pEpForiOS/Util/Log/Log+ASL.swift
pEpForiOS/Util/Log/Log.swift
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Submodules/pEpIOSToolbox/pEpIOSToolbox/Modules/Log.swift	Wed May 08 12:01:12 2019 +0200
     1.3 @@ -0,0 +1,17 @@
     1.4 +//
     1.5 +//  Log.swift
     1.6 +//  pEpIOSToolbox
     1.7 +//
     1.8 +//  Created by Alejandro Gelos on 03/05/2019.
     1.9 +//  Copyright © 2019 pEp Security SA. All rights reserved.
    1.10 +//
    1.11 +
    1.12 +import Foundation
    1.13 +
    1.14 +/// Shared instance of logger.
    1.15 +class Log {
    1.16 +    static let shared = Logger(subsystem: "security.pEp.pEpForiOS", category: "pEpIOSToolbox")
    1.17 +
    1.18 +    /// Init is forbidden. Singleton...
    1.19 +    private init() {}
    1.20 +}
     2.1 --- a/Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/Logger.swift	Tue May 07 19:18:28 2019 +0200
     2.2 +++ b/Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/Logger.swift	Wed May 08 12:01:12 2019 +0200
     2.3 @@ -58,21 +58,6 @@
     2.4          }
     2.5      }
     2.6  
     2.7 -    //!!!: remove this loggers  from to the app if any
     2.8 -
     2.9 -    @available(*, deprecated, message: "Instead create a singleton per Xcode project (Module) yourself")
    2.10 -    public static let frontendLogger = Logger(category: "frontend")
    2.11 -    @available(*, deprecated, message: "Instead create a singleton per Xcode project (Module) yourself")
    2.12 -    public static let backendLogger = Logger(category: "backend")
    2.13 -    @available(*, deprecated, message: "Instead create a singleton per Xcode project (Module) yourself")
    2.14 -    public static let utilLogger = Logger(category: "util")
    2.15 -    @available(*, deprecated, message: "Instead create a singleton per Xcode project (Module) yourself")
    2.16 -    public static let htmlParsingLogger = Logger(category: "htmlParsing")
    2.17 -    @available(*, deprecated, message: "Instead create a singleton per Xcode project (Module) yourself")
    2.18 -    public static let modelLogger = Logger(category: "model")
    2.19 -    @available(*, deprecated, message: "Instead create a singleton per Xcode project (Module) yourself")
    2.20 -    public static let appDelegateLogger = Logger(category: "appDelegate")
    2.21 -
    2.22      public init(subsystem: String = "security.pEp.app.iOS", category: String) {
    2.23          self.subsystem = subsystem
    2.24          self.category = category
     3.1 --- a/Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/SortedSet.swift	Tue May 07 19:18:28 2019 +0200
     3.2 +++ b/Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/SortedSet.swift	Wed May 08 12:01:12 2019 +0200
     3.3 @@ -51,7 +51,7 @@
     3.4          defer { objc_sync_exit(self) }
     3.5  
     3.6          guard isValidIndex(index) else {
     3.7 -            Logger.frontendLogger.errorAndCrash("Index out of range")
     3.8 +            Log.shared.errorAndCrash("Index out of range")
     3.9              return
    3.10          }
    3.11          set.removeObject(at: index)
    3.12 @@ -62,7 +62,7 @@
    3.13          defer { objc_sync_exit(self) }
    3.14  
    3.15          guard isValidIndex(index) else {
    3.16 -            Logger.frontendLogger.errorAndCrash("Index out of range")
    3.17 +            Log.shared.errorAndCrash("Index out of range")
    3.18              return
    3.19          }
    3.20          set.replaceObject(at: index, with: object)
    3.21 @@ -73,7 +73,7 @@
    3.22          defer { objc_sync_exit(self) }
    3.23  
    3.24          guard isValidIndex(index) else {
    3.25 -            Logger.frontendLogger.errorAndCrash("Index out of range")
    3.26 +            Log.shared.errorAndCrash("Index out of range")
    3.27              return nil
    3.28          }
    3.29  
    3.30 @@ -101,7 +101,7 @@
    3.31  
    3.32          for i in 0..<set.count {
    3.33              guard let testee = set.object(at: i) as? T else {
    3.34 -                Logger.frontendLogger.errorAndCrash("error casting")
    3.35 +                Log.shared.errorAndCrash("error casting")
    3.36                  return NSNotFound
    3.37              }
    3.38              if testee == object {
    3.39 @@ -187,7 +187,7 @@
    3.40          set.sort { (first: Any, second: Any) -> ComparisonResult in
    3.41              guard let firstT = first as? T,
    3.42                  let secondT = second as? T else {
    3.43 -                    Logger.frontendLogger.errorAndCrash("Error casting.")
    3.44 +                    Log.shared.errorAndCrash("Error casting.")
    3.45                      return .orderedSame
    3.46              }
    3.47              return sortBlock(firstT, secondT)
    3.48 @@ -197,7 +197,7 @@
    3.49      private func indexOfObjectIfInserted(obj: T) -> Int {
    3.50          for i in 0..<set.count {
    3.51              guard let testee = set.object(at: i) as? T else {
    3.52 -                Logger.frontendLogger.errorAndCrash("Error casing")
    3.53 +                Log.shared.errorAndCrash("Error casing")
    3.54                  return 0
    3.55              }
    3.56              if set.count == 0 {
     4.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Tue May 07 19:18:28 2019 +0200
     4.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Wed May 08 12:01:12 2019 +0200
     4.3 @@ -191,6 +191,7 @@
     4.4  		220DCE371E0AB5CC002FE716 /* MessageSubjectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 220DCE331E0AB5CC002FE716 /* MessageSubjectCell.swift */; };
     4.5  		222B35581DF96389007A1F82 /* Capability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 222B35571DF96389007A1F82 /* Capability.swift */; };
     4.6  		228038681DC9DE6D00F1CB45 /* TextfieldResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 228038671DC9DE6D00F1CB45 /* TextfieldResponder.swift */; };
     4.7 +		37C3C0E62260C64D003E290C /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C3C0E52260C64D003E290C /* Log.swift */; };
     4.8  		43040A531E9776220083DED8 /* AttachmentSummaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43040A521E9776220083DED8 /* AttachmentSummaryView.swift */; };
     4.9  		4304FD001EBB8EBB0086DADA /* LanguageListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4304FCFE1EBB8C5A0086DADA /* LanguageListViewController.swift */; };
    4.10  		430BA229203438A3003B041C /* CdMessagePEPMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 430BA228203438A3003B041C /* CdMessagePEPMessageTests.swift */; };
    4.11 @@ -418,8 +419,6 @@
    4.12  		A1014DA71D1173CD00C472A8 /* UIHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 436C5A8D1CFEDF59006A195F /* UIHelper.swift */; };
    4.13  		A1B50A841CD26FF100B1A997 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B50A811CD26FF100B1A997 /* Constants.swift */; };
    4.14  		B70A3A63220065F600EDCE61 /* String+pEp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A3A62220065F500EDCE61 /* String+pEp.swift */; };
    4.15 -		B70A3A9322089D5000EDCE61 /* Log+ASL.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A3A9122089D5000EDCE61 /* Log+ASL.swift */; };
    4.16 -		B70A3A9422089D5000EDCE61 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A3A9222089D5000EDCE61 /* Log.swift */; };
    4.17  		B70A3C401E817CFA0036876F /* FolderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A3C3F1E817CFA0036876F /* FolderViewModel.swift */; };
    4.18  		B716056020D3ECC900A733D6 /* MoveToFolderTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B716055F20D3ECC900A733D6 /* MoveToFolderTableViewController.swift */; };
    4.19  		B71EBBBC1E55E4AE00150177 /* FolderTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B71EBBBB1E55E4AE00150177 /* FolderTableViewController.swift */; };
    4.20 @@ -682,6 +681,7 @@
    4.21  		220DCE331E0AB5CC002FE716 /* MessageSubjectCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageSubjectCell.swift; sourceTree = "<group>"; };
    4.22  		222B35571DF96389007A1F82 /* Capability.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Capability.swift; sourceTree = "<group>"; };
    4.23  		228038671DC9DE6D00F1CB45 /* TextfieldResponder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextfieldResponder.swift; sourceTree = "<group>"; };
    4.24 +		37C3C0E52260C64D003E290C /* Log.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Log.swift; sourceTree = "<group>"; };
    4.25  		43040A521E9776220083DED8 /* AttachmentSummaryView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentSummaryView.swift; sourceTree = "<group>"; };
    4.26  		4304FCFE1EBB8C5A0086DADA /* LanguageListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LanguageListViewController.swift; sourceTree = "<group>"; };
    4.27  		430BA228203438A3003B041C /* CdMessagePEPMessageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CdMessagePEPMessageTests.swift; sourceTree = "<group>"; };
    4.28 @@ -943,8 +943,6 @@
    4.29  		8B69E3981E30F80E0022959E /* Appearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Appearance.swift; sourceTree = "<group>"; };
    4.30  		A1B50A811CD26FF100B1A997 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
    4.31  		B70A3A62220065F500EDCE61 /* String+pEp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+pEp.swift"; sourceTree = "<group>"; };
    4.32 -		B70A3A9122089D5000EDCE61 /* Log+ASL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Log+ASL.swift"; sourceTree = "<group>"; };
    4.33 -		B70A3A9222089D5000EDCE61 /* Log.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Log.swift; sourceTree = "<group>"; };
    4.34  		B70A3C3F1E817CFA0036876F /* FolderViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FolderViewModel.swift; path = Folder/ViewModel/FolderViewModel.swift; sourceTree = "<group>"; };
    4.35  		B716055F20D3ECC900A733D6 /* MoveToFolderTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoveToFolderTableViewController.swift; sourceTree = "<group>"; };
    4.36  		B71EBBBB1E55E4AE00150177 /* FolderTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FolderTableViewController.swift; path = Folder/FolderTableViewController.swift; sourceTree = "<group>"; };
    4.37 @@ -1909,7 +1907,6 @@
    4.38  		43980EDE1CBD24B000A7FC3C /* Util */ = {
    4.39  			isa = PBXGroup;
    4.40  			children = (
    4.41 -				B70A3A9022089D3C00EDCE61 /* Log */,
    4.42  				4362398D1EAE08F400BD2EB9 /* Extensions */,
    4.43  				B740B7571E4B1B80002585E1 /* MimeTypes */,
    4.44  				43306EBC1FE125950045DD00 /* OAuth2 */,
    4.45 @@ -2051,6 +2048,8 @@
    4.46  		43E58EB21CBF8301008AA7A7 /* Models */ = {
    4.47  			isa = PBXGroup;
    4.48  			children = (
    4.49 +				37C3C0E52260C64D003E290C /* Log.swift */,
    4.50 +				15F835231F34BE1300FCE887 /* AccountUserInput.swift */,
    4.51  				4365E868226615E400929D07 /* VerifiableAccount */,
    4.52  				43CE63C41DE87FB200FAC505 /* Identity+pEp.swift */,
    4.53  				155475632137FD96005A52D0 /* FolderType+Extensions.swift */,
    4.54 @@ -2262,15 +2261,6 @@
    4.55  			path = ..;
    4.56  			sourceTree = "<group>";
    4.57  		};
    4.58 -		B70A3A9022089D3C00EDCE61 /* Log */ = {
    4.59 -			isa = PBXGroup;
    4.60 -			children = (
    4.61 -				B70A3A9122089D5000EDCE61 /* Log+ASL.swift */,
    4.62 -				B70A3A9222089D5000EDCE61 /* Log.swift */,
    4.63 -			);
    4.64 -			path = Log;
    4.65 -			sourceTree = "<group>";
    4.66 -		};
    4.67  		B70D32A5205BCC020094A92A /* ViewModel */ = {
    4.68  			isa = PBXGroup;
    4.69  			children = (
    4.70 @@ -2954,6 +2944,7 @@
    4.71  				43D5411B2268853A00E74427 /* VerifiableAccountProtocol+UI.swift in Sources */,
    4.72  				152A39DD21905C3E00D9F8E4 /* AccountCell.swift in Sources */,
    4.73  				B7DB7FDC221ADDBD003968DA /* UIImageView+Extension.swift in Sources */,
    4.74 +				37C3C0E62260C64D003E290C /* Log.swift in Sources */,
    4.75  				43306EC21FE129840045DD00 /* OAuth2Type.swift in Sources */,
    4.76  				438052871FE3E1B100ACF729 /* OAuth2AuthorizationFactoryProtocol.swift in Sources */,
    4.77  				4356FFE52135448600804089 /* ReplyAllPossibleChecker.swift in Sources */,
    4.78 @@ -2998,7 +2989,6 @@
    4.79  				43A6E0581E57400E005BEE69 /* RatingReEvaluator.swift in Sources */,
    4.80  				49C34AF620E4F649009D11CC /* CellDetailTransition.swift in Sources */,
    4.81  				492EF92A20C18C6C004EAE14 /* DisplayedMessage.swift in Sources */,
    4.82 -				B70A3A9322089D5000EDCE61 /* Log+ASL.swift in Sources */,
    4.83  				49228A5520D4035100A51E9D /* DetailCellSegue.swift in Sources */,
    4.84  				43497B38211C62DE00AC42B0 /* MessageIdentitfying.swift in Sources */,
    4.85  				00FD0CE82102014C00BA0C56 /* PrimarySplitViewcontroller+ScreenComposerProtocol.swift in Sources */,
     5.1 --- a/pEpForiOS/AppDelegate.swift	Tue May 07 19:18:28 2019 +0200
     5.2 +++ b/pEpForiOS/AppDelegate.swift	Wed May 08 12:01:12 2019 +0200
     5.3 @@ -53,7 +53,7 @@
     5.4  
     5.5      private func setupInitialViewController() -> Bool {
     5.6          guard let appConfig = appConfig else {
     5.7 -            Logger.appDelegateLogger.errorAndCrash("No AppConfig")
     5.8 +            Log.shared.errorAndCrash("No AppConfig")
     5.9              return false
    5.10          }
    5.11          let mainStoryboard: UIStoryboard = UIStoryboard(name: "FolderViews", bundle: nil)
    5.12 @@ -61,7 +61,7 @@
    5.13              let navController = initialNVC.viewControllers.first as? UINavigationController,
    5.14              let rootVC = navController.rootViewController as? FolderTableViewController
    5.15              else {
    5.16 -                Logger.appDelegateLogger.errorAndCrash("Problem initializing UI")
    5.17 +                Log.shared.errorAndCrash("Problem initializing UI")
    5.18                  return false
    5.19          }
    5.20          rootVC.appConfig = appConfig
    5.21 @@ -85,7 +85,7 @@
    5.22      private func stopUsingPepSession() {
    5.23          syncUserActionsAndCleanupbackgroundTaskId =
    5.24              application.beginBackgroundTask(expirationHandler: { [unowned self] in
    5.25 -                Logger.appDelegateLogger.errorAndCrash(
    5.26 +                Log.shared.errorAndCrash(
    5.27                      "syncUserActionsAndCleanupbackgroundTask with ID %{public}@ expired",
    5.28                      self.syncUserActionsAndCleanupbackgroundTaskId as CVarArg)
    5.29                  // We migh want to call some (yet unexisting) emergency shutdown on
    5.30 @@ -104,7 +104,7 @@
    5.31  
    5.32      func kickOffMySelf() {
    5.33          mySelfTaskId = application.beginBackgroundTask(expirationHandler: { [unowned self] in
    5.34 -            Logger.appDelegateLogger.log("mySelfTaskId with ID expired.")
    5.35 +            Log.shared.log("mySelfTaskId with ID expired.")
    5.36              // We migh want to call some (yet unexisting) emergency shutdown on
    5.37              // ReplicationService here here that brutally shuts down everything.
    5.38              self.application.endBackgroundTask(
    5.39 @@ -133,7 +133,7 @@
    5.40                                           storeURL: nil,
    5.41                                           options: options)
    5.42          } catch {
    5.43 -            Logger.appDelegateLogger.errorAndCrash("Error while Loading DataStack")
    5.44 +            Log.shared.errorAndCrash("Error while Loading DataStack")
    5.45          }
    5.46      }
    5.47  
    5.48 @@ -216,7 +216,7 @@
    5.49      // MARK: - UIApplicationDelegate
    5.50  
    5.51      func applicationDidReceiveMemoryWarning(_ application: UIApplication) {
    5.52 -        Logger.appDelegateLogger.log("applicationDidReceiveMemoryWarning")
    5.53 +        Log.shared.log("applicationDidReceiveMemoryWarning")
    5.54      }
    5.55  
    5.56      func application(
    5.57 @@ -236,7 +236,7 @@
    5.58          let pEpReInitialized = deleteManagementDBIfRequired()
    5.59  
    5.60          setupServices()
    5.61 -        Logger.appDelegateLogger.log("Library url: %{public}@", String(describing: applicationDirectory()))
    5.62 +        Log.shared.log("Library url: %{public}@", String(describing: applicationDirectory()))
    5.63          deleteAllFolders(pEpReInitialized: pEpReInitialized)
    5.64  
    5.65          prepareUserNotifications()
    5.66 @@ -298,7 +298,7 @@
    5.67          completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    5.68          
    5.69          guard let messageModelService = messageModelService else {
    5.70 -            Logger.appDelegateLogger.error("no replicationService")
    5.71 +            Log.shared.error("no networkService")
    5.72              return
    5.73          }
    5.74          
     6.1 --- a/pEpForiOS/HTMLParser/Axt/HtmlToMarkdownSaxParser.swift	Tue May 07 19:18:28 2019 +0200
     6.2 +++ b/pEpForiOS/HTMLParser/Axt/HtmlToMarkdownSaxParser.swift	Wed May 08 12:01:12 2019 +0200
     6.3 @@ -62,6 +62,6 @@
     6.4      }
     6.5  
     6.6      func parser(_ parser: AXHTMLParser, parseErrorOccurred parseError: Error) {
     6.7 -        Logger.htmlParsingLogger.errorAndCrash("%@", parseError.localizedDescription)
     6.8 +        Log.shared.errorAndCrash("%@", parseError.localizedDescription)
     6.9      }
    6.10  }
     7.1 --- a/pEpForiOS/HTMLParser/Axt/HtmlToTextSaxParser.swift	Tue May 07 19:18:28 2019 +0200
     7.2 +++ b/pEpForiOS/HTMLParser/Axt/HtmlToTextSaxParser.swift	Wed May 08 12:01:12 2019 +0200
     7.3 @@ -60,6 +60,6 @@
     7.4      }
     7.5  
     7.6      func parser(_ parser: AXHTMLParser, parseErrorOccurred parseError: Error) {
     7.7 -        Logger.htmlParsingLogger.error("%@", parseError.localizedDescription)
     7.8 +        Log.shared.error("%@", parseError.localizedDescription)
     7.9      }
    7.10  }
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/pEpForiOS/Models/Log.swift	Wed May 08 12:01:12 2019 +0200
     8.3 @@ -0,0 +1,18 @@
     8.4 +//
     8.5 +//  Log.swift
     8.6 +//  pEp
     8.7 +//
     8.8 +//  Created by Alejandro Gelos on 12/04/2019.
     8.9 +//  Copyright © 2019 p≡p Security S.A. All rights reserved.
    8.10 +//
    8.11 +
    8.12 +import pEpIOSToolbox
    8.13 +
    8.14 +/// Shared instance of logger.
    8.15 +class Log {
    8.16 +    static let shared = Logger(subsystem: "security.pEp.pEpForiOS", category: "pEpForiOS")
    8.17 +
    8.18 +    /// Init is forbidden. Singleton...
    8.19 +    private init() {}
    8.20 +}
    8.21 +
     9.1 --- a/pEpForiOS/Models/Server+Fetching.swift	Tue May 07 19:18:28 2019 +0200
     9.2 +++ b/pEpForiOS/Models/Server+Fetching.swift	Wed May 08 12:01:12 2019 +0200
     9.3 @@ -18,7 +18,7 @@
     9.4              var accounts = [Account]()
     9.5              for cdServer in cdServers {
     9.6                  guard let account = cdServer.account?.account() else {
     9.7 -                    Logger.modelLogger.errorAndCrash("No address")
     9.8 +                    Log.shared.errorAndCrash("No address")
     9.9                      continue
    9.10                  }
    9.11                  accounts.append(account)
    10.1 --- a/pEpForiOS/UI/Background/ReevaluateMessageRatingOperation.swift	Tue May 07 19:18:28 2019 +0200
    10.2 +++ b/pEpForiOS/UI/Background/ReevaluateMessageRatingOperation.swift	Wed May 08 12:01:12 2019 +0200
    10.3 @@ -61,7 +61,7 @@
    10.4              context.saveAndLogErrors()
    10.5              message.pEpRatingInt = Int(newRating.rawValue)
    10.6          } catch let error as NSError {
    10.7 -            Logger.backendLogger.log(error: error)
    10.8 +            Log.shared.log(error: error)
    10.9          }
   10.10      }
   10.11  }
    11.1 --- a/pEpForiOS/UI/Compose/Cells/AccountCell/AccountCell.swift	Tue May 07 19:18:28 2019 +0200
    11.2 +++ b/pEpForiOS/UI/Compose/Cells/AccountCell/AccountCell.swift	Wed May 08 12:01:12 2019 +0200
    11.3 @@ -31,7 +31,7 @@
    11.4  
    11.5      private func setupPickerView() {
    11.6          guard let viewModel = viewModel else {
    11.7 -            Logger.frontendLogger.errorAndCrash("No VM")
    11.8 +            Log.shared.errorAndCrash("No VM")
    11.9              return
   11.10          }
   11.11          picker = AccountPickerView()
    12.1 --- a/pEpForiOS/UI/Compose/Cells/BodyCell/BodyCell.swift	Tue May 07 19:18:28 2019 +0200
    12.2 +++ b/pEpForiOS/UI/Compose/Cells/BodyCell/BodyCell.swift	Wed May 08 12:01:12 2019 +0200
    12.3 @@ -26,7 +26,7 @@
    12.4  
    12.5      private func setupInitialText() {
    12.6          guard let vm = viewModel else {
    12.7 -            Logger.frontendLogger.errorAndCrash("No VM")
    12.8 +            Log.shared.errorAndCrash("No VM")
    12.9              return
   12.10          }
   12.11          let (text, attrText) = vm.inititalText()
   12.12 @@ -43,7 +43,7 @@
   12.13      // Set cursor and show keyboard
   12.14      override func setFocus() {
   12.15          guard let vm = viewModel else {
   12.16 -            Logger.frontendLogger.errorAndCrash("No VM")
   12.17 +            Log.shared.errorAndCrash("No VM")
   12.18              return
   12.19          }
   12.20          if let rangeStart = textView.position(from: textView.beginningOfDocument,
   12.21 @@ -101,7 +101,7 @@
   12.22                    shouldChangeTextIn range: NSRange,
   12.23                    replacementText text: String) -> Bool {
   12.24          guard let vm = viewModel else {
   12.25 -            Logger.frontendLogger.errorAndCrash("No VM")
   12.26 +            Log.shared.errorAndCrash("No VM")
   12.27              return true
   12.28          }
   12.29         return vm.shouldReplaceText(in: range, of: textView.attributedText, with: text)
    13.1 --- a/pEpForiOS/UI/Compose/Cells/BodyCell/BodyCellViewModel.swift	Tue May 07 19:18:28 2019 +0200
    13.2 +++ b/pEpForiOS/UI/Compose/Cells/BodyCell/BodyCellViewModel.swift	Wed May 08 12:01:12 2019 +0200
    13.3 @@ -117,7 +117,7 @@
    13.4  extension BodyCellViewModel {
    13.5      public func inline(attachment: Attachment) {
    13.6          guard let image = attachment.image else {
    13.7 -            Logger.frontendLogger.errorAndCrash("No image")
    13.8 +            Log.shared.errorAndCrash("No image")
    13.9              return
   13.10          }
   13.11          attachment.contentDisposition = .inline
   13.12 @@ -125,7 +125,7 @@
   13.13          // performance issues (delay typing).
   13.14          guard let scaledImage = image.resized(newWidth: maxTextattachmentWidth / 2, useAlpha: false)
   13.15              else {
   13.16 -                Logger.frontendLogger.errorAndCrash("Error resizing")
   13.17 +                Log.shared.errorAndCrash("Error resizing")
   13.18                  return
   13.19          }
   13.20          let textAttachment = TextAttachment()
    14.1 --- a/pEpForiOS/UI/Compose/Cells/BodyCell/NSAttributedString+BodyTextUtils.swift	Tue May 07 19:18:28 2019 +0200
    14.2 +++ b/pEpForiOS/UI/Compose/Cells/BodyCell/NSAttributedString+BodyTextUtils.swift	Wed May 08 12:01:12 2019 +0200
    14.3 @@ -16,7 +16,7 @@
    14.4      public func assureMaxTextAttachmentImageWidth(_ maxWidth: CGFloat) {
    14.5          for textAttachment in textAttachments() {
    14.6              guard let image = textAttachment.image else {
    14.7 -                Logger.utilLogger.errorAndCrash("No image?")
    14.8 +                Log.shared.errorAndCrash("No image?")
    14.9                  return
   14.10              }
   14.11              if image.size.width > maxWidth {
    15.1 --- a/pEpForiOS/UI/Compose/Cells/RecipientCell/RecipientTextView/RecipientTextView.swift	Tue May 07 19:18:28 2019 +0200
    15.2 +++ b/pEpForiOS/UI/Compose/Cells/RecipientCell/RecipientTextView/RecipientTextView.swift	Wed May 08 12:01:12 2019 +0200
    15.3 @@ -48,7 +48,7 @@
    15.4                           shouldChangeTextIn range: NSRange,
    15.5                           replacementText text: String) -> Bool {
    15.6          guard let vm = viewModel else {
    15.7 -            Logger.frontendLogger.errorAndCrash("No VM")
    15.8 +            Log.shared.errorAndCrash("No VM")
    15.9              return true
   15.10          }
   15.11          if vm.isAddressDeliminator(str: text) {
   15.12 @@ -64,7 +64,7 @@
   15.13                      return true
   15.14              }
   15.15              guard let potentiallyReplacedText = textView.text(in: newRange) else {
   15.16 -                Logger.frontendLogger.errorAndCrash("Invalid state")
   15.17 +                Log.shared.errorAndCrash("Invalid state")
   15.18                  return true
   15.19              }
   15.20              // Check if text is Attachment and select it
   15.21 @@ -89,7 +89,7 @@
   15.22                    shouldInteractWith textAttachment: NSTextAttachment,
   15.23                    in characterRange: NSRange) -> Bool {
   15.24          guard let vm = viewModel else {
   15.25 -            Logger.frontendLogger.errorAndCrash("No VM")
   15.26 +            Log.shared.errorAndCrash("No VM")
   15.27              return true
   15.28          }
   15.29          return vm.shouldInteract(with: textAttachment)
    16.1 --- a/pEpForiOS/UI/Compose/Cells/RecipientCell/RecipientTextView/RecipientTextViewModel+TextAttachment.swift	Tue May 07 19:18:28 2019 +0200
    16.2 +++ b/pEpForiOS/UI/Compose/Cells/RecipientCell/RecipientTextView/RecipientTextViewModel+TextAttachment.swift	Wed May 08 12:01:12 2019 +0200
    16.3 @@ -79,7 +79,7 @@
    16.4                        attributes: attributes, context: nil)
    16.5  
    16.6              guard let createe = UIGraphicsGetImageFromCurrentImageContext() else {
    16.7 -                Logger.frontendLogger.errorAndCrash("No img")
    16.8 +                Log.shared.errorAndCrash("No img")
    16.9                  return
   16.10              }
   16.11              UIGraphicsEndImageContext()
    17.1 --- a/pEpForiOS/UI/Compose/ComposeTableViewController.swift	Tue May 07 19:18:28 2019 +0200
    17.2 +++ b/pEpForiOS/UI/Compose/ComposeTableViewController.swift	Wed May 08 12:01:12 2019 +0200
    17.3 @@ -19,7 +19,7 @@
    17.4      private var suggestionsChildViewController: SuggestTableViewController?
    17.5      lazy private var mediaAttachmentPickerProvider: MediaAttachmentPickerProvider? = {
    17.6          guard let pickerVm = viewModel?.mediaAttachmentPickerProviderViewModel() else {
    17.7 -            Logger.frontendLogger.errorAndCrash("Invalid state")
    17.8 +            Log.shared.errorAndCrash("Invalid state")
    17.9              return nil
   17.10          }
   17.11          return MediaAttachmentPickerProvider(with: pickerVm)
   17.12 @@ -75,7 +75,7 @@
   17.13                  withIdentifier: SuggestTableViewController.storyboardId)
   17.14                  as? SuggestTableViewController,
   17.15              let suggestView = suggestVc.view else {
   17.16 -                Logger.frontendLogger.errorAndCrash("No VC.")
   17.17 +                Log.shared.errorAndCrash("No VC.")
   17.18                  return
   17.19          }
   17.20          suggestionsChildViewController = suggestVc
   17.21 @@ -111,7 +111,7 @@
   17.22  extension ComposeTableViewController {
   17.23      private func setupPepColorView(for pEpRating: PEPRating, pEpProtected: Bool) {
   17.24          guard let vm = viewModel else {
   17.25 -            Logger.frontendLogger.errorAndCrash("No VM")
   17.26 +            Log.shared.errorAndCrash("No VM")
   17.27              return
   17.28          }
   17.29  
   17.30 @@ -129,7 +129,7 @@
   17.31      /// Shows a menu where user can choose to make a handshake, or toggle force unprotected.
   17.32      @objc func actionHandshakeOrForceUnprotected(gestureRecognizer: UITapGestureRecognizer) {
   17.33          guard let vm = viewModel else {
   17.34 -            Logger.frontendLogger.errorAndCrash("No VM")
   17.35 +            Log.shared.errorAndCrash("No VM")
   17.36              return
   17.37          }
   17.38          let theCanHandshake = vm.state.canHandshake()
   17.39 @@ -284,7 +284,7 @@
   17.40              guard
   17.41                  let nc = segue.destination as? UINavigationController,
   17.42                  let destination = nc.rootViewController as? HandshakeViewController else {
   17.43 -                    Logger.frontendLogger.errorAndCrash("Segue issue")
   17.44 +                    Log.shared.errorAndCrash("Segue issue")
   17.45                      return
   17.46              }
   17.47              destination.appConfig = appConfig
   17.48 @@ -318,7 +318,7 @@
   17.49              }
   17.50              guard let me = self,
   17.51              let picker = me.mediaAttachmentPickerProvider?.imagePicker else {
   17.52 -                Logger.frontendLogger.errorAndCrash("Lost somthing")
   17.53 +                Log.shared.errorAndCrash("Lost somthing")
   17.54                  return
   17.55              }
   17.56              me.present(picker, animated: true)
   17.57 @@ -340,7 +340,7 @@
   17.58      
   17.59      override func numberOfSections(in tableView: UITableView) -> Int {
   17.60          guard let vm = viewModel else {
   17.61 -            Logger.frontendLogger.errorAndCrash("No VM")
   17.62 +            Log.shared.errorAndCrash("No VM")
   17.63              return 0
   17.64          }
   17.65          return vm.sections.count
   17.66 @@ -349,7 +349,7 @@
   17.67      override func tableView(_ tableView: UITableView,
   17.68                              numberOfRowsInSection section: Int) -> Int {
   17.69          guard let vm = viewModel else {
   17.70 -            Logger.frontendLogger.errorAndCrash("No VM")
   17.71 +            Log.shared.errorAndCrash("No VM")
   17.72              return 0
   17.73          }
   17.74          return vm.sections[section].rows.count
   17.75 @@ -358,7 +358,7 @@
   17.76      override func tableView(_ tableView: UITableView,
   17.77                              cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   17.78          guard let cell = setupCellForIndexPath(indexPath, in: tableView) else {
   17.79 -            Logger.frontendLogger.errorAndCrash("No cell")
   17.80 +            Log.shared.errorAndCrash("No cell")
   17.81              return UITableViewCell()
   17.82          }
   17.83          return cell
   17.84 @@ -367,7 +367,7 @@
   17.85      private func setupCellForIndexPath(_ indexPath: IndexPath,
   17.86                                    in tableView: UITableView) -> UITableViewCell? {
   17.87          guard let vm = viewModel else {
   17.88 -            Logger.frontendLogger.errorAndCrash("No VM")
   17.89 +            Log.shared.errorAndCrash("No VM")
   17.90              return UITableViewCell()
   17.91          }
   17.92  
   17.93 @@ -380,7 +380,7 @@
   17.94                      as? RecipientCell,
   17.95                  let rowVm = section.rows[indexPath.row] as? RecipientCellViewModel
   17.96                  else {
   17.97 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
   17.98 +                    Log.shared.errorAndCrash("Invalid state")
   17.99                      return nil
  17.100              }
  17.101              cell.setup(with: rowVm)
  17.102 @@ -393,7 +393,7 @@
  17.103                      as? AccountCell,
  17.104                  let rowVm = section.rows[indexPath.row] as? AccountCellViewModel
  17.105                  else {
  17.106 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
  17.107 +                    Log.shared.errorAndCrash("Invalid state")
  17.108                      return nil
  17.109              }
  17.110              cell.setup(with: rowVm)
  17.111 @@ -404,7 +404,7 @@
  17.112                          as? SubjectCell,
  17.113                      let rowVm = section.rows[indexPath.row] as? SubjectCellViewModel
  17.114                      else {
  17.115 -                        Logger.frontendLogger.errorAndCrash("Invalid state")
  17.116 +                        Log.shared.errorAndCrash("Invalid state")
  17.117                      return nil
  17.118              }
  17.119              cell.setup(with: rowVm)
  17.120 @@ -415,7 +415,7 @@
  17.121                      as? BodyCell,
  17.122                  let rowVm = section.rows[indexPath.row] as? BodyCellViewModel
  17.123                  else {
  17.124 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
  17.125 +                    Log.shared.errorAndCrash("Invalid state")
  17.126                      return nil
  17.127              }
  17.128              cell.setup(with: rowVm)
  17.129 @@ -426,7 +426,7 @@
  17.130                      as? AttachmentCell,
  17.131                  let rowVm = section.rows[indexPath.row] as? AttachmentViewModel
  17.132                  else {
  17.133 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
  17.134 +                    Log.shared.errorAndCrash("Invalid state")
  17.135                      return nil
  17.136              }
  17.137              cell.setup(with: rowVm)
  17.138 @@ -482,7 +482,7 @@
  17.139          let deleteAction = SwipeAction(style: .destructive, title: "Delete") {
  17.140              [weak self] action, indexPath in
  17.141              guard let me = self else {
  17.142 -                Logger.frontendLogger.lostMySelf()
  17.143 +                Log.shared.errorAndCrash("Lost MySelf")
  17.144                  return
  17.145              }
  17.146              me.deleteAction(forCellAt: indexPath)
  17.147 @@ -501,7 +501,7 @@
  17.148              // The last cell is not yet displayed (as we are in "willDisplay ..."), thus async.
  17.149              DispatchQueue.main.async { [weak self] in
  17.150                  guard let me = self else {
  17.151 -                    Logger.frontendLogger.lostMySelf()
  17.152 +                    Log.shared.errorAndCrash("Lost MySelf")
  17.153                      return
  17.154                  }
  17.155                  me.setInitialFocus()
  17.156 @@ -521,7 +521,7 @@
  17.157          }
  17.158          isInitialFocusSet = true
  17.159          guard let vm = viewModel else {
  17.160 -            Logger.frontendLogger.errorAndCrash("No VM")
  17.161 +            Log.shared.errorAndCrash("No VM")
  17.162              return
  17.163          }
  17.164          let idxPath = vm.initialFocus()
  17.165 @@ -535,13 +535,13 @@
  17.166  
  17.167      private func setPreviousFocusAfterPicker() {
  17.168          guard let vm = viewModel else {
  17.169 -            Logger.frontendLogger.errorAndCrash("No VM")
  17.170 +            Log.shared.errorAndCrash("No VM")
  17.171              return
  17.172          }
  17.173          let idxPath = vm.beforePickerFocus()
  17.174          guard let cellToFocus = tableView.cellForRow(at: idxPath)
  17.175              as? TextViewContainingTableViewCell else {
  17.176 -                Logger.frontendLogger.errorAndCrash("Error casting")
  17.177 +                Log.shared.errorAndCrash("Error casting")
  17.178                  return
  17.179          }
  17.180          cellToFocus.setFocus()
  17.181 @@ -549,7 +549,7 @@
  17.182  
  17.183      private func isLastRow(indexPath: IndexPath) -> Bool {
  17.184          guard let vm = viewModel else {
  17.185 -            Logger.frontendLogger.errorAndCrash("No VM")
  17.186 +            Log.shared.errorAndCrash("No VM")
  17.187              return false
  17.188          }
  17.189          let idxLastSection = vm.sections.count - 1
  17.190 @@ -579,14 +579,14 @@
  17.191  
  17.192      private func deleteAction(forAlertController ac: UIAlertController) -> UIAlertAction {
  17.193          guard let vm = viewModel else {
  17.194 -            Logger.frontendLogger.errorAndCrash("No VM")
  17.195 +            Log.shared.errorAndCrash("No VM")
  17.196              return UIAlertAction()
  17.197          }
  17.198          let action: UIAlertAction
  17.199          let text = vm.deleteActionTitle
  17.200          action = ac.action(text, .destructive) {[weak self] in
  17.201              guard let me = self else {
  17.202 -                Logger.frontendLogger.lostMySelf()
  17.203 +                Log.shared.errorAndCrash("Lost MySelf")
  17.204                  return
  17.205              }
  17.206              vm.handleDeleteActionTriggered()
  17.207 @@ -597,14 +597,14 @@
  17.208  
  17.209      private func saveAction(forAlertController ac: UIAlertController) -> UIAlertAction {
  17.210          guard let vm = viewModel else {
  17.211 -            Logger.frontendLogger.errorAndCrash("No VM")
  17.212 +            Log.shared.errorAndCrash("No VM")
  17.213              return UIAlertAction()
  17.214          }
  17.215          let action: UIAlertAction
  17.216          let text = vm.saveActionTitle
  17.217          action = ac.action(text, .default) { [weak self] in
  17.218              guard let me = self else {
  17.219 -                Logger.frontendLogger.lostMySelf()
  17.220 +                Log.shared.errorAndCrash("Lost MySelf")
  17.221                  return
  17.222              }
  17.223              vm.handleSaveActionTriggered()
  17.224 @@ -615,14 +615,14 @@
  17.225  
  17.226      private func keepInOutboxAction(forAlertController ac: UIAlertController) -> UIAlertAction {
  17.227          guard let vm = viewModel else {
  17.228 -            Logger.frontendLogger.errorAndCrash("No VM")
  17.229 +            Log.shared.errorAndCrash("No VM")
  17.230              return UIAlertAction()
  17.231          }
  17.232          let action: UIAlertAction
  17.233          let text = vm.keepInOutboxActionTitle
  17.234          action = ac.action(text, .default) {[weak self] in
  17.235              guard let me = self else {
  17.236 -                Logger.frontendLogger.lostMySelf()
  17.237 +                Log.shared.errorAndCrash("Lost MySelf")
  17.238                  return
  17.239              }
  17.240              me.dismiss()
  17.241 @@ -632,7 +632,7 @@
  17.242  
  17.243      private func cancelAction(forAlertController ac: UIAlertController) -> UIAlertAction {
  17.244          guard let vm = viewModel else {
  17.245 -            Logger.frontendLogger.errorAndCrash("No VM")
  17.246 +            Log.shared.errorAndCrash("No VM")
  17.247              return UIAlertAction()
  17.248          }
  17.249          return ac.action(vm.cancelActionTitle, .cancel)
    18.1 --- a/pEpForiOS/UI/Compose/Util/ComposeUtil.swift	Tue May 07 19:18:28 2019 +0200
    18.2 +++ b/pEpForiOS/UI/Compose/Util/ComposeUtil.swift	Wed May 08 12:01:12 2019 +0200
    18.3 @@ -36,7 +36,7 @@
    18.4                  result = om.to.allObjects
    18.5              } else if om.parent.folderType != .sent, let omFrom = om.from {
    18.6                  guard let me = initialFrom(composeMode: composeMode, originalMessage: om) else {
    18.7 -                    Logger.utilLogger.errorAndCrash("No from")
    18.8 +                    Log.shared.errorAndCrash("No from")
    18.9                      return result
   18.10                  }
   18.11                  let origTos = om.to
   18.12 @@ -63,7 +63,7 @@
   18.13                  result = om.cc.allObjects
   18.14              } else {
   18.15                  guard let me = initialFrom(composeMode: composeMode, originalMessage: om) else {
   18.16 -                    Logger.utilLogger.errorAndCrash("No from")
   18.17 +                    Log.shared.errorAndCrash("No from")
   18.18                      return result
   18.19                  }
   18.20                  let origCcs = om.cc
   18.21 @@ -147,12 +147,12 @@
   18.22          withDataFrom state: ComposeViewModel.ComposeViewModelState) -> Message? {
   18.23          guard let from = state.from,
   18.24              let account = Account.by(address: from.address) else {
   18.25 -                Logger.frontendLogger.errorAndCrash(
   18.26 +                Log.shared.errorAndCrash(
   18.27                      "We have a problem here getting the senders account.")
   18.28                  return nil
   18.29          }
   18.30          guard let f = Folder.by(account: account, folderType: .outbox) else {
   18.31 -            Logger.utilLogger.errorAndCrash("No outbox")
   18.32 +            Log.shared.errorAndCrash("No outbox")
   18.33              return nil
   18.34          }
   18.35  
    19.1 --- a/pEpForiOS/UI/Compose/Util/DocumentAttachmentPickerViewController/DocumentAttachmentPickerViewModel.swift	Tue May 07 19:18:28 2019 +0200
    19.2 +++ b/pEpForiOS/UI/Compose/Util/DocumentAttachmentPickerViewController/DocumentAttachmentPickerViewModel.swift	Wed May 08 12:01:12 2019 +0200
    19.3 @@ -31,11 +31,11 @@
    19.4              createAttachment(forSecurityScopedResource: url) {
    19.5                  [weak self] (attachment: Attachment?) in
    19.6                  guard let me = self else {
    19.7 -                    Logger.frontendLogger.lostMySelf()
    19.8 +                    Log.shared.errorAndCrash("Lost MySelf")
    19.9                      return
   19.10                  }
   19.11                  guard let safeAttachment = attachment else {
   19.12 -                    Logger.frontendLogger.errorAndCrash("No attachment")
   19.13 +                    Log.shared.errorAndCrash("No attachment")
   19.14                      return
   19.15                  }
   19.16                  GCD.onMain {
   19.17 @@ -63,7 +63,7 @@
   19.18              CFURLStartAccessingSecurityScopedResource(cfUrl)
   19.19              defer { CFURLStopAccessingSecurityScopedResource(cfUrl) }
   19.20              guard  let resourceData = try? Data(contentsOf: resourceUrl)  else {
   19.21 -                Logger.frontendLogger.errorAndCrash("No data for URL.")
   19.22 +                Log.shared.errorAndCrash("No data for URL.")
   19.23                  completion(nil)
   19.24                  return
   19.25              }
    20.1 --- a/pEpForiOS/UI/Compose/Util/MediaAttachmentPickerProvider/MediaAttachmentPickerProviderViewModel.swift	Tue May 07 19:18:28 2019 +0200
    20.2 +++ b/pEpForiOS/UI/Compose/Util/MediaAttachmentPickerProvider/MediaAttachmentPickerProviderViewModel.swift	Wed May 08 12:01:12 2019 +0200
    20.3 @@ -48,7 +48,7 @@
    20.4          guard
    20.5              let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage,
    20.6              let url = info[UIImagePickerController.InfoKey.referenceURL] as? URL else {
    20.7 -                Logger.frontendLogger.errorAndCrash("No Data")
    20.8 +                Log.shared.errorAndCrash("No Data")
    20.9                  return
   20.10          }
   20.11  
   20.12 @@ -59,17 +59,17 @@
   20.13  
   20.14      private func createMovieAttchmentAndInformResultDelegate(info: [UIImagePickerController.InfoKey: Any]) {
   20.15          guard let url = info[UIImagePickerController.InfoKey.mediaURL] as? URL else {
   20.16 -            Logger.frontendLogger.errorAndCrash("No URL")
   20.17 +            Log.shared.errorAndCrash("No URL")
   20.18              return
   20.19          }
   20.20  
   20.21          createAttachment(forResource: url) {[weak self] (attachment)  in
   20.22              guard let me = self else {
   20.23 -                Logger.frontendLogger.lostMySelf()
   20.24 +                Log.shared.errorAndCrash("Lost MySelf")
   20.25                  return
   20.26              }
   20.27              guard let att = attachment else {
   20.28 -                Logger.frontendLogger.errorAndCrash("No Attachment")
   20.29 +                Log.shared.errorAndCrash("No Attachment")
   20.30                  return
   20.31              }
   20.32              let result = MediaAttachment(type: .movie, attachment: att)
   20.33 @@ -83,11 +83,11 @@
   20.34                                    completion: @escaping (Attachment?) -> Void) {
   20.35          attachmentFileIOQueue.async { [weak self] in
   20.36              guard let me = self else {
   20.37 -                Logger.frontendLogger.lostMySelf()
   20.38 +                Log.shared.errorAndCrash("Lost MySelf")
   20.39                  return
   20.40              }
   20.41              guard let resourceData = try? Data(contentsOf: resourceUrl) else {
   20.42 -                Logger.frontendLogger.errorAndCrash("Cound not get data for URL")
   20.43 +                Log.shared.errorAndCrash("Cound not get data for URL")
   20.44                  completion(nil)
   20.45                  return
   20.46              }
    21.1 --- a/pEpForiOS/UI/Compose/ViewModel/ComposeViewModel+InitData.swift	Tue May 07 19:18:28 2019 +0200
    21.2 +++ b/pEpForiOS/UI/Compose/ViewModel/ComposeViewModel+InitData.swift	Wed May 08 12:01:12 2019 +0200
    21.3 @@ -163,12 +163,12 @@
    21.4          /// Is sutable for isDraftsOrOutbox || composeMode == .forward only.
    21.5          mutating private func setBodyPotetionallyTakingOverAttachments() {
    21.6              guard let msg = originalMessage else {
    21.7 -                Logger.frontendLogger.errorAndCrash("Inconsitant state")
    21.8 +                Log.shared.errorAndCrash("Inconsitant state")
    21.9                  return
   21.10              }
   21.11  
   21.12              guard isDraftsOrOutbox || composeMode == .forward else {
   21.13 -                Logger.frontendLogger.errorAndCrash("Unsupported mode or message")
   21.14 +                Log.shared.errorAndCrash("Unsupported mode or message")
   21.15                  return
   21.16              }
   21.17              if let html = msg.longMessageFormatted {
   21.18 @@ -220,7 +220,7 @@
   21.19          // Assure the image is set.
   21.20          if attachment.image == nil {
   21.21              guard let safeData = attachment.data else {
   21.22 -                Logger.frontendLogger.errorAndCrash("No data")
   21.23 +                Log.shared.errorAndCrash("No data")
   21.24                  return
   21.25              }
   21.26              attachment.image = UIImage(data: safeData)
    22.1 --- a/pEpForiOS/UI/Compose/ViewModel/ComposeViewModel.swift	Tue May 07 19:18:28 2019 +0200
    22.2 +++ b/pEpForiOS/UI/Compose/ViewModel/ComposeViewModel.swift	Wed May 08 12:01:12 2019 +0200
    22.3 @@ -77,7 +77,7 @@
    22.4          guard
    22.5              let vm = bodySection?.rows.first,
    22.6              let body = indexPath(for: vm) else {
    22.7 -                Logger.frontendLogger.errorAndCrash("No body")
    22.8 +                Log.shared.errorAndCrash("No body")
    22.9                  return IndexPath(row: 0, section: 0)
   22.10          }
   22.11          return body
   22.12 @@ -129,12 +129,12 @@
   22.13  
   22.14      public func handleUserClickedSendButton() {
   22.15          guard let msg = ComposeUtil.messageToSend(withDataFrom: state) else {
   22.16 -            Logger.frontendLogger.warn("No message for sending")
   22.17 +            Log.shared.warn("No message for sending")
   22.18              return
   22.19          }
   22.20          msg.save()
   22.21          guard let data = state.initData else {
   22.22 -            Logger.frontendLogger.errorAndCrash("No data")
   22.23 +            Log.shared.errorAndCrash("No data")
   22.24              return
   22.25          }
   22.26          if data.isDraftsOrOutbox {
   22.27 @@ -152,7 +152,7 @@
   22.28  
   22.29      public func handleRemovedRow(at indexPath: IndexPath) {
   22.30          guard let removeeVM = viewModel(for: indexPath) as? AttachmentViewModel else {
   22.31 -                Logger.frontendLogger.errorAndCrash("Only attachmnets can be removed by the user")
   22.32 +                Log.shared.errorAndCrash("Only attachmnets can be removed by the user")
   22.33                  return
   22.34          }
   22.35          removeNonInlinedAttachment(removeeVM.attachment)
   22.36 @@ -160,7 +160,7 @@
   22.37  
   22.38      private func deleteOriginalMessage() {
   22.39          guard let data = state.initData else {
   22.40 -            Logger.frontendLogger.errorAndCrash("No data")
   22.41 +            Log.shared.errorAndCrash("No data")
   22.42              return
   22.43          }
   22.44          guard let om = data.originalMessage else {
   22.45 @@ -183,7 +183,7 @@
   22.46          for section in sections where section.type == .recipients {
   22.47              for row  in section.rows where row is RecipientCellViewModel {
   22.48                  guard let recipientVM = row as? RecipientCellViewModel else {
   22.49 -                    Logger.frontendLogger.errorAndCrash("Cast error")
   22.50 +                    Log.shared.errorAndCrash("Cast error")
   22.51                      return false
   22.52                  }
   22.53                  if recipientVM.isDirty {
   22.54 @@ -362,14 +362,14 @@
   22.55  extension ComposeViewModel {
   22.56      private func removeNonInlinedAttachment(_ removee: Attachment) {
   22.57          guard let section = section(for: .attachments) else {
   22.58 -            Logger.frontendLogger.errorAndCrash("Only attachmnets can be removed by the user")
   22.59 +            Log.shared.errorAndCrash("Only attachmnets can be removed by the user")
   22.60              return
   22.61          }
   22.62          // Remove from section
   22.63          var newAttachmentVMs = [AttachmentViewModel]()
   22.64          for vm in section.rows {
   22.65              guard let aVM = vm as? AttachmentViewModel else {
   22.66 -                Logger.frontendLogger.errorAndCrash("Error casting")
   22.67 +                Log.shared.errorAndCrash("Error casting")
   22.68                  return
   22.69              }
   22.70              if aVM.attachment != removee {
   22.71 @@ -395,7 +395,7 @@
   22.72              existing.rows.append(AttachmentViewModel(attachment: att))
   22.73          } else {
   22.74              guard let new = Section(type: .attachments, for: state, cellVmDelegate: self) else {
   22.75 -                Logger.frontendLogger.errorAndCrash("Invalid state")
   22.76 +                Log.shared.errorAndCrash("Invalid state")
   22.77                  return
   22.78              }
   22.79              sections.append(new)
   22.80 @@ -422,7 +422,7 @@
   22.81              let idxPath = lastRowWithSuggestions,
   22.82              let recipientVM = sections[idxPath.section].rows[idxPath.row] as? RecipientCellViewModel
   22.83              else {
   22.84 -                Logger.frontendLogger.errorAndCrash("No row VM")
   22.85 +                Log.shared.errorAndCrash("No row VM")
   22.86              return
   22.87          }
   22.88          recipientVM.add(recipient: identity)
   22.89 @@ -473,7 +473,7 @@
   22.90          didSelect mediaAttachment: MediaAttachmentPickerProviderViewModel.MediaAttachment) {
   22.91          if mediaAttachment.type == .image {
   22.92              guard let bodyViewModel = bodyVM else {
   22.93 -                Logger.frontendLogger.errorAndCrash("No bodyVM. Maybe valid as picking is async.")
   22.94 +                Log.shared.errorAndCrash("No bodyVM. Maybe valid as picking is async.")
   22.95                  return
   22.96              }
   22.97              bodyViewModel.inline(attachment: mediaAttachment.attachment)
   22.98 @@ -498,7 +498,7 @@
   22.99  
  22.100      public var deleteActionTitle: String {
  22.101          guard let data = state.initData else {
  22.102 -            Logger.frontendLogger.errorAndCrash("No data")
  22.103 +            Log.shared.errorAndCrash("No data")
  22.104              return ""
  22.105          }
  22.106          let title: String
  22.107 @@ -517,7 +517,7 @@
  22.108  
  22.109      public var saveActionTitle: String {
  22.110          guard let data = state.initData else {
  22.111 -            Logger.frontendLogger.errorAndCrash("No data")
  22.112 +            Log.shared.errorAndCrash("No data")
  22.113              return ""
  22.114          }
  22.115          let title: String
  22.116 @@ -541,7 +541,7 @@
  22.117  
  22.118      public func handleDeleteActionTriggered() {
  22.119          guard let data = state.initData else {
  22.120 -            Logger.frontendLogger.errorAndCrash("No data")
  22.121 +            Log.shared.errorAndCrash("No data")
  22.122              return
  22.123          }
  22.124          if data.isOutbox {
  22.125 @@ -554,7 +554,7 @@
  22.126  
  22.127      public func handleSaveActionTriggered() {
  22.128          guard let data = state.initData else {
  22.129 -            Logger.frontendLogger.errorAndCrash("No data")
  22.130 +            Log.shared.errorAndCrash("No data")
  22.131              return
  22.132          }
  22.133          if data.isDraftsOrOutbox {
  22.134 @@ -572,12 +572,12 @@
  22.135          }
  22.136  
  22.137          guard let msg = ComposeUtil.messageToSend(withDataFrom: state) else {
  22.138 -            Logger.frontendLogger.errorAndCrash("No message")
  22.139 +            Log.shared.errorAndCrash("No message")
  22.140              return
  22.141          }
  22.142          let acc = msg.parent.account
  22.143          guard let f = Folder.by(account:acc, folderType: .drafts) else {
  22.144 -            Logger.frontendLogger.errorAndCrash("No drafts")
  22.145 +            Log.shared.errorAndCrash("No drafts")
  22.146              return
  22.147          }
  22.148          msg.parent = f
  22.149 @@ -623,7 +623,7 @@
  22.150  
  22.151      func recipientCellViewModel(_ vm: RecipientCellViewModel, didBeginEditing text: String) {
  22.152          guard let idxPath = indexPath(for: vm) else {
  22.153 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  22.154 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  22.155              return
  22.156          }
  22.157          lastRowWithSuggestions = idxPath
  22.158 @@ -639,7 +639,7 @@
  22.159  
  22.160      func recipientCellViewModel(_ vm: RecipientCellViewModel, textChanged newText: String) {
  22.161          guard let idxPath = indexPath(for: vm) else {
  22.162 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  22.163 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  22.164              return
  22.165          }
  22.166          lastRowWithSuggestions = idxPath
  22.167 @@ -656,7 +656,7 @@
  22.168  extension ComposeViewModel: AccountCellViewModelResultDelegate {
  22.169      func accountCellViewModel(_ vm: AccountCellViewModel, accountChangedTo account: Account) {
  22.170          guard let idxPath = indexPath(for: vm) else {
  22.171 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  22.172 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  22.173              return
  22.174          }
  22.175          state.from = account.user
  22.176 @@ -670,7 +670,7 @@
  22.177  
  22.178      func subjectCellViewModelDidChangeSubject(_ vm: SubjectCellViewModel) {
  22.179          guard let idxPath = indexPath(for: vm) else {
  22.180 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  22.181 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  22.182              return
  22.183          }
  22.184          state.subject = vm.content ?? ""
  22.185 @@ -709,7 +709,7 @@
  22.186          state.bodyHtml = html
  22.187          state.bodyPlaintext = plain
  22.188          guard let idxPath = indexPath(for: vm) else {
  22.189 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  22.190 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  22.191              return
  22.192          }
  22.193          delegate?.contentChanged(inRowAt: idxPath)
    23.1 --- a/pEpForiOS/UI/Compose/ViewModel/ComposeViewModelState.swift	Tue May 07 19:18:28 2019 +0200
    23.2 +++ b/pEpForiOS/UI/Compose/ViewModel/ComposeViewModelState.swift	Wed May 08 12:01:12 2019 +0200
    23.3 @@ -124,7 +124,7 @@
    23.4  
    23.5          private func setup() {
    23.6              guard let initData = initData else {
    23.7 -                Logger.frontendLogger.errorAndCrash("No data")
    23.8 +                Log.shared.errorAndCrash("No data")
    23.9                  return
   23.10              }
   23.11              toRecipients = initData.toRecipients
    24.1 --- a/pEpForiOS/UI/EmailDisplay/Background/AttachmentToLocalURLOperation.swift	Tue May 07 19:18:28 2019 +0200
    24.2 +++ b/pEpForiOS/UI/EmailDisplay/Background/AttachmentToLocalURLOperation.swift	Wed May 08 12:01:12 2019 +0200
    24.3 @@ -21,7 +21,7 @@
    24.4  
    24.5      override func main() {
    24.6          guard let data = attachment.data else {
    24.7 -            Logger.backendLogger.warn("Attachment without data")
    24.8 +            Log.shared.warn("Attachment without data")
    24.9              return
   24.10          }
   24.11          var tmpDirURL: URL?
   24.12 @@ -44,7 +44,7 @@
   24.13              try data.write(to: theURL)
   24.14              fileURL = theURL
   24.15          } catch {
   24.16 -            Logger.backendLogger.log(error: error)
   24.17 +            Log.shared.log(error: error)
   24.18          }
   24.19      }
   24.20  }
    25.1 --- a/pEpForiOS/UI/EmailDisplay/EmailViewController.swift	Tue May 07 19:18:28 2019 +0200
    25.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailViewController.swift	Wed May 08 12:01:12 2019 +0200
    25.3 @@ -186,7 +186,7 @@
    25.4      // Sets the destructive bottom bar item accordint to the message (trash/archive)
    25.5      private func setupDestructiveButtonIcon() {
    25.6          guard let msg = message else {
    25.7 -            Logger.frontendLogger.errorAndCrash("No message")
    25.8 +            Log.shared.errorAndCrash("No message")
    25.9              return
   25.10          }
   25.11  
   25.12 @@ -236,7 +236,7 @@
   25.13              storyboard.instantiateViewController(withIdentifier: SecureWebViewController.storyboardId)
   25.14                  as? SecureWebViewController
   25.15              else {
   25.16 -                Logger.frontendLogger.errorAndCrash("Cast error")
   25.17 +                Log.shared.errorAndCrash("Cast error")
   25.18                  return SecureWebViewController()
   25.19          }
   25.20          vc.zoomingEnabled = true
   25.21 @@ -267,7 +267,7 @@
   25.22  
   25.23      private func setup(contentCell: MessageContentCell, rowData: ComposeFieldModel) {
   25.24          guard let m = message else {
   25.25 -            Logger.frontendLogger.errorAndCrash("No msg.")
   25.26 +            Log.shared.errorAndCrash("No msg.")
   25.27              return
   25.28          }
   25.29          if let htmlBody = htmlBody(message: m) {
   25.30 @@ -329,7 +329,7 @@
   25.31              message = m
   25.32          }
   25.33  
   25.34 -        Logger.frontendLogger.log("next, will reload table view")
   25.35 +        Log.shared.log("next, will reload table view")
   25.36          configureTableRows()
   25.37          tableView.reloadData()
   25.38          configureView()
   25.39 @@ -341,7 +341,7 @@
   25.40              message = m
   25.41          }
   25.42  
   25.43 -        Logger.frontendLogger.log("previous, will reload table view")
   25.44 +        Log.shared.log("previous, will reload table view")
   25.45          configureTableRows()
   25.46          tableView.reloadData()
   25.47          configureView()
   25.48 @@ -353,19 +353,19 @@
   25.49          let alert = ReplyAlertCreator(replyAllChecker: ReplyAllPossibleChecker())
   25.50              .withReplyOption { [weak self] action in
   25.51                  guard let me = self else {
   25.52 -                    Logger.frontendLogger.lostMySelf()
   25.53 +                    Log.shared.errorAndCrash("Lost MySelf")
   25.54                      return
   25.55                  }
   25.56                  me.performSegue(withIdentifier: .segueReplyFrom , sender: self)
   25.57              }.withReplyAllOption(forMessage: message) { [weak self] action in
   25.58                  guard let me = self else {
   25.59 -                    Logger.frontendLogger.lostMySelf()
   25.60 +                    Log.shared.errorAndCrash("Lost MySelf")
   25.61                      return
   25.62                  }
   25.63                  me.performSegue(withIdentifier: .segueReplyAllForm , sender: self)
   25.64              }.withFordwardOption { [weak self] action in
   25.65                  guard let me = self else {
   25.66 -                    Logger.frontendLogger.lostMySelf()
   25.67 +                    Log.shared.errorAndCrash("Lost MySelf")
   25.68                      return
   25.69                  }
   25.70                  me.performSegue(withIdentifier: .segueForward , sender: self)
   25.71 @@ -463,7 +463,7 @@
   25.72  
   25.73      override func tableView(
   25.74          _ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   25.75 -        Logger.frontendLogger.log("cell for %d:%d", indexPath.section, indexPath.row)
   25.76 +        Log.shared.log("cell for %d:%d", indexPath.section, indexPath.row)
   25.77          guard
   25.78              let row = tableData?.getRow(at: indexPath.row),
   25.79              let cell = tableView.dequeueReusableCell(
   25.80 @@ -485,7 +485,7 @@
   25.81          _ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
   25.82          guard
   25.83              let row = tableData?.getRow(at: indexPath.row) else {
   25.84 -                Logger.frontendLogger.errorAndCrash("Missing data")
   25.85 +                Log.shared.errorAndCrash("Missing data")
   25.86                  return tableView.estimatedRowHeight
   25.87          }
   25.88  
   25.89 @@ -525,7 +525,7 @@
   25.90          case .segueReplyFrom, .segueReplyAllForm, .segueForward:
   25.91              guard  let nav = segue.destination as? UINavigationController,
   25.92                  let destination = nav.topViewController as? ComposeTableViewController else {
   25.93 -                    Logger.frontendLogger.errorAndCrash("No DVC?")
   25.94 +                    Log.shared.errorAndCrash("No DVC?")
   25.95                      break
   25.96              }
   25.97              destination.appConfig = appConfig
   25.98 @@ -536,7 +536,7 @@
   25.99          case .segueShowMoveToFolder:
  25.100              guard  let nav = segue.destination as? UINavigationController,
  25.101                  let destination = nav.topViewController as? MoveToAccountViewController else {
  25.102 -                    Logger.frontendLogger.errorAndCrash("No DVC?")
  25.103 +                    Log.shared.errorAndCrash("No DVC?")
  25.104                      break
  25.105              }
  25.106              destination.appConfig = appConfig
  25.107 @@ -549,7 +549,7 @@
  25.108              guard let nv = segue.destination as? UINavigationController,
  25.109                  let vc = nv.topViewController as? HandshakeViewController,
  25.110                  let titleView = navigationItem.titleView else {
  25.111 -                Logger.frontendLogger.errorAndCrash("No DVC?")
  25.112 +                Log.shared.errorAndCrash("No DVC?")
  25.113                  break
  25.114              }
  25.115  
  25.116 @@ -576,7 +576,7 @@
  25.117          } else if segueId == .segueForward {
  25.118              return  .forward
  25.119          } else {
  25.120 -            Logger.frontendLogger.errorAndCrash("Unsupported input")
  25.121 +            Log.shared.errorAndCrash("Unsupported input")
  25.122              return .replyFrom
  25.123          }
  25.124      }
    26.1 --- a/pEpForiOS/UI/EmailDisplay/Stuff that is named Compose but is used only in EmailView/ComposeDataSource.swift	Tue May 07 19:18:28 2019 +0200
    26.2 +++ b/pEpForiOS/UI/EmailDisplay/Stuff that is named Compose but is used only in EmailView/ComposeDataSource.swift	Wed May 08 12:01:12 2019 +0200
    26.3 @@ -40,12 +40,12 @@
    26.4          } else {
    26.5              filterRows(filter: { $0.type != .mailingList} )
    26.6          }
    26.7 -        Logger.frontendLogger.log("filtering rows")
    26.8 +        Log.shared.log("filtering rows")
    26.9      }
   26.10  
   26.11      func numberOfRows() -> Int {
   26.12          let visibleRows = getVisibleRows()
   26.13 -        Logger.frontendLogger.log("number of rows -> %d", visibleRows.count)
   26.14 +        Log.shared.log("number of rows -> %d", visibleRows.count)
   26.15          return visibleRows.count
   26.16      }
   26.17  
   26.18 @@ -74,7 +74,7 @@
   26.19  
   26.20          subscript(index: Int) -> Row? {
   26.21              if index < 0 || index > (attachments.count - 1) {
   26.22 -                Logger.frontendLogger.errorAndCrash("Index out of bounds")
   26.23 +                Log.shared.errorAndCrash("Index out of bounds")
   26.24                  return nil
   26.25              }
   26.26              let attachment = attachments[index]
   26.27 @@ -116,7 +116,7 @@
   26.28  
   26.29          mutating func remove(at index: Int) {
   26.30              if index < 0 || index > (attachments.count - 1) {
   26.31 -                Logger.frontendLogger.errorAndCrash("Index out of bounds")
   26.32 +                Log.shared.errorAndCrash("Index out of bounds")
   26.33                  return
   26.34              }
   26.35              attachments.remove(at: index)
    27.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Tue May 07 19:18:28 2019 +0200
    27.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Wed May 08 12:01:12 2019 +0200
    27.3 @@ -64,7 +64,7 @@
    27.4          // Mark this folder as having been looked at by the user
    27.5  
    27.6          guard let vm = model else {
    27.7 -            Log.shared.errorAndCrash(component: #function, errorString: "No VM")
    27.8 +            Log.shared.errorAndCrash("No VM")
    27.9              return
   27.10          }
   27.11  
   27.12 @@ -93,7 +93,7 @@
   27.13      private func setup() {
   27.14  
   27.15          guard let vm = model else {
   27.16 -            Log.shared.errorAndCrash(component: #function, errorString: "No VM")
   27.17 +            Log.shared.errorAndCrash("No VM")
   27.18              return
   27.19          }
   27.20  
   27.21 @@ -217,7 +217,7 @@
   27.22          }
   27.23          if splitViewController.isCollapsed {
   27.24              guard let vm = model else {
   27.25 -                Logger.frontendLogger.errorAndCrash("Invalid state")
   27.26 +                Log.shared.errorAndCrash("Invalid state")
   27.27                  return
   27.28              }
   27.29              let unreadFilterActive = vm.unreadFilterEnabled()
   27.30 @@ -438,7 +438,7 @@
   27.31      
   27.32      @IBAction func filterButtonHasBeenPressed(_ sender: UIBarButtonItem) {
   27.33          guard let vm = model else {
   27.34 -            Logger.frontendLogger.errorAndCrash("We should have a model here")
   27.35 +            Log.shared.errorAndCrash("We should have a model here")
   27.36              return
   27.37          }
   27.38          vm.isFilterEnabled = !vm.isFilterEnabled
   27.39 @@ -459,7 +459,7 @@
   27.40  
   27.41      private func updateFilterButtonView() {
   27.42          guard let vm = model else {
   27.43 -            Logger.frontendLogger.errorAndCrash("We should have a model here")
   27.44 +            Log.shared.errorAndCrash("We should have a model here")
   27.45              return
   27.46          }
   27.47  
   27.48 @@ -506,7 +506,7 @@
   27.49              }
   27.50              theCell.configure(for:viewModel)
   27.51          } else {
   27.52 -            Logger.frontendLogger.errorAndCrash("dequeued wrong cell")
   27.53 +            Log.shared.errorAndCrash("dequeued wrong cell")
   27.54          }
   27.55  
   27.56          return cell
   27.57 @@ -526,7 +526,7 @@
   27.58          var swipeActions = [SwipeAction]()
   27.59  
   27.60          guard let model = model else {
   27.61 -            Logger.frontendLogger.errorAndCrash("Should have VM")
   27.62 +            Log.shared.errorAndCrash("Should have VM")
   27.63              return nil
   27.64          }
   27.65  
   27.66 @@ -537,7 +537,7 @@
   27.67                          title: destructiveAction.title(forDisplayMode: .titleAndImage)) {
   27.68                  [weak self] action, indexPath in
   27.69                  guard let me = self else {
   27.70 -                    Logger.frontendLogger.lostMySelf()
   27.71 +                    Log.shared.errorAndCrash("Lost MySelf")
   27.72                      return
   27.73                  }
   27.74  
   27.75 @@ -553,7 +553,7 @@
   27.76              let flagAction = SwipeAction(style: .default, title: "Flag") {
   27.77                  [weak self] action, indexPath in
   27.78                  guard let me = self else {
   27.79 -                    Logger.frontendLogger.lostMySelf()
   27.80 +                    Log.shared.errorAndCrash("Lost MySelf")
   27.81                      return
   27.82                  }
   27.83                  me.flagAction(forCellAt: indexPath)
   27.84 @@ -573,7 +573,7 @@
   27.85              let moreAction = SwipeAction(style: .default, title: "More") {
   27.86                  [weak self] action, indexPath in
   27.87                  guard let me = self else {
   27.88 -                    Logger.frontendLogger.lostMySelf()
   27.89 +                    Log.shared.errorAndCrash("Lost MySelf")
   27.90                      return
   27.91                  }
   27.92                  me.moreAction(forCellAt: indexPath)
   27.93 @@ -609,7 +609,7 @@
   27.94              }
   27.95          } else {
   27.96              guard let model = model else {
   27.97 -                Logger.frontendLogger.errorAndCrash("No folder")
   27.98 +                Log.shared.errorAndCrash("No folder")
   27.99                  return
  27.100              }
  27.101              lastSelectedIndexPath = indexPath
  27.102 @@ -637,7 +637,7 @@
  27.103      override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell,
  27.104                              forRowAt indexPath: IndexPath) {
  27.105          guard let vm = model else {
  27.106 -            Logger.frontendLogger.errorAndCrash("No model.")
  27.107 +            Log.shared.errorAndCrash("No model.")
  27.108              return
  27.109          }
  27.110          vm.fetchOlderMessagesIfRequired(forIndexPath: indexPath)
  27.111 @@ -683,7 +683,7 @@
  27.112  
  27.113      func didDismissSearchController(_ searchController: UISearchController) {
  27.114          guard let vm = model else {
  27.115 -            Logger.frontendLogger.errorAndCrash("No chance to remove filter, sorry.")
  27.116 +            Log.shared.errorAndCrash("No chance to remove filter, sorry.")
  27.117              return
  27.118          }
  27.119          vm.removeSearch()
  27.120 @@ -719,7 +719,7 @@
  27.121                  storyboard.instantiateViewController(withIdentifier: "threadViewController")
  27.122                      as? ThreadViewController
  27.123                  else {
  27.124 -                    Logger.frontendLogger.errorAndCrash("Segue issue")
  27.125 +                    Log.shared.errorAndCrash("Segue issue")
  27.126                      return
  27.127              }
  27.128  
  27.129 @@ -814,7 +814,7 @@
  27.130      func emailListViewModel(viewModel: EmailListViewModel,
  27.131                              didChangeSeenStateForDataAt indexPaths: [IndexPath]) {
  27.132          guard let isIphone = splitViewController?.isCollapsed, let vm = model else {
  27.133 -            Logger.frontendLogger.errorAndCrash("Invalid state")
  27.134 +            Log.shared.errorAndCrash("Invalid state")
  27.135              return
  27.136          }
  27.137  
  27.138 @@ -882,7 +882,7 @@
  27.139          let title = NSLocalizedString("Move to Folder", comment: "EmailList action title")
  27.140          return UIAlertAction(title: title, style: .default) { [weak self] action in
  27.141              guard let me = self else {
  27.142 -                Logger.frontendLogger.lostMySelf()
  27.143 +                Log.shared.errorAndCrash("Lost MySelf")
  27.144                  return
  27.145              }
  27.146              me.performSegue(withIdentifier: .segueShowMoveToFolder, sender: me)
  27.147 @@ -894,7 +894,7 @@
  27.148          return  UIAlertAction(title: title, style: .cancel) {
  27.149              [weak self] action in
  27.150              guard let me = self else {
  27.151 -                Logger.frontendLogger.lostMySelf()
  27.152 +                Log.shared.errorAndCrash("Lost MySelf")
  27.153                  return
  27.154              }
  27.155              me.tableView.beginUpdates()
  27.156 @@ -908,7 +908,7 @@
  27.157          return UIAlertAction(title: title, style: .default) {
  27.158              [weak self] action in
  27.159              guard let me = self else {
  27.160 -                Logger.frontendLogger.lostMySelf()
  27.161 +                Log.shared.errorAndCrash("Lost MySelf")
  27.162                  return
  27.163              }
  27.164              me.performSegue(withIdentifier: .segueReply, sender: me)
  27.165 @@ -921,7 +921,7 @@
  27.166              return UIAlertAction(title: title, style: .default) {
  27.167                  [weak self] action in
  27.168                  guard let me = self else {
  27.169 -                    Logger.frontendLogger.lostMySelf()
  27.170 +                    Log.shared.errorAndCrash("Lost MySelf")
  27.171                      return
  27.172                  }
  27.173                  me.performSegue(withIdentifier: .segueReplyAll, sender: me)
  27.174 @@ -936,7 +936,7 @@
  27.175          return UIAlertAction(title: title, style: .default) {
  27.176              [weak self] action in
  27.177              guard let me = self else {
  27.178 -                Logger.frontendLogger.lostMySelf()
  27.179 +                Log.shared.errorAndCrash("Lost MySelf")
  27.180                  return
  27.181              }
  27.182              me.performSegue(withIdentifier: .segueForward, sender: me)
  27.183 @@ -960,11 +960,11 @@
  27.184  
  27.185      func flagAction(forCellAt indexPath: IndexPath) {
  27.186          guard let row = model?.viewModel(for: indexPath.row) else {
  27.187 -            Logger.frontendLogger.errorAndCrash("No data for indexPath!")
  27.188 +            Log.shared.errorAndCrash("No data for indexPath!")
  27.189              return
  27.190          }
  27.191          guard let cell = self.tableView.cellForRow(at: indexPath) as? EmailListViewCell else {
  27.192 -            Logger.frontendLogger.errorAndCrash("No cell for indexPath!")
  27.193 +            Log.shared.errorAndCrash("No cell for indexPath!")
  27.194              return
  27.195          }
  27.196          if row.isFlagged {
  27.197 @@ -1034,7 +1034,7 @@
  27.198                  let vc = nav.rootViewController as? EmailViewController,
  27.199                  let indexPath = lastSelectedIndexPath,
  27.200                  let message = model?.message(representedByRowAt: indexPath) else {
  27.201 -                    Logger.frontendLogger.errorAndCrash("Segue issue")
  27.202 +                    Log.shared.errorAndCrash("Segue issue")
  27.203                      return
  27.204              }
  27.205              vc.appConfig = appConfig
  27.206 @@ -1052,7 +1052,7 @@
  27.207                      return
  27.208              }
  27.209              guard let message = model?.message(representedByRowAt: indexPath) else {
  27.210 -                Logger.frontendLogger.errorAndCrash("Segue issue")
  27.211 +                Log.shared.errorAndCrash("Segue issue")
  27.212                  return
  27.213              }
  27.214              vc.appConfig = appConfig
  27.215 @@ -1063,11 +1063,11 @@
  27.216              model?.updateThreadListDelegate = viewModel*/
  27.217          case .segueShowFilter:
  27.218              guard let destiny = segue.destination as? FilterTableViewController  else {
  27.219 -                Logger.frontendLogger.errorAndCrash("Segue issue")
  27.220 +                Log.shared.errorAndCrash("Segue issue")
  27.221                  return
  27.222              }
  27.223              guard let vm = model else {
  27.224 -                Log.shared.errorAndCrash(component: #function, errorString: "No VM")
  27.225 +                Log.shared.errorAndCrash("No VM")
  27.226                  return
  27.227              }
  27.228              destiny.appConfig = appConfig
  27.229 @@ -1078,7 +1078,7 @@
  27.230              guard
  27.231                  let nav = segue.destination as? UINavigationController,
  27.232                  let vc = nav.rootViewController as? LoginViewController else {
  27.233 -                    Logger.frontendLogger.errorAndCrash("Segue issue")
  27.234 +                    Log.shared.errorAndCrash("Segue issue")
  27.235                      return
  27.236              }
  27.237              vc.appConfig = appConfig
  27.238 @@ -1087,7 +1087,7 @@
  27.239              break
  27.240          case .segueFolderViews:
  27.241              guard let vC = segue.destination as? FolderTableViewController  else {
  27.242 -                Logger.frontendLogger.errorAndCrash("Segue issue")
  27.243 +                Log.shared.errorAndCrash("Segue issue")
  27.244                  return
  27.245              }
  27.246              vC.appConfig = appConfig
  27.247 @@ -1106,7 +1106,7 @@
  27.248              guard  let nav = segue.destination as? UINavigationController,
  27.249                  let destination = nav.topViewController as? MoveToAccountViewController
  27.250                  else {
  27.251 -                    Logger.frontendLogger.errorAndCrash("No DVC?")
  27.252 +                    Log.shared.errorAndCrash("No DVC?")
  27.253                      break
  27.254              }
  27.255  
  27.256 @@ -1119,7 +1119,7 @@
  27.257              //No initialization needed
  27.258              break
  27.259          default:
  27.260 -            Logger.frontendLogger.errorAndCrash("Unhandled segue")
  27.261 +            Log.shared.errorAndCrash("Unhandled segue")
  27.262              break
  27.263          }
  27.264      }
  27.265 @@ -1135,7 +1135,7 @@
  27.266              let composeVc = nav.topViewController as? ComposeTableViewController,
  27.267              let composeMode = composeMode(for: segueId),
  27.268              let vm = model else {
  27.269 -                Logger.frontendLogger.errorAndCrash("composeViewController setup issue")
  27.270 +                Log.shared.errorAndCrash("composeViewController setup issue")
  27.271                  return
  27.272          }
  27.273          composeVc.appConfig = appConfig
  27.274 @@ -1144,7 +1144,7 @@
  27.275              // This is not a simple compose (but reply, forward or such),
  27.276              // thus we have to pass the original message.
  27.277              guard let indexPath = lastSelectedIndexPath else {
  27.278 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
  27.279 +                    Log.shared.errorAndCrash("Invalid state")
  27.280                      return
  27.281              }
  27.282  
    28.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Tue May 07 19:18:28 2019 +0200
    28.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Wed May 08 12:01:12 2019 +0200
    28.3 @@ -128,7 +128,7 @@
    28.4          do {
    28.5              try messageQueryResults.startMonitoring()
    28.6          } catch {
    28.7 -            Logger.frontendLogger.errorAndCrash("MessageQueryResult crash")
    28.8 +            Log.shared.errorAndCrash("MessageQueryResult crash")
    28.9          }
   28.10      }
   28.11  
   28.12 @@ -460,7 +460,7 @@
   28.13          do {
   28.14              try messageQueryResults.startMonitoring()
   28.15          } catch {
   28.16 -            Logger.modelLogger.errorAndCrash("Failed to fetch data")
   28.17 +            Log.shared.errorAndCrash("Failed to fetch data")
   28.18              return
   28.19          }
   28.20      }
   28.21 @@ -590,7 +590,7 @@
   28.22  
   28.23      private func folderIsDraft(_ parentFolder: Folder?) -> Bool {
   28.24          guard let folder = parentFolder else {
   28.25 -            Logger.frontendLogger.errorAndCrash("No parent.")
   28.26 +            Log.shared.errorAndCrash("No parent.")
   28.27              return false
   28.28          }
   28.29          return folderIsDraft(folder)
   28.30 @@ -598,7 +598,7 @@
   28.31  
   28.32      private func folderIsOutbox(_ parentFolder: Folder?) -> Bool {
   28.33          guard let folder = parentFolder else {
   28.34 -            Logger.frontendLogger.errorAndCrash("No parent.")
   28.35 +            Log.shared.errorAndCrash("No parent.")
   28.36              return false
   28.37          }
   28.38          return folderIsOutbox(folder)
    29.1 --- a/pEpForiOS/UI/EmailDisplayList/PepPictureComposer.swift	Tue May 07 19:18:28 2019 +0200
    29.2 +++ b/pEpForiOS/UI/EmailDisplayList/PepPictureComposer.swift	Wed May 08 12:01:12 2019 +0200
    29.3 @@ -23,7 +23,7 @@
    29.4          } else {
    29.5              DispatchQueue.global(qos: .userInitiated).async{ [weak self] in
    29.6                  guard let me = self else {
    29.7 -                    Log.shared.errorAndCrash(component: #function, errorString: "Lost myself")
    29.8 +                    Log.shared.errorAndCrash("Lost myself")
    29.9                      return
   29.10                  }
   29.11                  let senderImage = me.contactImageTool.identityImage(for: identityKey)
    30.1 --- a/pEpForiOS/UI/Filter/FilterTableViewController.swift	Tue May 07 19:18:28 2019 +0200
    30.2 +++ b/pEpForiOS/UI/Filter/FilterTableViewController.swift	Wed May 08 12:01:12 2019 +0200
    30.3 @@ -33,7 +33,7 @@
    30.4  
    30.5      @objc func ok(sender: UIBarButtonItem) {
    30.6          guard let vm = viewModel else {
    30.7 -            Log.shared.errorAndCrash(component: #function, errorString: "No VM")
    30.8 +            Log.shared.errorAndCrash("No VM")
    30.9              return
   30.10          }
   30.11          filterDelegate?.filterChanged(newFilter: vm.filter)
   30.12 @@ -42,7 +42,7 @@
   30.13  
   30.14      func initViewModel() {
   30.15          guard let filter = filterEnabled else {
   30.16 -            Log.shared.errorAndCrash(component: #function, errorString: "No Filter in FilterView")
   30.17 +            Log.shared.errorAndCrash("No Filter in FilterView")
   30.18              return
   30.19          }
   30.20          self.viewModel = FilterViewModel(filter: filter)
   30.21 @@ -97,7 +97,7 @@
   30.22      override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
   30.23          //!!!: we have to go to the filter property of the view mode an change directly the value on there. (Buff: why?)
   30.24          guard let vm = viewModel else {
   30.25 -            Log.shared.errorAndCrash(component: #function, errorString: "No VM")
   30.26 +            Log.shared.errorAndCrash("No VM")
   30.27              return
   30.28          }
   30.29          vm.toggleEnabledState(forRowAt: indexPath)
    31.1 --- a/pEpForiOS/UI/Filter/ViewModel/FilterSectionViewModel.swift	Tue May 07 19:18:28 2019 +0200
    31.2 +++ b/pEpForiOS/UI/Filter/ViewModel/FilterSectionViewModel.swift	Wed May 08 12:01:12 2019 +0200
    31.3 @@ -41,7 +41,7 @@
    31.4  //        case .accouts:
    31.5  //            for account in Account.all() {
    31.6  //                guard let icon = UIImage(named: "folders-icon-inbox") else {
    31.7 -//                    Logger.frontendLogger.errorAndCrash("Error Loading images")
    31.8 +//                    Log.shared.errorAndCrash("Error Loading images")
    31.9  //                    return
   31.10  //                }
   31.11  //                items.append(
   31.12 @@ -51,7 +51,7 @@
   31.13  //            break
   31.14  //        case .include:
   31.15  //            guard let unreadIcon = UIImage(named: "icon-unread") else {
   31.16 -//                Logger.frontendLogger.errorAndCrash("Error Loading images")
   31.17 +//                Log.shared.errorAndCrash("Error Loading images")
   31.18  //                return
   31.19  //            }
   31.20  //            items.append(
   31.21 @@ -61,7 +61,7 @@
   31.22  //                                    enabled: filters?.mustBeUnread, type: .Unread))
   31.23  //
   31.24  //            guard let flaggedIcon = UIImage(named: "icon-flagged") else {
   31.25 -//                Logger.frontendLogger.errorAndCrash("Error Loading images")
   31.26 +//                Log.shared.errorAndCrash("Error Loading images")
   31.27  //                return
   31.28  //            }
   31.29  //            items.append(
   31.30 @@ -72,7 +72,7 @@
   31.31  //            break
   31.32  //        case .other:
   31.33  //            guard let attachIcon = UIImage(named: "attachment-list-icon") else {
   31.34 -//                Logger.frontendLogger.errorAndCrash("Error Loading images")
   31.35 +//                Log.shared.errorAndCrash("Error Loading images")
   31.36  //                return
   31.37  //            }
   31.38  //            items.append(
    32.1 --- a/pEpForiOS/UI/Filter/ViewModel/FilterViewModel.swift	Tue May 07 19:18:28 2019 +0200
    32.2 +++ b/pEpForiOS/UI/Filter/ViewModel/FilterViewModel.swift	Wed May 08 12:01:12 2019 +0200
    32.3 @@ -48,7 +48,7 @@
    32.4                  return
    32.5              }
    32.6              guard let account = filter.account(at: indexPath.row) else {
    32.7 -                Log.shared.errorAndCrash(component: #function, errorString: "No Account for row")
    32.8 +                Log.shared.errorAndCrash("No Account for row")
    32.9                  return
   32.10              }
   32.11              accountsEnabledStates[indexPath.row] = [account: newState]
   32.12 @@ -101,7 +101,7 @@
   32.13              let rows: [Row] = filter.accountsEnabledStates.compactMap {
   32.14                  let rowType = RowType.account
   32.15                  guard let accountEnabledState = $0.first else {
   32.16 -                    Log.shared.errorAndCrash(component: #function, errorString: "No Account state")
   32.17 +                    Log.shared.errorAndCrash("No Account state")
   32.18                      return nil
   32.19                  }
   32.20                  return createRow(type: rowType , account: accountEnabledState.key,
   32.21 @@ -149,7 +149,7 @@
   32.22          switch type {
   32.23          case .account:
   32.24              guard let accountAddress = account?.user.address else {
   32.25 -                Logger.frontendLogger.errorAndCrash("Error generating row")
   32.26 +                Log.shared.errorAndCrash("Error generating row")
   32.27                  //!!!: it is posible to get in there?
   32.28                  return ""
   32.29              }
    33.1 --- a/pEpForiOS/UI/Folder/FolderTableViewController.swift	Tue May 07 19:18:28 2019 +0200
    33.2 +++ b/pEpForiOS/UI/Folder/FolderTableViewController.swift	Wed May 08 12:01:12 2019 +0200
    33.3 @@ -34,7 +34,7 @@
    33.4      private func setup() {
    33.5          DispatchQueue.main.async { [weak self] in
    33.6              guard let me = self else {
    33.7 -                Log.shared.errorAndCrash(component: #function, errorString: "Lost myself")
    33.8 +                Log.shared.errorAndCrash("Lost myself")
    33.9                  return
   33.10              }
   33.11              me.folderVM =  FolderViewModel()
   33.12 @@ -112,7 +112,7 @@
   33.13              header = CollapsibleTableViewHeader(reuseIdentifier: "header")
   33.14          }
   33.15          guard let vm = folderVM, let safeHeader = header else {
   33.16 -            Logger.frontendLogger.errorAndCrash("No header or no model.")
   33.17 +            Log.shared.errorAndCrash("No header or no model.")
   33.18              return header
   33.19          }
   33.20  
   33.21 @@ -131,7 +131,7 @@
   33.22      }
   33.23      override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
   33.24          guard let vm = folderVM else {
   33.25 -            Logger.frontendLogger.errorAndCrash("No model.")
   33.26 +            Log.shared.errorAndCrash("No model.")
   33.27              return 0.0
   33.28          }
   33.29          if vm[section].hidden {
   33.30 @@ -145,7 +145,7 @@
   33.31                              cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   33.32          let cell = tableView.dequeueReusableCell(withIdentifier: "Default", for: indexPath)
   33.33          guard let vm = folderVM else {
   33.34 -            Logger.frontendLogger.errorAndCrash("No model")
   33.35 +            Log.shared.errorAndCrash("No model")
   33.36              return cell
   33.37          }
   33.38          let fcvm = vm[indexPath.section][indexPath.item]
   33.39 @@ -164,7 +164,7 @@
   33.40      override func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath)
   33.41          -> Int {
   33.42              guard let vm = folderVM else {
   33.43 -                Logger.frontendLogger.errorAndCrash("No model")
   33.44 +                Log.shared.errorAndCrash("No model")
   33.45                  return 0
   33.46              }
   33.47          return vm[indexPath.section][indexPath.item].level - 1
   33.48 @@ -174,7 +174,7 @@
   33.49  
   33.50      override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
   33.51          guard let folderViewModel = folderVM else {
   33.52 -            Logger.frontendLogger.errorAndCrash("No model")
   33.53 +            Log.shared.errorAndCrash("No model")
   33.54              return
   33.55          }
   33.56          let cellViewModel = folderViewModel[indexPath.section][indexPath.row]
   33.57 @@ -193,7 +193,7 @@
   33.58              let vc = sb.instantiateViewController(
   33.59                  withIdentifier: EmailListViewController.storyboardId)
   33.60                  as? EmailListViewController else {
   33.61 -                    Logger.frontendLogger.errorAndCrash("Problem!")
   33.62 +                    Log.shared.errorAndCrash("Problem!")
   33.63                      return
   33.64          }
   33.65          vc.appConfig = appConfig
   33.66 @@ -215,7 +215,7 @@
   33.67              guard
   33.68                  let nav = segue.destination as? UINavigationController,
   33.69                  let vc = nav.rootViewController as? LoginViewController else {
   33.70 -                    Logger.frontendLogger.errorAndCrash("Missing VCs")
   33.71 +                    Log.shared.errorAndCrash("Missing VCs")
   33.72                      return
   33.73              }
   33.74              vc.appConfig = self.appConfig
   33.75 @@ -224,7 +224,7 @@
   33.76  
   33.77          } else if segue.identifier == "SettingsSegue" {
   33.78              guard let dvc = segue.destination as? SettingsTableViewController else {
   33.79 -                Logger.frontendLogger.errorAndCrash("Error casting DVC")
   33.80 +                Log.shared.errorAndCrash("Error casting DVC")
   33.81                  return
   33.82              }
   33.83              dvc.appConfig = self.appConfig
    34.1 --- a/pEpForiOS/UI/Folder/ViewModel/FolderSectionViewModel.swift	Tue May 07 19:18:28 2019 +0200
    34.2 +++ b/pEpForiOS/UI/Folder/ViewModel/FolderSectionViewModel.swift	Wed May 08 12:01:12 2019 +0200
    34.3 @@ -34,7 +34,7 @@
    34.4  
    34.5      private func generateAccountCells() {
    34.6          guard let ac = account else {
    34.7 -            Logger.frontendLogger.errorAndCrash("No account selected")
    34.8 +            Log.shared.errorAndCrash("No account selected")
    34.9              return
   34.10          }
   34.11          for folder in ac.rootFolders {
   34.12 @@ -52,7 +52,7 @@
   34.13  
   34.14      func getImage(callback: @escaping (UIImage?)-> Void) {
   34.15          guard let ac = account else {
   34.16 -            Logger.frontendLogger.errorAndCrash("No account selected")
   34.17 +            Log.shared.errorAndCrash("No account selected")
   34.18              return
   34.19          }
   34.20          let userKey = IdentityImageTool.IdentityKey(identity: ac.user)
    35.1 --- a/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Tue May 07 19:18:28 2019 +0200
    35.2 +++ b/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Wed May 08 12:01:12 2019 +0200
    35.3 @@ -270,7 +270,7 @@
    35.4          do {
    35.5              languages = try theSession.languageList()
    35.6          } catch let err as NSError {
    35.7 -            Logger.frontendLogger.error("%{public}@", err.localizedDescription)
    35.8 +            Log.shared.error("%{public}@", err.localizedDescription)
    35.9              languages = []
   35.10          }
   35.11  
   35.12 @@ -323,7 +323,7 @@
   35.13          do {
   35.14              destination.languages = try theSession.languageList()
   35.15          } catch let err as NSError {
   35.16 -            Logger.frontendLogger.error("%{public}@", err.localizedDescription)
   35.17 +            Log.shared.error("%{public}@", err.localizedDescription)
   35.18              destination.languages = []
   35.19          }
   35.20      }
    36.1 --- a/pEpForiOS/UI/Handshake/ViewModel/HandshakePartnerTableViewCellViewModel.swift	Tue May 07 19:18:28 2019 +0200
    36.2 +++ b/pEpForiOS/UI/Handshake/ViewModel/HandshakePartnerTableViewCellViewModel.swift	Wed May 08 12:01:12 2019 +0200
    36.3 @@ -108,7 +108,7 @@
    36.4          do {
    36.5              isPartnerpEpUser = try session.isPEPUser(pEpPartner).boolValue
    36.6          } catch let err as NSError {
    36.7 -            Logger.frontendLogger.error("%{public}@", err.localizedDescription)
    36.8 +            Log.shared.error("%{public}@", err.localizedDescription)
    36.9              isPartnerpEpUser = false
   36.10          }
   36.11          setPartnerImage(for: partner)
   36.12 @@ -122,7 +122,7 @@
   36.13          } else {
   36.14              DispatchQueue.global().async { [weak self] in
   36.15                  guard let me = self else {
   36.16 -                    Log.shared.errorAndCrash(component: #function, errorString: "Lost myself")
   36.17 +                    Log.shared.errorAndCrash("Lost myself")
   36.18                      return
   36.19                  }
   36.20                  let contactImage = me.contactImageTool.identityImage(for: IdentityImageTool.IdentityKey(identity: partnerIdentity))
   36.21 @@ -153,7 +153,7 @@
   36.22                  language: trustwordsLanguage,
   36.23                  full: trustwordsFull)
   36.24          } catch let err as NSError {
   36.25 -            Logger.frontendLogger.error("%{public}@", err.localizedDescription)
   36.26 +            Log.shared.error("%{public}@", err.localizedDescription)
   36.27              return nil
   36.28          }
   36.29      }
    37.1 --- a/pEpForiOS/UI/Login/LoginViewController.swift	Tue May 07 19:18:28 2019 +0200
    37.2 +++ b/pEpForiOS/UI/Login/LoginViewController.swift	Wed May 08 12:01:12 2019 +0200
    37.3 @@ -162,7 +162,7 @@
    37.4      }
    37.5  
    37.6      private func handleLoginError(error: Error, offerManualSetup: Bool) {
    37.7 -        Logger.frontendLogger.error("%{public}@", error.localizedDescription)
    37.8 +        Log.shared.error("%{public}@", error.localizedDescription)
    37.9          self.isCurrentlyVerifying = false
   37.10          guard let error = DisplayUserError(withError: error) else {
   37.11              // Do nothing. The error type is not suitable to bother the user with.
   37.12 @@ -313,7 +313,7 @@
   37.13                     accountInput: VerifiableAccountProtocol?) {
   37.14          GCD.onMain() { [weak self] in
   37.15              guard let me = self else {
   37.16 -                Logger.frontendLogger.lostMySelf()
   37.17 +                Log.shared.errorAndCrash("Lost MySelf")
   37.18                  return
   37.19              }
   37.20              me.lastAccountInput = nil
    38.1 --- a/pEpForiOS/UI/Login/ViewModel/LoginViewModel.swift	Tue May 07 19:18:28 2019 +0200
    38.2 +++ b/pEpForiOS/UI/Login/ViewModel/LoginViewModel.swift	Wed May 08 12:01:12 2019 +0200
    38.3 @@ -101,7 +101,7 @@
    38.4  
    38.5          func statusOk() {
    38.6              if let error = AccountSettings.AccountSettingsError(accountSettings: acSettings) {
    38.7 -                Logger.frontendLogger.error("%{public}@", error.localizedDescription)
    38.8 +                Log.shared.error("%{public}@", error.localizedDescription)
    38.9                  loginViewModelLoginErrorDelegate?.handle(loginError: error)
   38.10                  return
   38.11              }
   38.12 @@ -157,7 +157,7 @@
   38.13  
   38.14      func accountHasBeenQualified(trusted: Bool) {
   38.15          guard var theVerificationService = verificationService else {
   38.16 -            Logger.frontendLogger.errorAndCrash("no VerificationService")
   38.17 +            Log.shared.errorAndCrash("no VerificationService")
   38.18              return
   38.19          }
   38.20  
   38.21 @@ -165,7 +165,7 @@
   38.22          do {
   38.23              try theVerificationService.verify()
   38.24          } catch {
   38.25 -            Logger.frontendLogger.error("%{public}@", error.localizedDescription)
   38.26 +            Log.shared.error("%{public}@", error.localizedDescription)
   38.27              loginViewModelLoginErrorDelegate?.handle(loginError: error)
   38.28          }
   38.29      }
   38.30 @@ -223,10 +223,10 @@
   38.31  extension LoginViewModel: VerifiableAccountDelegate {
   38.32      func informAccountVerificationResultDelegate(error: Error?) {
   38.33          guard let theService = verificationService else {
   38.34 -            Logger.frontendLogger.error(
   38.35 +            Log.shared.error(
   38.36                  "Lost the verificationService, was about to inform the delegate")
   38.37              if let err = error {
   38.38 -                Logger.frontendLogger.log(error: err)
   38.39 +                Log.shared.log("%@", err.localizedDescription)
   38.40              }
   38.41              return
   38.42          }
   38.43 @@ -238,9 +238,7 @@
   38.44                  result: .smtpError(smtpError), accountInput: theService)
   38.45          } else {
   38.46              if let theError = error {
   38.47 -                Logger.frontendLogger.log(error: theError)
   38.48 -                Logger.frontendLogger.errorAndCrash("Unexpected error")
   38.49 -
   38.50 +                Log.shared.errorAndCrash("%@", theError.localizedDescription)
   38.51              } else {
   38.52                  accountVerificationResultDelegate?.didVerify(result: .ok, accountInput: theService)
   38.53              }
   38.54 @@ -255,8 +253,7 @@
   38.55                  informAccountVerificationResultDelegate(error: nil)
   38.56                  mySelfer?.startMySelf()
   38.57              } catch {
   38.58 -                Logger.frontendLogger.log(error: error)
   38.59 -                Logger.frontendLogger.errorAndCrash("Unexpected error on saving the account")
   38.60 +                Log.shared.errorAndCrash("%@", error.localizedDescription)
   38.61              }
   38.62          case .failure(let error):
   38.63              informAccountVerificationResultDelegate(error: error)
    39.1 --- a/pEpForiOS/UI/ManualLogin/SMTPSetup/SMTPSettingsTableViewController.swift	Tue May 07 19:18:28 2019 +0200
    39.2 +++ b/pEpForiOS/UI/ManualLogin/SMTPSetup/SMTPSettingsTableViewController.swift	Wed May 08 12:01:12 2019 +0200
    39.3 @@ -151,6 +151,34 @@
    39.4      }
    39.5  }
    39.6  
    39.7 +// MARK: - AccountVerificationServiceDelegate
    39.8 +
    39.9 +extension SMTPSettingsTableViewController: AccountVerificationServiceDelegate {
   39.10 +    func verified(account: Account, service: AccountVerificationServiceProtocol,
   39.11 +                  result: AccountVerificationResult) {
   39.12 +        if result == .ok {
   39.13 +            MessageModelUtil.performAndWait {
   39.14 +                account.save()
   39.15 +            }
   39.16 +        }
   39.17 +        GCD.onMain() {
   39.18 +            self.isCurrentlyVerifying =  false
   39.19 +            switch result {
   39.20 +            case .ok:
   39.21 +                // unwind back to INBOX or folder list on success
   39.22 +                self.performSegue(withIdentifier: .backToEmailListSegue, sender: self)
   39.23 +            case .imapError(let err):
   39.24 +                UIUtils.show(error: err, inViewController: self)
   39.25 +            case .smtpError(let err):
   39.26 +                UIUtils.show(error: err, inViewController: self)
   39.27 +            case .noImapConnectData, .noSmtpConnectData:
   39.28 +                let error = LoginViewController.LoginError.noConnectData
   39.29 +                UIUtils.show(error: error, inViewController: self)
   39.30 +            }
   39.31 +        }
   39.32 +    }
   39.33 +}
   39.34 +
   39.35  // MARK: - SegueHandlerType
   39.36  
   39.37  extension SMTPSettingsTableViewController: SegueHandlerType {
   39.38 @@ -191,9 +219,7 @@
   39.39                      do {
   39.40                          try self?.model.save()
   39.41                      } catch {
   39.42 -                        Logger.frontendLogger.log(error: error)
   39.43 -                        Logger.frontendLogger.errorAndCrash(
   39.44 -                            "Unexpected error on saving the account")
   39.45 +                        Log.shared.errorAndCrash("%@", error.localizedDescription)
   39.46                      }
   39.47                  }
   39.48                  GCD.onMain() {
    40.1 --- a/pEpForiOS/UI/MoveToFolder/ViewModel/MoveToFolderViewModel.swift	Tue May 07 19:18:28 2019 +0200
    40.2 +++ b/pEpForiOS/UI/MoveToFolder/ViewModel/MoveToFolderViewModel.swift	Wed May 08 12:01:12 2019 +0200
    40.3 @@ -87,7 +87,7 @@
    40.4  
    40.5      func moveMessagesTo(index: Int) -> Bool {
    40.6          if !(index >= 0 && index < items.count) {
    40.7 -            Logger.frontendLogger.error("Index out of bounds")
    40.8 +            Log.shared.error("Index out of bounds")
    40.9              return false
   40.10          }
   40.11          let targetFolder = items[index].folder
    41.1 --- a/pEpForiOS/UI/Settings/Setting/AccountSettings/AccountSettingsTableViewController.swift	Tue May 07 19:18:28 2019 +0200
    41.2 +++ b/pEpForiOS/UI/Settings/Setting/AccountSettings/AccountSettingsTableViewController.swift	Wed May 08 12:01:12 2019 +0200
    41.3 @@ -297,7 +297,7 @@
    41.4  
    41.5  extension AccountSettingsTableViewController {
    41.6      public func handleLoginError(error: Error) {
    41.7 -        Logger.frontendLogger.error("%{public}@", error.localizedDescription)
    41.8 +        Log.shared.error("%{public}@", error.localizedDescription)
    41.9          UIUtils.show(error: error, inViewController: self)
   41.10      }
   41.11  }
    42.1 --- a/pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift	Tue May 07 19:18:28 2019 +0200
    42.2 +++ b/pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift	Wed May 08 12:01:12 2019 +0200
    42.3 @@ -160,7 +160,7 @@
    42.4              let address = viewModel.address,
    42.5              let transport = Server.Transport(fromString: viewModel.transport)
    42.6              else {
    42.7 -                Logger.frontendLogger.errorAndCrash("viewModel misses required data.")
    42.8 +                Log.shared.errorAndCrash("viewModel misses required data.")
    42.9                  return nil
   42.10          }
   42.11  
   42.12 @@ -202,7 +202,7 @@
   42.13          }
   42.14          GCD.onMainWait { [weak self] in
   42.15              guard let me = self else {
   42.16 -                Logger.frontendLogger.lostMySelf()
   42.17 +                Log.shared.errorAndCrash("Lost MySelf")
   42.18                  return
   42.19              }
   42.20              me.delegate?.didVerify(result: result, accountInput: nil)
   42.21 @@ -219,8 +219,7 @@
   42.22              do {
   42.23                  try verifiableAccount?.save()
   42.24              } catch {
   42.25 -                Logger.frontendLogger.log(error: error)
   42.26 -                Logger.frontendLogger.errorAndCrash("Unexpected error on saving the account")
   42.27 +                Log.shared.errorAndCrash("%@", error.localizedDescription)
   42.28              }
   42.29          case .failure(let error):
   42.30              if let imapError = error as? ImapSyncError {
   42.31 @@ -230,8 +229,7 @@
   42.32                  delegate?.didVerify(
   42.33                      result: .smtpError(smtpError), accountInput: verifiableAccount)
   42.34              } else {
   42.35 -                Logger.frontendLogger.log(error: error)
   42.36 -                Logger.frontendLogger.errorAndCrash("Unexpected error")
   42.37 +                Log.shared.errorAndCrash("%@", error.localizedDescription)
   42.38              }
   42.39          }
   42.40      }
    43.1 --- a/pEpForiOS/UI/Settings/Setting/LogViewController.swift	Tue May 07 19:18:28 2019 +0200
    43.2 +++ b/pEpForiOS/UI/Settings/Setting/LogViewController.swift	Wed May 08 12:01:12 2019 +0200
    43.3 @@ -16,37 +16,37 @@
    43.4      @IBOutlet weak var switchLabel: UILabel!
    43.5      @IBOutlet weak var enableLogSwitch: UISwitch!
    43.6  
    43.7 -    override func viewWillAppear(_ animated: Bool) {
    43.8 -        super.viewWillAppear(animated)
    43.9 -        Log.checkEnabled() { enabled in
   43.10 -            GCD.onMain {
   43.11 -                self.enableLogSwitch.isOn = enabled
   43.12 -                if self.enableLogSwitch.isOn {
   43.13 -                    let version = (InfoPlist.versionDisplayString() ?? "") + "\n"
   43.14 -                    Log.checklog() { logString in
   43.15 -                        GCD.onMain {
   43.16 -                            self.logTextView.text = version + (logString ?? "")
   43.17 -                        }
   43.18 -                    }
   43.19 -                }
   43.20 -            }
   43.21 -        }
   43.22 -    }
   43.23 +//    override func viewWillAppear(_ animated: Bool) {
   43.24 +//        super.viewWillAppear(animated)
   43.25 +//        Log.checkEnabled() { enabled in
   43.26 +//            GCD.onMain {
   43.27 +//                self.enableLogSwitch.isOn = enabled
   43.28 +//                if self.enableLogSwitch.isOn {
   43.29 +//                    let version = (InfoPlist.versionDisplayString() ?? "") + "\n"
   43.30 +//                    Log.checklog() { logString in
   43.31 +//                        GCD.onMain {
   43.32 +//                            self.logTextView.text = version + (logString ?? "")
   43.33 +//                        }
   43.34 +//                    }
   43.35 +//                }
   43.36 +//            }
   43.37 +//        }
   43.38 +//    }
   43.39  
   43.40      @IBAction func copyAction(_ sender: Any) {
   43.41 -        Log.checklog() { logString in
   43.42 -            GCD.onMain {
   43.43 -                UIPasteboard.general.string = logString
   43.44 -            }
   43.45 -        }
   43.46 +//        Log.checklog() { logString in
   43.47 +//            GCD.onMain {
   43.48 +//                UIPasteboard.general.string = logString
   43.49 +//            }
   43.50 +//        }
   43.51      }
   43.52  
   43.53      @IBAction func enableAction(_ sender: Any) {
   43.54 -        if enableLogSwitch.isOn {
   43.55 -            Log.enableLog()
   43.56 -        } else {
   43.57 -            Log.disableLog()
   43.58 -        }
   43.59 +//        if enableLogSwitch.isOn {
   43.60 +//            Log.enableLog()
   43.61 +//        } else {
   43.62 +//            Log.disableLog()
   43.63 +//        }
   43.64      }
   43.65  }
   43.66  
    44.1 --- a/pEpForiOS/UI/Settings/Setting/TrustedServerSetting/TrustedServerSettingsViewController.swift	Tue May 07 19:18:28 2019 +0200
    44.2 +++ b/pEpForiOS/UI/Settings/Setting/TrustedServerSetting/TrustedServerSettingsViewController.swift	Wed May 08 12:01:12 2019 +0200
    44.3 @@ -58,7 +58,7 @@
    44.4      func trustedServerSettingCell(sender: TrustedServerSettingCell,
    44.5                                    didChangeSwitchValue newValue: Bool) {
    44.6          guard let address = sender.address.text else {
    44.7 -            Logger.frontendLogger.errorAndCrash("No address.")
    44.8 +            Log.shared.errorAndCrash("No address.")
    44.9              return
   44.10          }
   44.11          viewModel.setStoreSecurely(forAccountWith: address , toValue: newValue)
    45.1 --- a/pEpForiOS/UI/Settings/Setting/TrustedServerSetting/TrustedServerSettingsViewModel.swift	Tue May 07 19:18:28 2019 +0200
    45.2 +++ b/pEpForiOS/UI/Settings/Setting/TrustedServerSetting/TrustedServerSettingsViewModel.swift	Wed May 08 12:01:12 2019 +0200
    45.3 @@ -24,7 +24,7 @@
    45.4  
    45.5      mutating func setStoreSecurely(forAccountWith address: String, toValue newValue: Bool) {
    45.6          guard serversAllowedToManuallyTrust().contains(address) else {
    45.7 -            Logger.frontendLogger.errorAndCrash("Address should be allowed")
    45.8 +            Log.shared.errorAndCrash("Address should be allowed")
    45.9              return
   45.10          }
   45.11  
    46.1 --- a/pEpForiOS/UI/Settings/SettingsTableViewController.swift	Tue May 07 19:18:28 2019 +0200
    46.2 +++ b/pEpForiOS/UI/Settings/SettingsTableViewController.swift	Wed May 08 12:01:12 2019 +0200
    46.3 @@ -105,7 +105,7 @@
    46.4              guard
    46.5                  let vm = viewModel[indexPath.section][indexPath.row] as? SettingsCellViewModel,
    46.6                  let cell = dequeuedCell as? SwipeTableViewCell else {
    46.7 -                    Logger.frontendLogger.errorAndCrash("Invalid state.")
    46.8 +                    Log.shared.errorAndCrash("Invalid state.")
    46.9                      return dequeuedCell
   46.10              }
   46.11              cell.textLabel?.text = vm.title
    47.1 --- a/pEpForiOS/UI/Settings/ViewModel/SettingsCellViewModel.swift	Tue May 07 19:18:28 2019 +0200
    47.2 +++ b/pEpForiOS/UI/Settings/ViewModel/SettingsCellViewModel.swift	Wed May 08 12:01:12 2019 +0200
    47.3 @@ -63,7 +63,7 @@
    47.4                      "Settings: Cell (button) title to view default account setting")
    47.5              case .account:
    47.6                  guard let acc = account else {
    47.7 -                    Logger.frontendLogger.errorAndCrash("Should never be reached")
    47.8 +                    Log.shared.errorAndCrash("Should never be reached")
    47.9                      return nil
   47.10                  }
   47.11                  return acc.user.address
    48.1 --- a/pEpForiOS/UI/SplitView/PrimarySplitViewcontroller+ScreenComposerProtocol.swift	Tue May 07 19:18:28 2019 +0200
    48.2 +++ b/pEpForiOS/UI/SplitView/PrimarySplitViewcontroller+ScreenComposerProtocol.swift	Wed May 08 12:01:12 2019 +0200
    48.3 @@ -28,7 +28,7 @@
    48.4  //            storyboard.instantiateViewController(withIdentifier: "threadViewController")
    48.5  //                as? ThreadViewController
    48.6  //            else {
    48.7 -//                Logger.frontendLogger.errorAndCrash("Segue issue")
    48.8 +//                Log.shared.errorAndCrash("Segue issue")
    48.9  //                return
   48.10  //        }
   48.11  //        vc.appConfig = singleViewController.appConfig
   48.12 @@ -57,7 +57,7 @@
   48.13  //        //!!!:, let index = emailListViewModel.index(of: message)
   48.14  //
   48.15  //            else {
   48.16 -//                Logger.frontendLogger.errorAndCrash("Segue issues")
   48.17 +//                Log.shared.errorAndCrash("Segue issues")
   48.18  //                return
   48.19  //        }
   48.20  //
    49.1 --- a/pEpForiOS/UI/Thread/Cells/FullMessageCell.swift	Tue May 07 19:18:28 2019 +0200
    49.2 +++ b/pEpForiOS/UI/Thread/Cells/FullMessageCell.swift	Wed May 08 12:01:12 2019 +0200
    49.3 @@ -119,7 +119,7 @@
    49.4              storyboard.instantiateViewController(withIdentifier: SecureWebViewController.storyboardId)
    49.5                  as? SecureWebViewController
    49.6              else {
    49.7 -                Logger.frontendLogger.errorAndCrash("Cast error")
    49.8 +                Log.shared.errorAndCrash("Cast error")
    49.9                  return SecureWebViewController()
   49.10          }
   49.11          vc.zoomingEnabled = false
    50.1 --- a/pEpForiOS/UI/Thread/ThreadViewController+SegueHandlerType.swift	Tue May 07 19:18:28 2019 +0200
    50.2 +++ b/pEpForiOS/UI/Thread/ThreadViewController+SegueHandlerType.swift	Wed May 08 12:01:12 2019 +0200
    50.3 @@ -30,7 +30,7 @@
    50.4  //                let appConfig = self.appConfig,
    50.5  //                let indexPath = tableView.indexPathForSelectedRow,
    50.6  //                let message = model?.message(at: indexPath.section) else {
    50.7 -//                    Logger.frontendLogger.errorAndCrash("Segue issue")
    50.8 +//                    Log.shared.errorAndCrash("Segue issue")
    50.9  //                    return
   50.10  //            }
   50.11  //            vc.appConfig = appConfig
   50.12 @@ -43,7 +43,7 @@
   50.13  //        case .segueShowMoveToFolder:
   50.14  //            guard  let nav = segue.destination as? UINavigationController,
   50.15  //                let destination = nav.topViewController as? MoveToAccountViewController else {
   50.16 -//                    Logger.frontendLogger.errorAndCrash("No DVC?")
   50.17 +//                    Log.shared.errorAndCrash("No DVC?")
   50.18  //                    break
   50.19  //            }
   50.20  //            destination.appConfig = appConfig
   50.21 @@ -56,7 +56,7 @@
   50.22  //            guard  let nav = segue.destination as? UINavigationController,
   50.23  //                let destination = nav.topViewController as? ComposeTableViewController,
   50.24  //                let appConfig = appConfig else {
   50.25 -//                    Logger.frontendLogger.errorAndCrash("No DVC?")
   50.26 +//                    Log.shared.errorAndCrash("No DVC?")
   50.27  //                    break
   50.28  //            }
   50.29  //            destination.appConfig = appConfig
    51.1 --- a/pEpForiOS/UI/Thread/ThreadViewController.swift	Tue May 07 19:18:28 2019 +0200
    51.2 +++ b/pEpForiOS/UI/Thread/ThreadViewController.swift	Wed May 08 12:01:12 2019 +0200
    51.3 @@ -67,7 +67,7 @@
    51.4  //
    51.5  //    func isSplitViewControllerCollapsed() -> Bool! {
    51.6  //        guard let splitViewController = self.splitViewController else {
    51.7 -//            Logger.frontendLogger.errorAndCrash("We need a splitViewController here")
    51.8 +//            Log.shared.errorAndCrash("We need a splitViewController here")
    51.9  //            return nil
   51.10  //        }
   51.11  //        return splitViewController.isCollapsed
    52.1 --- a/pEpForiOS/UI/Util/AddToContactsViewController/AddToContactsViewController.swift	Tue May 07 19:18:28 2019 +0200
    52.2 +++ b/pEpForiOS/UI/Util/AddToContactsViewController/AddToContactsViewController.swift	Wed May 08 12:01:12 2019 +0200
    52.3 @@ -26,7 +26,7 @@
    52.4  
    52.5      func setupContactVc() {
    52.6          guard let address = emailAddress else {
    52.7 -            Logger.frontendLogger.errorAndCrash("No data to add?")
    52.8 +            Log.shared.errorAndCrash("No data to add?")
    52.9              dismiss(animated: false)
   52.10              return
   52.11          }
   52.12 @@ -35,7 +35,7 @@
   52.13                                                          value: address as NSString))
   52.14          contactVC = CNContactViewController(forUnknownContact: newContact)
   52.15          guard let contactVC = contactVC else {
   52.16 -            Logger.frontendLogger.errorAndCrash("Missing contactVC")
   52.17 +            Log.shared.errorAndCrash("Missing contactVC")
   52.18              return
   52.19          }
   52.20          contactVC.contactStore = CNContactStore()
    53.1 --- a/pEpForiOS/UI/Util/BaseTableViewController.swift	Tue May 07 19:18:28 2019 +0200
    53.2 +++ b/pEpForiOS/UI/Util/BaseTableViewController.swift	Wed May 08 12:01:12 2019 +0200
    53.3 @@ -17,7 +17,7 @@
    53.4      var appConfig: AppConfig {
    53.5          get {
    53.6              guard let safeConfig = _appConfig else {
    53.7 -                Logger.frontendLogger.errorAndCrash("No appConfig?")
    53.8 +                Log.shared.errorAndCrash("No appConfig?")
    53.9  
   53.10                  // We have no config. Return nonsense.
   53.11                  return AppConfig(
   53.12 @@ -41,7 +41,7 @@
   53.13          super.viewWillAppear(animated)
   53.14          guard _appConfig != nil else {
   53.15              if !MiscUtil.isUnitTest() {
   53.16 -                Logger.frontendLogger.errorAndCrash("AppConfig is nil in viewWillAppear!")
   53.17 +                Log.shared.errorAndCrash("AppConfig is nil in viewWillAppear!")
   53.18              }
   53.19              return
   53.20          }
   53.21 @@ -129,6 +129,6 @@
   53.22  
   53.23  extension BaseTableViewController: KickOffMySelfProtocol {
   53.24      func startMySelf() {
   53.25 -        Logger.frontendLogger.errorAndCrash("No appConfig?")
   53.26 +        Log.shared.errorAndCrash("No appConfig?")
   53.27      }
   53.28  }
    54.1 --- a/pEpForiOS/UI/Util/BaseViewController.swift	Tue May 07 19:18:28 2019 +0200
    54.2 +++ b/pEpForiOS/UI/Util/BaseViewController.swift	Wed May 08 12:01:12 2019 +0200
    54.3 @@ -16,7 +16,7 @@
    54.4      var appConfig: AppConfig! {
    54.5          get {
    54.6              guard _appConfig != nil else {
    54.7 -                Logger.frontendLogger.errorAndCrash("No appConfig?")
    54.8 +                Log.shared.errorAndCrash("No appConfig?")
    54.9                  return nil
   54.10              }
   54.11              return _appConfig
    55.1 --- a/pEpForiOS/UI/Util/Extensions/UIView+Autolayout.swift	Tue May 07 19:18:28 2019 +0200
    55.2 +++ b/pEpForiOS/UI/Util/Extensions/UIView+Autolayout.swift	Wed May 08 12:01:12 2019 +0200
    55.3 @@ -13,7 +13,7 @@
    55.4      /// Sets up constraints to always stay the same size as the superview.
    55.5      public func fullSizeInSuperView() {
    55.6          guard let superview = self.superview else {
    55.7 -            Logger.frontendLogger.errorAndCrash("No superview")
    55.8 +            Log.shared.errorAndCrash("No superview")
    55.9              return
   55.10          }
   55.11  
    56.1 --- a/pEpForiOS/UI/Util/InfoPlist.swift	Tue May 07 19:18:28 2019 +0200
    56.2 +++ b/pEpForiOS/UI/Util/InfoPlist.swift	Wed May 08 12:01:12 2019 +0200
    56.3 @@ -30,7 +30,7 @@
    56.4      
    56.5      static private func mainBundleInfoDictValue(forKey key: String) -> Any? {
    56.6          guard let infoDict = infoDictMainBundle else {
    56.7 -            Logger.utilLogger.errorAndCrash("No info dict")
    56.8 +            Log.shared.errorAndCrash("No info dict")
    56.9              return nil
   56.10          }
   56.11          return infoDict[key]
    57.1 --- a/pEpForiOS/UI/Util/SecureWebViewController/CidHandler.swift	Tue May 07 19:18:28 2019 +0200
    57.2 +++ b/pEpForiOS/UI/Util/SecureWebViewController/CidHandler.swift	Wed May 08 12:01:12 2019 +0200
    57.3 @@ -36,7 +36,7 @@
    57.4              urlSchemeTask.didFinish()
    57.5          }
    57.6          guard let url = urlSchemeTask.request.url else {
    57.7 -            Logger.frontendLogger.errorAndCrash("No URL?")
    57.8 +            Log.shared.errorAndCrash("No URL?")
    57.9              return
   57.10          }
   57.11  
    58.1 --- a/pEpForiOS/UI/Util/SecureWebViewController/SecureWebViewController.swift	Tue May 07 19:18:28 2019 +0200
    58.2 +++ b/pEpForiOS/UI/Util/SecureWebViewController/SecureWebViewController.swift	Wed May 08 12:01:12 2019 +0200
    58.3 @@ -168,13 +168,13 @@
    58.4                  forIdentifier: "pep.security.SecureWebViewController.block_all_external_content",
    58.5                  encodedContentRuleList: blockRules) { (contentRuleList, error) in
    58.6                      if let error = error {
    58.7 -                        Logger.frontendLogger.errorAndCrash(
    58.8 +                        Log.shared.errorAndCrash(
    58.9                              "Compile error: %@", error.localizedDescription)
   58.10                          return
   58.11                      }
   58.12                      compiledBlockList = contentRuleList
   58.13                      guard let _ = compiledBlockList else {
   58.14 -                        Logger.frontendLogger.errorAndCrash(
   58.15 +                        Log.shared.errorAndCrash(
   58.16                              "Emergency exit. External content not blocked.")
   58.17                          completion()
   58.18                          return
   58.19 @@ -228,7 +228,7 @@
   58.20          let handler = {
   58.21              [weak self] (scrollView: UIScrollView, change: NSKeyValueObservedChange<CGSize>) in
   58.22              guard let me = self else {
   58.23 -                Logger.backendLogger.lostMySelf()
   58.24 +                Log.shared.errorAndCrash("Lost MySelf")
   58.25                  return
   58.26              }
   58.27  
   58.28 @@ -376,7 +376,7 @@
   58.29              return
   58.30          case .linkActivated:
   58.31              guard let url = navigationAction.request.url else {
   58.32 -                Logger.frontendLogger.errorAndCrash("Link to nonexisting URL has been clicked?")
   58.33 +                Log.shared.errorAndCrash("Link to nonexisting URL has been clicked?")
   58.34                  break
   58.35              }
   58.36              if url.scheme == "mailto" {
    59.1 --- a/pEpForiOS/UI/Util/SuggestTableViewController/SuggestTableViewController.swift	Tue May 07 19:18:28 2019 +0200
    59.2 +++ b/pEpForiOS/UI/Util/SuggestTableViewController/SuggestTableViewController.swift	Wed May 08 12:01:12 2019 +0200
    59.3 @@ -34,7 +34,7 @@
    59.4  extension SuggestTableViewController {
    59.5      override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    59.6          guard let viewModel = viewModel else {
    59.7 -            Logger.frontendLogger.errorAndCrash("No VM")
    59.8 +            Log.shared.errorAndCrash("No VM")
    59.9              return
   59.10          }
   59.11          viewModel.handleRowSelected(at: indexPath.row)
   59.12 @@ -48,7 +48,7 @@
   59.13      public override func tableView(_ tableView: UITableView,
   59.14                                     numberOfRowsInSection section: Int) -> Int {
   59.15          guard let viewModel = viewModel else {
   59.16 -            Logger.frontendLogger.errorAndCrash("No VM")
   59.17 +            Log.shared.errorAndCrash("No VM")
   59.18              return 0
   59.19          }
   59.20          return viewModel.numRows
   59.21 @@ -61,7 +61,7 @@
   59.22              let cell = tableView.dequeueReusableCell(withIdentifier: ContactCell.reuseId,
   59.23                                                         for: indexPath)
   59.24              as? ContactCell else {
   59.25 -                Logger.frontendLogger.errorAndCrash("Illegal state")
   59.26 +                Log.shared.errorAndCrash("Illegal state")
   59.27                  return UITableViewCell()
   59.28          }
   59.29          let row = viewModel.row(at: indexPath.row)
    60.1 --- a/pEpForiOS/UI/Util/SuggestTableViewController/SuggestViewModel.swift	Tue May 07 19:18:28 2019 +0200
    60.2 +++ b/pEpForiOS/UI/Util/SuggestTableViewController/SuggestViewModel.swift	Wed May 08 12:01:12 2019 +0200
    60.3 @@ -54,7 +54,7 @@
    60.4  
    60.5      public func handleRowSelected(at index: Int) {
    60.6          guard index < identities.count else {
    60.7 -            Logger.frontendLogger.errorAndCrash("Out of bounds")
    60.8 +            Log.shared.errorAndCrash("Out of bounds")
    60.9              return
   60.10          }
   60.11          resultDelegate?.suggestViewModelDidSelectContact(identity: identities[index])
   60.12 @@ -66,7 +66,7 @@
   60.13  
   60.14      public func row(at index: Int) -> Row {
   60.15          guard index < identities.count else {
   60.16 -            Logger.frontendLogger.errorAndCrash("Index out of bounds")
   60.17 +            Log.shared.errorAndCrash("Index out of bounds")
   60.18              return Row(name: "Problem", email: "child")
   60.19          }
   60.20          let identity = identities[index]
    61.1 --- a/pEpForiOS/UI/Util/UIUtils.swift	Tue May 07 19:18:28 2019 +0200
    61.2 +++ b/pEpForiOS/UI/Util/UIUtils.swift	Wed May 08 12:01:12 2019 +0200
    61.3 @@ -19,7 +19,7 @@
    61.4      ///   - error: error to preset to user
    61.5      ///   - vc: ViewController to present the error on
    61.6      static func show(error: Error, inViewController vc: UIViewController) {
    61.7 -//        Logger.utilLogger.errorAndCrash("Will display error to user: %@",
    61.8 +//        Log.shared.errorAndCrash("Will display error to user: %@",
    61.9  //                                                    error.localizedDescription)
   61.10          guard let displayError = DisplayUserError(withError: error) else {
   61.11              // Do nothing. The error type is not suitable to bother the user with.
   61.12 @@ -92,7 +92,7 @@
   61.13              let composeVc = composeNavigationController.rootViewController
   61.14                  as? ComposeTableViewController
   61.15              else {
   61.16 -                Logger.utilLogger.errorAndCrash("Missing required data")
   61.17 +                Log.shared.errorAndCrash("Missing required data")
   61.18                  return
   61.19          }
   61.20          var prefilledTo: Identity? = nil
   61.21 @@ -124,7 +124,7 @@
   61.22          let storyboard = UIStoryboard(name: Constants.addToContactsStoryboard, bundle: nil)
   61.23          guard let contactVc = storyboard.instantiateViewController(withIdentifier:
   61.24              AddToContactsViewController.storyboardId) as? AddToContactsViewController else {
   61.25 -                Logger.utilLogger.errorAndCrash("Missing required data")
   61.26 +                Log.shared.errorAndCrash("Missing required data")
   61.27                  return
   61.28          }
   61.29          contactVc.appConfig = appConfig
   61.30 @@ -148,11 +148,11 @@
   61.31                                                       at view: UIView,
   61.32                                                       appConfig: AppConfig) {
   61.33          guard let _ = UrlClickHandler.Scheme(for: url) else {
   61.34 -            Logger.utilLogger.errorAndCrash("Unsupported scheme")
   61.35 +            Log.shared.errorAndCrash("Unsupported scheme")
   61.36              return
   61.37          }
   61.38          guard let address = url.firstRecipientAddress() else {
   61.39 -            Logger.utilLogger.errorAndCrash("No address")
   61.40 +            Log.shared.errorAndCrash("No address")
   61.41              return
   61.42          }
   61.43          presentActionSheetWithContactOptions(forContactWithEmailAddress: address,
   61.44 @@ -239,7 +239,7 @@
   61.45  
   61.46      static func presentSettings(on viewController: UIViewController, appConfig: AppConfig) {
   61.47          guard let vc = UIStoryboard.init(name: "Settings", bundle: Bundle.main).instantiateViewController(withIdentifier: SettingsTableViewController.storyboardId) as? SettingsTableViewController else {
   61.48 -            Logger.utilLogger.errorAndCrash("No controller")
   61.49 +            Log.shared.errorAndCrash("No controller")
   61.50              return
   61.51          }
   61.52          vc.appConfig = appConfig
    62.1 --- a/pEpForiOS/Util/DebugMergePolicy.swift	Tue May 07 19:18:28 2019 +0200
    62.2 +++ b/pEpForiOS/Util/DebugMergePolicy.swift	Wed May 08 12:01:12 2019 +0200
    62.3 @@ -38,7 +38,7 @@
    62.4                  for c in conflictingObjects {
    62.5                      logString += "\n* \(c.keyPath):\n\(String(describing: c.o1))\n->\n\(String(describing: c.o2))"
    62.6                  }
    62.7 -                Logger.utilLogger.error("%{public}@", logString)
    62.8 +                Log.shared.error("%{public}@", logString)
    62.9              }
   62.10          }
   62.11      }
    63.1 --- a/pEpForiOS/Util/Extensions/ConnectionTransport+AccountSettings.swift	Tue May 07 19:18:28 2019 +0200
    63.2 +++ b/pEpForiOS/Util/Extensions/ConnectionTransport+AccountSettings.swift	Wed May 08 12:01:12 2019 +0200
    63.3 @@ -18,7 +18,7 @@
    63.4          case .startTLS: self = .startTLS
    63.5          case .TLS: self = .TLS
    63.6          case .unknown:
    63.7 -            Logger.utilLogger.errorAndCrash(
    63.8 +            Log.shared.errorAndCrash(
    63.9                  "Unsupported LAS transport: %d", accountSettingsTransport.rawValue)
   63.10              self = .plain
   63.11          }
    64.1 --- a/pEpForiOS/Util/Extensions/PEP_rating+Extension.swift	Tue May 07 19:18:28 2019 +0200
    64.2 +++ b/pEpForiOS/Util/Extensions/PEP_rating+Extension.swift	Wed May 08 12:01:12 2019 +0200
    64.3 @@ -31,7 +31,7 @@
    64.4               .underAttack:
    64.5              return false
    64.6          default:
    64.7 -            Logger.utilLogger.errorAndCrash(
    64.8 +            Log.shared.errorAndCrash(
    64.9                  "cannot decide isUnderAttack() for %{public}@", self.rawValue)
   64.10              return false
   64.11          }
   64.12 @@ -57,7 +57,7 @@
   64.13               .underAttack:
   64.14              return false
   64.15          default:
   64.16 -            Logger.utilLogger.errorAndCrash(
   64.17 +            Log.shared.errorAndCrash(
   64.18                  "cannot decide isUnderAttack() for %{public}@", self.rawValue)
   64.19              return false
   64.20          }
    65.1 --- a/pEpForiOS/Util/Log/Log+ASL.swift	Tue May 07 19:18:28 2019 +0200
    65.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.3 @@ -1,213 +0,0 @@
    65.4 -//
    65.5 -//  Log+ASL.swift
    65.6 -//  pEp
    65.7 -//
    65.8 -//  Created by Dirk Zimmermann on 03.10.18.
    65.9 -//  Copyright © 2018 p≡p Security S.A. All rights reserved.
   65.10 -//
   65.11 -
   65.12 -import Foundation
   65.13 -import asl
   65.14 -
   65.15 -class ASLLogger: ActualLoggerProtocol {
   65.16 -    func saveLog(severity: LoggingSeverity,
   65.17 -                 entity: String,
   65.18 -                 description: String,
   65.19 -                 comment: String) {
   65.20 -        let logMessage = asl_new(UInt32(ASL_TYPE_MSG))
   65.21 -
   65.22 -        asl_set(logMessage, ASL_KEY_SENDER, sender)
   65.23 -        asl_set(logMessage, ASL_KEY_FACILITY, entity)
   65.24 -        asl_set(logMessage, ASL_KEY_MSG, "\(description) [\(comment)]")
   65.25 -        asl_set(logMessage, ASL_KEY_LEVEL, "\(severity.aslLevel())")
   65.26 -
   65.27 -        let nowDate = Date()
   65.28 -        let dateString = "\(Int(nowDate.timeIntervalSince1970))"
   65.29 -        asl_set(logMessage, ASL_KEY_TIME, dateString)
   65.30 -
   65.31 -        asl_set(logMessage, ASL_KEY_READ_UID, "-1")
   65.32 -
   65.33 -        asl_send(self.consoleClient, logMessage)
   65.34 -        asl_free(logMessage)
   65.35 -    }
   65.36 -
   65.37 -    func retrieveLog() -> String {
   65.38 -        let query = asl_new(UInt32(ASL_TYPE_QUERY))
   65.39 -
   65.40 -        var result = asl_set_query(
   65.41 -            query,
   65.42 -            ASL_KEY_SENDER,
   65.43 -            sender,
   65.44 -            UInt32(ASL_QUERY_OP_EQUAL))
   65.45 -        ASLLogger.checkASLSuccess(result: result, comment: "asl_set_query ASL_KEY_SENDER")
   65.46 -
   65.47 -        let fromDate = Date(timeInterval: -600, since: Date())
   65.48 -        let fromDateString = "\(Int(fromDate.timeIntervalSince1970))"
   65.49 -        result = asl_set_query(
   65.50 -            query,
   65.51 -            ASL_KEY_TIME,
   65.52 -            fromDateString,
   65.53 -            UInt32(ASL_QUERY_OP_GREATER_EQUAL))
   65.54 -        ASLLogger.checkASLSuccess(result: result, comment: "asl_set_query ASL_KEY_TIME")
   65.55 -
   65.56 -        let theClient = createConsoleLogger()
   65.57 -
   65.58 -        let response = asl_search(theClient, query)
   65.59 -        var next = asl_next(response)
   65.60 -        var logString = ""
   65.61 -        while next != nil {
   65.62 -            let timeString = String(cString: asl_get(next, ASL_KEY_TIME))
   65.63 -            let messageString = String(cString: asl_get(next, ASL_KEY_MSG))
   65.64 -            let facilityString = String(cString: asl_get(next, ASL_KEY_FACILITY))
   65.65 -            let levelString = String(cString: asl_get(next, ASL_KEY_LEVEL))
   65.66 -
   65.67 -            let level = levelString.aslLevelStringToASL()
   65.68 -            let ownLevelString = level.criticalityString()
   65.69 -
   65.70 -            var dateString = "<NoTime>"
   65.71 -            if let dateInt = Int(timeString) {
   65.72 -                let date = Date(timeIntervalSince1970: TimeInterval(dateInt))
   65.73 -                dateString = "\(date)"
   65.74 -            }
   65.75 -
   65.76 -            if !logString.isEmpty {
   65.77 -                logString.append("\n")
   65.78 -            }
   65.79 -
   65.80 -            let stringToLog = "\(dateString) [\(ownLevelString)] [\(facilityString)] \(messageString)"
   65.81 -            logString.append(stringToLog)
   65.82 -
   65.83 -            next = asl_next(response)
   65.84 -        }
   65.85 -
   65.86 -        asl_free(query)
   65.87 -        asl_free(response)
   65.88 -        asl_free(theClient)
   65.89 -
   65.90 -        return logString
   65.91 -    }
   65.92 -
   65.93 -    init() {
   65.94 -        self.consoleClient = createConsoleLogger()
   65.95 -    }
   65.96 -
   65.97 -    deinit {
   65.98 -        asl_release(consoleClient)
   65.99 -    }
  65.100 -
  65.101 -    private let sender = "security.pEp.app.iOS"
  65.102 -
  65.103 -    private var consoleClient: aslclient?
  65.104 -
  65.105 -    private func createConsoleLogger() -> asl_object_t {
  65.106 -        return asl_open(self.sender, "default", 0)
  65.107 -    }
  65.108 -
  65.109 -    private static func checkASLSuccess(result: Int32, comment: String) {
  65.110 -        if result != 0 {
  65.111 -            print("error: \(comment)")
  65.112 -        }
  65.113 -    }
  65.114 -}
  65.115 -
  65.116 -extension LoggingSeverity {
  65.117 -    /**
  65.118 -     Maps the internal criticality of a log  message into a subsystem of ASL levels.
  65.119 -
  65.120 -     ASL has the following:
  65.121 -     * ASL_LEVEL_EMERG
  65.122 -     * ASL_LEVEL_ALERT
  65.123 -     * ASL_LEVEL_CRIT
  65.124 -     * ASL_LEVEL_ERR
  65.125 -     * ASL_LEVEL_WARNING
  65.126 -     * ASL_LEVEL_NOTICE
  65.127 -     * ASL_LEVEL_INFO
  65.128 -     * ASL_LEVEL_DEBUG
  65.129 -     */
  65.130 -    func aslLevel() -> Int32 {
  65.131 -        switch self {
  65.132 -        case .verbose:
  65.133 -            return ASL_LEVEL_DEBUG
  65.134 -        case .info:
  65.135 -            return ASL_LEVEL_NOTICE
  65.136 -        case .warning:
  65.137 -            return ASL_LEVEL_WARNING
  65.138 -        case .error:
  65.139 -            return ASL_LEVEL_ERR
  65.140 -        }
  65.141 -    }
  65.142 -}
  65.143 -
  65.144 -extension String {
  65.145 -    func aslLevelStringToASL() -> Int32 {
  65.146 -        switch self {
  65.147 -        case "0":
  65.148 -            return ASL_LEVEL_EMERG
  65.149 -        case "1":
  65.150 -            return ASL_LEVEL_ALERT
  65.151 -        case "2":
  65.152 -            return ASL_LEVEL_CRIT
  65.153 -        case "3":
  65.154 -            return ASL_LEVEL_ERR
  65.155 -        case "4":
  65.156 -            return ASL_LEVEL_WARNING
  65.157 -        case "5":
  65.158 -            return ASL_LEVEL_NOTICE
  65.159 -        case "6":
  65.160 -            return ASL_LEVEL_INFO
  65.161 -        case "7":
  65.162 -            return ASL_LEVEL_DEBUG
  65.163 -
  65.164 -        default:
  65.165 -            return ASL_LEVEL_DEBUG
  65.166 -        }
  65.167 -    }
  65.168 -}
  65.169 -
  65.170 -extension Int32 {
  65.171 -    func criticalityString() -> String {
  65.172 -        switch self {
  65.173 -        case ASL_LEVEL_EMERG:
  65.174 -            return "EMERG"
  65.175 -        case ASL_LEVEL_ALERT:
  65.176 -            return "ALERT"
  65.177 -        case ASL_LEVEL_CRIT:
  65.178 -            return "CRIT"
  65.179 -        case ASL_LEVEL_ERR:
  65.180 -            return "ERR"
  65.181 -        case ASL_LEVEL_WARNING:
  65.182 -            return "WARNING"
  65.183 -        case ASL_LEVEL_NOTICE:
  65.184 -            return "NOTICE"
  65.185 -        case ASL_LEVEL_INFO:
  65.186 -            return "INFO"
  65.187 -        case ASL_LEVEL_DEBUG:
  65.188 -            return "DEBUG"
  65.189 -        default:
  65.190 -            return "UNKNOWN"
  65.191 -        }
  65.192 -    }
  65.193 -
  65.194 -    func aslLevelString() -> String {
  65.195 -        switch self {
  65.196 -        case ASL_LEVEL_EMERG:
  65.197 -            return "ASL_LEVEL_EMERG"
  65.198 -        case ASL_LEVEL_ALERT:
  65.199 -            return "ASL_LEVEL_ALERT"
  65.200 -        case ASL_LEVEL_CRIT:
  65.201 -            return "ASL_LEVEL_CRIT"
  65.202 -        case ASL_LEVEL_ERR:
  65.203 -            return "ASL_LEVEL_ERR"
  65.204 -        case ASL_LEVEL_WARNING:
  65.205 -            return "ASL_LEVEL_WARNING"
  65.206 -        case ASL_LEVEL_NOTICE:
  65.207 -            return "ASL_LEVEL_NOTICE"
  65.208 -        case ASL_LEVEL_INFO:
  65.209 -            return "ASL_LEVEL_INFO"
  65.210 -        case ASL_LEVEL_DEBUG:
  65.211 -            return "ASL_LEVEL_DEBUG"
  65.212 -        default:
  65.213 -            return "ASL_LEVEL_UNKNOWN"
  65.214 -        }
  65.215 -    }
  65.216 -}
    66.1 --- a/pEpForiOS/Util/Log/Log.swift	Tue May 07 19:18:28 2019 +0200
    66.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.3 @@ -1,208 +0,0 @@
    66.4 -//
    66.5 -//  Log.swift
    66.6 -//  pEpForiOS
    66.7 -//
    66.8 -//  Created by Dirk Zimmermann on 08/04/16.
    66.9 -//  Copyright © 2016 p≡p Security S.A. All rights reserved.
   66.10 -//
   66.11 -
   66.12 -import os.log
   66.13 -
   66.14 -import MessageModel
   66.15 -
   66.16 -enum LoggingSeverity {
   66.17 -    case verbose
   66.18 -    case info
   66.19 -    case warning
   66.20 -    case error
   66.21 -}
   66.22 -
   66.23 -/**
   66.24 - Handling the actual logging.
   66.25 - */
   66.26 -protocol ActualLoggerProtocol {
   66.27 -    func saveLog(severity: LoggingSeverity,
   66.28 -                 entity: String,
   66.29 -                 description: String,
   66.30 -                 comment: String)
   66.31 -
   66.32 -    func retrieveLog() -> String
   66.33 -}
   66.34 -
   66.35 -/** Very primitive Logging class. */
   66.36 -@objc open class Log: NSObject {
   66.37 -    static public let shared: Log = {
   66.38 -        let instance = Log()
   66.39 -        return instance
   66.40 -    }()
   66.41 -
   66.42 -    static public func disableLog() {
   66.43 -        Log.shared.loggingQueue.addOperation() {
   66.44 -            Log.shared.logEnabled = false
   66.45 -        }
   66.46 -    }
   66.47 -
   66.48 -    static public func enableLog() {
   66.49 -        Log.shared.loggingQueue.addOperation() {
   66.50 -            Log.shared.logEnabled = true
   66.51 -        }
   66.52 -    }
   66.53 -
   66.54 -    static public func checkEnabled(_ block: ((Bool) -> ())?) {
   66.55 -        Log.shared.loggingQueue.addOperation() {
   66.56 -            let b = Log.shared.logEnabled
   66.57 -            block?(b)
   66.58 -        }
   66.59 -    }
   66.60 -
   66.61 -    static public func checklog(_ block: ((String?) -> ())?) {
   66.62 -        Log.shared.loggingQueue.addOperation() {
   66.63 -            let logString = Log.shared.internalLogger.retrieveLog()
   66.64 -            block?(logString)
   66.65 -        }
   66.66 -    }
   66.67 -
   66.68 -    static public func verbose(component: String, content: String) {
   66.69 -        Log.shared.saveLog(severity:.verbose,
   66.70 -                           entity: component, description: content, comment: "verbose")
   66.71 -    }
   66.72 -
   66.73 -    /** Somewhat verbose */
   66.74 -    static public func info(component: String, content: String) {
   66.75 -        Log.shared.saveLog(severity:.info,
   66.76 -                           entity: component, description: content, comment: "info")
   66.77 -    }
   66.78 -
   66.79 -    /** More important */
   66.80 -    static public func warn(component: String, content: String) {
   66.81 -        Log.shared.saveLog(severity:.warning,
   66.82 -                           entity: component, description: content, comment: "warn")
   66.83 -    }
   66.84 -
   66.85 -    static public func error(component: String, error: Error?) {
   66.86 -        if let err = error {
   66.87 -            Log.shared.saveLog(severity:.error,
   66.88 -                               entity: component, description: " \(err)", comment: "error")
   66.89 -        }
   66.90 -    }
   66.91 -
   66.92 -    static public func error(component: String, errorString: String, error: Error) {
   66.93 -        Log.shared.saveLog(severity:.error,
   66.94 -                           entity: component, description: "\(errorString) \(error)", comment: "error")
   66.95 -    }
   66.96 -
   66.97 -    static public func error(component: String, errorString: String) {
   66.98 -        Log.shared.saveLog(severity:.error,
   66.99 -                           entity: component, description: errorString, comment: "error")
  66.100 -    }
  66.101 -
  66.102 -    public static func log(comp: String, mySelf: AnyObject, functionName: String) {
  66.103 -        let selfDesc = unsafeBitCast(mySelf, to: UnsafeRawPointer.self)
  66.104 -        Log.shared.info(component: comp, content: "\(functionName): \(selfDesc)")
  66.105 -    }
  66.106 -
  66.107 -    public func resume() {
  66.108 -        Log.shared.paused = false
  66.109 -    }
  66.110 -
  66.111 -    public func pause() {
  66.112 -        Log.shared.paused = true
  66.113 -        Log.shared.loggingQueue.cancelAllOperations()
  66.114 -    }
  66.115 -
  66.116 -    private let title = "pEpForiOS"
  66.117 -    private var logEnabled = true
  66.118 -    private var paused = false
  66.119 -
  66.120 -    private let loggingQueue: OperationQueue = {
  66.121 -        let createe = OperationQueue()
  66.122 -        createe.qualityOfService = .background
  66.123 -        createe.maxConcurrentOperationCount = 1
  66.124 -        return createe
  66.125 -    }()
  66.126 -
  66.127 -    private let internalLogger = ASLLogger()
  66.128 -
  66.129 -    /**
  66.130 -     Prints and/or saves a log entry.
  66.131 -     - Note: For a log to be printed, the entity must be contained in `allowedEntities`,
  66.132 -     or the severity must be noted in `allowedSeverities`.
  66.133 -     */
  66.134 -    private func saveLog(severity: LoggingSeverity,
  66.135 -                         entity: String,
  66.136 -                         description: String,
  66.137 -                         comment: String) {
  66.138 -        let allowedEntities = Set<String>(["CWIMAPStore", "ImapSync"])
  66.139 -        let allowedSeverities = Set<LoggingSeverity>([.error, .warning, .info])
  66.140 -
  66.141 -        if allowedSeverities.contains(severity) || allowedEntities.contains(entity) {
  66.142 -            internalLogger.saveLog(severity: severity,
  66.143 -                                   entity: entity,
  66.144 -                                   description: description,
  66.145 -                                   comment: comment)
  66.146 -        }
  66.147 -    }
  66.148 -}
  66.149 -
  66.150 -extension Log: MessageModelLogging {
  66.151 -    public func verbose(component: String, content: String) {
  66.152 -        Log.verbose(component: component, content: content)
  66.153 -    }
  66.154 -
  66.155 -    public func info(component: String, content: String) {
  66.156 -        Log.info(component: component, content: content)
  66.157 -    }
  66.158 -
  66.159 -    public func warn(component: String, content: String) {
  66.160 -        Log.warn(component: component, content: content)
  66.161 -    }
  66.162 -
  66.163 -    public func error(component: String, error: Error) {
  66.164 -        Log.error(component: component, error: error)
  66.165 -    }
  66.166 -
  66.167 -    public func error(component: String, errorString: String, error: Error) {
  66.168 -        Log.error(component: component, errorString: errorString, error: error)
  66.169 -    }
  66.170 -
  66.171 -    public func error(component: String, errorString: String) {
  66.172 -        Log.error(component: component, errorString: errorString)
  66.173 -    }
  66.174 -
  66.175 -    /// Logs component and error.
  66.176 -    ///
  66.177 -    /// - note: If (and only if) in DEBUG configuration, it also calls fatalError().
  66.178 -    ///
  66.179 -    /// - Parameters:
  66.180 -    ///   - component: caller information to log
  66.181 -    ///   - error: error to log
  66.182 -    public func errorAndCrash(component: String, error: Error) {
  66.183 -        Log.error(component: component, error: error)
  66.184 -        SystemUtils.crash("ERROR \(component): \(error.localizedDescription)")
  66.185 -    }
  66.186 -
  66.187 -    /// Logs component and error.
  66.188 -    ///
  66.189 -    /// - note: If (and only if) in DEBUG configuration, it also calls fatalError().
  66.190 -    ///
  66.191 -    /// - Parameters:
  66.192 -    ///   - component: caller information to log
  66.193 -    ///   - errorString: error information to log
  66.194 -    ///   - error: error to log
  66.195 -    public func errorAndCrash(component: String, errorString: String, error: Error) {
  66.196 -        Log.error(component: component, errorString: errorString, error: error)
  66.197 -        SystemUtils.crash("ERROR \(component): \(errorString): \(error.localizedDescription)")
  66.198 -    }
  66.199 -
  66.200 -    /// Logs component and error.
  66.201 -    ///
  66.202 -    /// - note: If (and only if) in DEBUG configuration, it also calls fatalError().
  66.203 -    ///
  66.204 -    /// - Parameters:
  66.205 -    ///   - component: caller information to log
  66.206 -    ///   - errorString: error information to log
  66.207 -    public func errorAndCrash(component: String, errorString: String) {
  66.208 -        Log.error(component: component, errorString: errorString)
  66.209 -        SystemUtils.crash("ERROR \(component): \(errorString)")
  66.210 -    }
  66.211 -}
    67.1 --- a/pEpForiOS/Util/ReferenceCounter.swift	Tue May 07 19:18:28 2019 +0200
    67.2 +++ b/pEpForiOS/Util/ReferenceCounter.swift	Wed May 08 12:01:12 2019 +0200
    67.3 @@ -59,7 +59,7 @@
    67.4      public static func logOutstanding() {
    67.5          for (_, entry) in table {
    67.6              if entry.count != 0 {
    67.7 -                Logger.utilLogger.warn("%{public}@", entry.description)
    67.8 +                Log.shared.warn("%{public}@", entry.description)
    67.9              }
   67.10          }
   67.11      }
    68.1 --- a/pEpForiOS/Util/UserNotificationTool.swift	Tue May 07 19:18:28 2019 +0200
    68.2 +++ b/pEpForiOS/Util/UserNotificationTool.swift	Wed May 08 12:01:12 2019 +0200
    68.3 @@ -64,7 +64,7 @@
    68.4                                                  content: content, trigger: trigger)
    68.5              center.add(request) { (error) in
    68.6                  if let error = error {
    68.7 -                    Logger.utilLogger.warn(
    68.8 +                    Log.shared.warn(
    68.9                          "Error posting user notification: %{public}@",
   68.10                          error.localizedDescription)
   68.11                  }
    69.1 --- a/subModules/pEpIOSToolbox/pEpIOSToolbox.xcodeproj/project.pbxproj	Tue May 07 19:18:28 2019 +0200
    69.2 +++ b/subModules/pEpIOSToolbox/pEpIOSToolbox.xcodeproj/project.pbxproj	Wed May 08 12:01:12 2019 +0200
    69.3 @@ -14,6 +14,7 @@
    69.4  		37904565223FA486006DAB3B /* ReachabilityProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37904561223FA486006DAB3B /* ReachabilityProtocol.swift */; };
    69.5  		37904569223FA52B006DAB3B /* NetworkReachibilityMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37904567223FA52B006DAB3B /* NetworkReachibilityMock.swift */; };
    69.6  		3790456A223FA52B006DAB3B /* ReachabilityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37904568223FA52B006DAB3B /* ReachabilityTests.swift */; };
    69.7 +		37954C6E227C90C10099B8D8 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37954C6D227C90C10099B8D8 /* Log.swift */; };
    69.8  		435F5129221FF9D7006EB11F /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 435F5128221FF9D7006EB11F /* Constants.swift */; };
    69.9  		B70A3A5522005BD400EDCE61 /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A3A5422005BD400EDCE61 /* Date+Extension.swift */; };
   69.10  		B70A3A5722005BE300EDCE61 /* NSRegularExpression+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A3A5622005BE300EDCE61 /* NSRegularExpression+Extension.swift */; };
   69.11 @@ -62,6 +63,7 @@
   69.12  		37904561223FA486006DAB3B /* ReachabilityProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReachabilityProtocol.swift; sourceTree = "<group>"; };
   69.13  		37904567223FA52B006DAB3B /* NetworkReachibilityMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkReachibilityMock.swift; sourceTree = "<group>"; };
   69.14  		37904568223FA52B006DAB3B /* ReachabilityTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReachabilityTests.swift; sourceTree = "<group>"; };
   69.15 +		37954C6D227C90C10099B8D8 /* Log.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Log.swift; sourceTree = "<group>"; };
   69.16  		435F5128221FF9D7006EB11F /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Constants.swift; path = ../../../../Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/Constants.swift; sourceTree = "<group>"; };
   69.17  		B70A3A5422005BD400EDCE61 /* Date+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = "<group>"; };
   69.18  		B70A3A5622005BE300EDCE61 /* NSRegularExpression+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSRegularExpression+Extension.swift"; sourceTree = "<group>"; };
   69.19 @@ -165,6 +167,14 @@
   69.20  			path = ReachabilityUtilsTest;
   69.21  			sourceTree = "<group>";
   69.22  		};
   69.23 +		37C3C0E72264BF96003E290C /* Modules */ = {
   69.24 +			isa = PBXGroup;
   69.25 +			children = (
   69.26 +				37954C6D227C90C10099B8D8 /* Log.swift */,
   69.27 +			);
   69.28 +			path = Modules;
   69.29 +			sourceTree = "<group>";
   69.30 +		};
   69.31  		B70A3A5222005A7600EDCE61 /* Foundation */ = {
   69.32  			isa = PBXGroup;
   69.33  			children = (
   69.34 @@ -218,6 +228,7 @@
   69.35  		B7911EB621F7358500D7F66F /* pEpIOSToolbox */ = {
   69.36  			isa = PBXGroup;
   69.37  			children = (
   69.38 +				37C3C0E72264BF96003E290C /* Modules */,
   69.39  				B70A3A5222005A7600EDCE61 /* Foundation */,
   69.40  				B70A3A5322005B9600EDCE61 /* UIKit */,
   69.41  				B7DB7FEC221B086A003968DA /* Other */,
   69.42 @@ -369,6 +380,7 @@
   69.43  				B7A46C54220C73BE0027CCB5 /* String+Extensions.swift in Sources */,
   69.44  				B7A46C58220DA6190027CCB5 /* String+Email.swift in Sources */,
   69.45  				37904565223FA486006DAB3B /* ReachabilityProtocol.swift in Sources */,
   69.46 +				37954C6E227C90C10099B8D8 /* Log.swift in Sources */,
   69.47  				B7A46C62220DCEA80027CCB5 /* NSAttributedString+Parsing.swift in Sources */,
   69.48  				B7465DE72211E969008A1708 /* CGRect+Util.swift in Sources */,
   69.49  				B7465DCC2211BEEA008A1708 /* Tuple.swift in Sources */,
    70.1 --- a/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/Data+Extensions.swift	Tue May 07 19:18:28 2019 +0200
    70.2 +++ b/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/Data+Extensions.swift	Wed May 08 12:01:12 2019 +0200
    70.3 @@ -30,7 +30,7 @@
    70.4          do {
    70.5              try write(to: url)
    70.6          } catch {
    70.7 -            Logger.utilLogger.error("Could not save to %{public}@", url.absoluteString)
    70.8 +            Log.shared.error("Could not save to %{public}@", url.absoluteString)
    70.9          }
   70.10      }
   70.11  
   70.12 @@ -40,7 +40,7 @@
   70.13                  withJSONObject: self, options: .prettyPrinted)
   70.14              jsonData.debugSave(basePath: basePath, fileName: fileName, ext: ext)
   70.15          } catch let err {
   70.16 -            Logger.utilLogger.error("%{public}@", err.localizedDescription)
   70.17 +            Log.shared.error("%{public}@", err.localizedDescription)
   70.18          }
   70.19      }
   70.20  }
    71.1 --- a/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/String+Extensions.swift	Tue May 07 19:18:28 2019 +0200
    71.2 +++ b/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/String+Extensions.swift	Wed May 08 12:01:12 2019 +0200
    71.3 @@ -152,7 +152,7 @@
    71.4                                                      range: range,
    71.5                                                      withTemplate: replacee)
    71.6          } catch {
    71.7 -            Logger.utilLogger.errorAndCrash("Catched!")
    71.8 +            Log.shared.errorAndCrash("Catched!")
    71.9              return result
   71.10          }
   71.11          return result
   71.12 @@ -178,7 +178,7 @@
   71.13              let matches = regex.matches(in: self, options: [], range: wholeRange())
   71.14              return matches.count > 0
   71.15          } catch {
   71.16 -            Logger.utilLogger.errorAndCrash("%{public}@", error.localizedDescription)
   71.17 +            Log.shared.errorAndCrash("%{public}@", error.localizedDescription)
   71.18          }
   71.19          return false
   71.20      }
   71.21 @@ -209,7 +209,7 @@
   71.22                  }
   71.23              }
   71.24          } catch {
   71.25 -            Logger.utilLogger.errorAndCrash("%{public}@",
   71.26 +            Log.shared.errorAndCrash("%{public}@",
   71.27                                                          error.localizedDescription)
   71.28          }
   71.29          return self
   71.30 @@ -233,7 +233,7 @@
   71.31                  }
   71.32              }
   71.33          } catch {
   71.34 -            Logger.utilLogger.errorAndCrash("%{public}@",
   71.35 +            Log.shared.errorAndCrash("%{public}@",
   71.36                                                          error.localizedDescription)
   71.37          }
   71.38          return self