merge refactor IOS-1558
authorAlejandro Gelos <alejandro@pep-project.org>
Wed, 08 May 2019 12:31:03 +0200
branchIOS-1558
changeset 85244d1867c9ca79
parent 8473 ba092f3fe93a
parent 8522 2a942d9e828e
child 8670 949a6fcdbbf9
merge refactor
pEpForiOS/Util/Log/Log+ASL.swift
pEpForiOS/Util/Log/Log.swift
subModules/pEpIOSToolbox/pEpIOSToolbox.xcodeproj/project.pbxproj
     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:31:03 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	Mon May 06 14:01:07 2019 +0200
     2.2 +++ b/Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/Logger.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
     3.2 +++ b/Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/SortedSet.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
     4.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Wed May 08 12:31:03 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 @@ -421,8 +422,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 @@ -679,6 +678,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 @@ -1903,7 +1901,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 @@ -2043,6 +2040,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 @@ -2254,15 +2253,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 @@ -2940,6 +2930,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 @@ -2984,7 +2975,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	Mon May 06 14:01:07 2019 +0200
     5.2 +++ b/pEpForiOS/AppDelegate.swift	Wed May 08 12:31:03 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/Base.lproj/Main.storyboard	Mon May 06 14:01:07 2019 +0200
     6.2 +++ b/pEpForiOS/Base.lproj/Main.storyboard	Wed May 08 12:31:03 2019 +0200
     6.3 @@ -1,11 +1,11 @@
     6.4  <?xml version="1.0" encoding="UTF-8"?>
     6.5 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="wwj-Sj-78N">
     6.6 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="wwj-Sj-78N">
     6.7      <device id="retina4_7" orientation="portrait">
     6.8          <adaptation id="fullscreen"/>
     6.9      </device>
    6.10      <dependencies>
    6.11          <deployment identifier="iOS"/>
    6.12 -        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
    6.13 +        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
    6.14          <capability name="Safe area layout guides" minToolsVersion="9.0"/>
    6.15          <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    6.16      </dependencies>
    6.17 @@ -107,7 +107,7 @@
    6.18                                              </subviews>
    6.19                                          </stackView>
    6.20                                          <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" image="pEp-status-yellow" translatesAutoresizingMaskIntoConstraints="NO" id="m0u-Jn-mQU">
    6.21 -                                            <rect key="frame" x="56" y="52.5" width="20" height="20"/>
    6.22 +                                            <rect key="frame" x="60" y="56.5" width="16" height="16"/>
    6.23                                              <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
    6.24                                              <constraints>
    6.25                                                  <constraint firstAttribute="width" secondItem="m0u-Jn-mQU" secondAttribute="height" multiplier="1:1" id="7pr-8F-BtP"/>
    6.26 @@ -360,19 +360,19 @@
    6.27                                      <rect key="frame" x="0.0" y="0.0" width="375" height="72"/>
    6.28                                      <autoresizingMask key="autoresizingMask"/>
    6.29                                      <subviews>
    6.30 -                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Sender" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hnw-Tp-mga">
    6.31 +                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" ambiguous="YES" text="Sender" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hnw-Tp-mga">
    6.32                                              <rect key="frame" x="20" y="11" width="331" height="30"/>
    6.33                                              <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
    6.34                                              <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
    6.35                                              <nil key="highlightedColor"/>
    6.36                                          </label>
    6.37 -                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="To: Recipients" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mfx-AS-hpP">
    6.38 +                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="To: Recipients" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mfx-AS-hpP">
    6.39                                              <rect key="frame" x="20" y="45" width="331" height="18"/>
    6.40                                              <fontDescription key="fontDescription" type="system" pointSize="15"/>
    6.41                                              <nil key="textColor"/>
    6.42                                              <nil key="highlightedColor"/>
    6.43                                          </label>
    6.44 -                                        <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="252" image="separator_pixel_grey" translatesAutoresizingMaskIntoConstraints="NO" id="Gbh-o3-H58">
    6.45 +                                        <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="252" ambiguous="YES" image="separator_pixel_grey" translatesAutoresizingMaskIntoConstraints="NO" id="Gbh-o3-H58">
    6.46                                              <rect key="frame" x="10" y="71" width="355" height="1"/>
    6.47                                          </imageView>
    6.48                                      </subviews>
    6.49 @@ -784,7 +784,7 @@
    6.50                                                      <color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
    6.51                                                      <nil key="highlightedColor"/>
    6.52                                                  </label>
    6.53 -                                                <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3ee-yP-4gA" customClass="SubjectComposeTextView" customModule="pEpForiOS" customModuleProvider="target">
    6.54 +                                                <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3ee-yP-4gA">
    6.55                                                      <rect key="frame" x="60" y="23" width="295" height="34.5"/>
    6.56                                                      <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
    6.57                                                      <fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="17"/>
     7.1 --- a/pEpForiOS/HTMLParser/Axt/HtmlToMarkdownSaxParser.swift	Mon May 06 14:01:07 2019 +0200
     7.2 +++ b/pEpForiOS/HTMLParser/Axt/HtmlToMarkdownSaxParser.swift	Wed May 08 12:31:03 2019 +0200
     7.3 @@ -62,6 +62,6 @@
     7.4      }
     7.5  
     7.6      func parser(_ parser: AXHTMLParser, parseErrorOccurred parseError: Error) {
     7.7 -        Logger.htmlParsingLogger.errorAndCrash("%@", parseError.localizedDescription)
     7.8 +        Log.shared.errorAndCrash("%@", parseError.localizedDescription)
     7.9      }
    7.10  }
     8.1 --- a/pEpForiOS/HTMLParser/Axt/HtmlToTextSaxParser.swift	Mon May 06 14:01:07 2019 +0200
     8.2 +++ b/pEpForiOS/HTMLParser/Axt/HtmlToTextSaxParser.swift	Wed May 08 12:31:03 2019 +0200
     8.3 @@ -60,6 +60,6 @@
     8.4      }
     8.5  
     8.6      func parser(_ parser: AXHTMLParser, parseErrorOccurred parseError: Error) {
     8.7 -        Logger.htmlParsingLogger.error("%@", parseError.localizedDescription)
     8.8 +        Log.shared.error("%@", parseError.localizedDescription)
     8.9      }
    8.10  }
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/pEpForiOS/Models/Log.swift	Wed May 08 12:31:03 2019 +0200
     9.3 @@ -0,0 +1,18 @@
     9.4 +//
     9.5 +//  Log.swift
     9.6 +//  pEp
     9.7 +//
     9.8 +//  Created by Alejandro Gelos on 12/04/2019.
     9.9 +//  Copyright © 2019 p≡p Security S.A. All rights reserved.
    9.10 +//
    9.11 +
    9.12 +import pEpIOSToolbox
    9.13 +
    9.14 +/// Shared instance of logger.
    9.15 +class Log {
    9.16 +    static let shared = Logger(subsystem: "security.pEp.pEpForiOS", category: "pEpForiOS")
    9.17 +
    9.18 +    /// Init is forbidden. Singleton...
    9.19 +    private init() {}
    9.20 +}
    9.21 +
    10.1 --- a/pEpForiOS/Models/Server+Fetching.swift	Mon May 06 14:01:07 2019 +0200
    10.2 +++ b/pEpForiOS/Models/Server+Fetching.swift	Wed May 08 12:31:03 2019 +0200
    10.3 @@ -18,7 +18,7 @@
    10.4              var accounts = [Account]()
    10.5              for cdServer in cdServers {
    10.6                  guard let account = cdServer.account?.account() else {
    10.7 -                    Logger.modelLogger.errorAndCrash("No address")
    10.8 +                    Log.shared.errorAndCrash("No address")
    10.9                      continue
   10.10                  }
   10.11                  accounts.append(account)
    11.1 --- a/pEpForiOS/UI/Background/ReevaluateMessageRatingOperation.swift	Mon May 06 14:01:07 2019 +0200
    11.2 +++ b/pEpForiOS/UI/Background/ReevaluateMessageRatingOperation.swift	Wed May 08 12:31:03 2019 +0200
    11.3 @@ -61,7 +61,7 @@
    11.4              context.saveAndLogErrors()
    11.5              message.pEpRatingInt = Int(newRating.rawValue)
    11.6          } catch let error as NSError {
    11.7 -            Logger.backendLogger.log(error: error)
    11.8 +            Log.shared.log(error: error)
    11.9          }
   11.10      }
   11.11  }
    12.1 --- a/pEpForiOS/UI/Compose/Cells/AccountCell/AccountCell.swift	Mon May 06 14:01:07 2019 +0200
    12.2 +++ b/pEpForiOS/UI/Compose/Cells/AccountCell/AccountCell.swift	Wed May 08 12:31:03 2019 +0200
    12.3 @@ -31,7 +31,7 @@
    12.4  
    12.5      private func setupPickerView() {
    12.6          guard let viewModel = viewModel else {
    12.7 -            Logger.frontendLogger.errorAndCrash("No VM")
    12.8 +            Log.shared.errorAndCrash("No VM")
    12.9              return
   12.10          }
   12.11          picker = AccountPickerView()
    13.1 --- a/pEpForiOS/UI/Compose/Cells/BodyCell/BodyCell.swift	Mon May 06 14:01:07 2019 +0200
    13.2 +++ b/pEpForiOS/UI/Compose/Cells/BodyCell/BodyCell.swift	Wed May 08 12:31:03 2019 +0200
    13.3 @@ -26,7 +26,7 @@
    13.4  
    13.5      private func setupInitialText() {
    13.6          guard let vm = viewModel else {
    13.7 -            Logger.frontendLogger.errorAndCrash("No VM")
    13.8 +            Log.shared.errorAndCrash("No VM")
    13.9              return
   13.10          }
   13.11          let (text, attrText) = vm.inititalText()
   13.12 @@ -43,7 +43,7 @@
   13.13      // Set cursor and show keyboard
   13.14      override func setFocus() {
   13.15          guard let vm = viewModel else {
   13.16 -            Logger.frontendLogger.errorAndCrash("No VM")
   13.17 +            Log.shared.errorAndCrash("No VM")
   13.18              return
   13.19          }
   13.20          if let rangeStart = textView.position(from: textView.beginningOfDocument,
   13.21 @@ -101,7 +101,7 @@
   13.22                    shouldChangeTextIn range: NSRange,
   13.23                    replacementText text: String) -> Bool {
   13.24          guard let vm = viewModel else {
   13.25 -            Logger.frontendLogger.errorAndCrash("No VM")
   13.26 +            Log.shared.errorAndCrash("No VM")
   13.27              return true
   13.28          }
   13.29         return vm.shouldReplaceText(in: range, of: textView.attributedText, with: text)
    14.1 --- a/pEpForiOS/UI/Compose/Cells/BodyCell/BodyCellViewModel.swift	Mon May 06 14:01:07 2019 +0200
    14.2 +++ b/pEpForiOS/UI/Compose/Cells/BodyCell/BodyCellViewModel.swift	Wed May 08 12:31:03 2019 +0200
    14.3 @@ -117,7 +117,7 @@
    14.4  extension BodyCellViewModel {
    14.5      public func inline(attachment: Attachment) {
    14.6          guard let image = attachment.image else {
    14.7 -            Logger.frontendLogger.errorAndCrash("No image")
    14.8 +            Log.shared.errorAndCrash("No image")
    14.9              return
   14.10          }
   14.11          attachment.contentDisposition = .inline
   14.12 @@ -125,7 +125,7 @@
   14.13          // performance issues (delay typing).
   14.14          guard let scaledImage = image.resized(newWidth: maxTextattachmentWidth / 2, useAlpha: false)
   14.15              else {
   14.16 -                Logger.frontendLogger.errorAndCrash("Error resizing")
   14.17 +                Log.shared.errorAndCrash("Error resizing")
   14.18                  return
   14.19          }
   14.20          let textAttachment = TextAttachment()
    15.1 --- a/pEpForiOS/UI/Compose/Cells/BodyCell/NSAttributedString+BodyTextUtils.swift	Mon May 06 14:01:07 2019 +0200
    15.2 +++ b/pEpForiOS/UI/Compose/Cells/BodyCell/NSAttributedString+BodyTextUtils.swift	Wed May 08 12:31:03 2019 +0200
    15.3 @@ -16,7 +16,7 @@
    15.4      public func assureMaxTextAttachmentImageWidth(_ maxWidth: CGFloat) {
    15.5          for textAttachment in textAttachments() {
    15.6              guard let image = textAttachment.image else {
    15.7 -                Logger.utilLogger.errorAndCrash("No image?")
    15.8 +                Log.shared.errorAndCrash("No image?")
    15.9                  return
   15.10              }
   15.11              if image.size.width > maxWidth {
    16.1 --- a/pEpForiOS/UI/Compose/Cells/RecipientCell/RecipientTextView/RecipientTextView.swift	Mon May 06 14:01:07 2019 +0200
    16.2 +++ b/pEpForiOS/UI/Compose/Cells/RecipientCell/RecipientTextView/RecipientTextView.swift	Wed May 08 12:31:03 2019 +0200
    16.3 @@ -48,7 +48,7 @@
    16.4                           shouldChangeTextIn range: NSRange,
    16.5                           replacementText text: String) -> Bool {
    16.6          guard let vm = viewModel else {
    16.7 -            Logger.frontendLogger.errorAndCrash("No VM")
    16.8 +            Log.shared.errorAndCrash("No VM")
    16.9              return true
   16.10          }
   16.11          if vm.isAddressDeliminator(str: text) {
   16.12 @@ -64,7 +64,7 @@
   16.13                      return true
   16.14              }
   16.15              guard let potentiallyReplacedText = textView.text(in: newRange) else {
   16.16 -                Logger.frontendLogger.errorAndCrash("Invalid state")
   16.17 +                Log.shared.errorAndCrash("Invalid state")
   16.18                  return true
   16.19              }
   16.20              // Check if text is Attachment and select it
   16.21 @@ -89,7 +89,7 @@
   16.22                    shouldInteractWith textAttachment: NSTextAttachment,
   16.23                    in characterRange: NSRange) -> Bool {
   16.24          guard let vm = viewModel else {
   16.25 -            Logger.frontendLogger.errorAndCrash("No VM")
   16.26 +            Log.shared.errorAndCrash("No VM")
   16.27              return true
   16.28          }
   16.29          return vm.shouldInteract(with: textAttachment)
    17.1 --- a/pEpForiOS/UI/Compose/Cells/RecipientCell/RecipientTextView/RecipientTextViewModel+TextAttachment.swift	Mon May 06 14:01:07 2019 +0200
    17.2 +++ b/pEpForiOS/UI/Compose/Cells/RecipientCell/RecipientTextView/RecipientTextViewModel+TextAttachment.swift	Wed May 08 12:31:03 2019 +0200
    17.3 @@ -79,7 +79,7 @@
    17.4                        attributes: attributes, context: nil)
    17.5  
    17.6              guard let createe = UIGraphicsGetImageFromCurrentImageContext() else {
    17.7 -                Logger.frontendLogger.errorAndCrash("No img")
    17.8 +                Log.shared.errorAndCrash("No img")
    17.9                  return
   17.10              }
   17.11              UIGraphicsEndImageContext()
    18.1 --- a/pEpForiOS/UI/Compose/ComposeTableViewController.swift	Mon May 06 14:01:07 2019 +0200
    18.2 +++ b/pEpForiOS/UI/Compose/ComposeTableViewController.swift	Wed May 08 12:31:03 2019 +0200
    18.3 @@ -19,7 +19,7 @@
    18.4      private var suggestionsChildViewController: SuggestTableViewController?
    18.5      lazy private var mediaAttachmentPickerProvider: MediaAttachmentPickerProvider? = {
    18.6          guard let pickerVm = viewModel?.mediaAttachmentPickerProviderViewModel() else {
    18.7 -            Logger.frontendLogger.errorAndCrash("Invalid state")
    18.8 +            Log.shared.errorAndCrash("Invalid state")
    18.9              return nil
   18.10          }
   18.11          return MediaAttachmentPickerProvider(with: pickerVm)
   18.12 @@ -75,7 +75,7 @@
   18.13                  withIdentifier: SuggestTableViewController.storyboardId)
   18.14                  as? SuggestTableViewController,
   18.15              let suggestView = suggestVc.view else {
   18.16 -                Logger.frontendLogger.errorAndCrash("No VC.")
   18.17 +                Log.shared.errorAndCrash("No VC.")
   18.18                  return
   18.19          }
   18.20          suggestionsChildViewController = suggestVc
   18.21 @@ -111,7 +111,7 @@
   18.22  extension ComposeTableViewController {
   18.23      private func setupPepColorView(for pEpRating: PEPRating, pEpProtected: Bool) {
   18.24          guard let vm = viewModel else {
   18.25 -            Logger.frontendLogger.errorAndCrash("No VM")
   18.26 +            Log.shared.errorAndCrash("No VM")
   18.27              return
   18.28          }
   18.29  
   18.30 @@ -129,7 +129,7 @@
   18.31      /// Shows a menu where user can choose to make a handshake, or toggle force unprotected.
   18.32      @objc func actionHandshakeOrForceUnprotected(gestureRecognizer: UITapGestureRecognizer) {
   18.33          guard let vm = viewModel else {
   18.34 -            Logger.frontendLogger.errorAndCrash("No VM")
   18.35 +            Log.shared.errorAndCrash("No VM")
   18.36              return
   18.37          }
   18.38          let theCanHandshake = vm.state.canHandshake()
   18.39 @@ -284,7 +284,7 @@
   18.40              guard
   18.41                  let nc = segue.destination as? UINavigationController,
   18.42                  let destination = nc.rootViewController as? HandshakeViewController else {
   18.43 -                    Logger.frontendLogger.errorAndCrash("Segue issue")
   18.44 +                    Log.shared.errorAndCrash("Segue issue")
   18.45                      return
   18.46              }
   18.47              destination.appConfig = appConfig
   18.48 @@ -318,7 +318,7 @@
   18.49              }
   18.50              guard let me = self,
   18.51              let picker = me.mediaAttachmentPickerProvider?.imagePicker else {
   18.52 -                Logger.frontendLogger.errorAndCrash("Lost somthing")
   18.53 +                Log.shared.errorAndCrash("Lost somthing")
   18.54                  return
   18.55              }
   18.56              me.present(picker, animated: true)
   18.57 @@ -340,7 +340,7 @@
   18.58      
   18.59      override func numberOfSections(in tableView: UITableView) -> Int {
   18.60          guard let vm = viewModel else {
   18.61 -            Logger.frontendLogger.errorAndCrash("No VM")
   18.62 +            Log.shared.errorAndCrash("No VM")
   18.63              return 0
   18.64          }
   18.65          return vm.sections.count
   18.66 @@ -349,7 +349,7 @@
   18.67      override func tableView(_ tableView: UITableView,
   18.68                              numberOfRowsInSection section: Int) -> Int {
   18.69          guard let vm = viewModel else {
   18.70 -            Logger.frontendLogger.errorAndCrash("No VM")
   18.71 +            Log.shared.errorAndCrash("No VM")
   18.72              return 0
   18.73          }
   18.74          return vm.sections[section].rows.count
   18.75 @@ -358,7 +358,7 @@
   18.76      override func tableView(_ tableView: UITableView,
   18.77                              cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   18.78          guard let cell = setupCellForIndexPath(indexPath, in: tableView) else {
   18.79 -            Logger.frontendLogger.errorAndCrash("No cell")
   18.80 +            Log.shared.errorAndCrash("No cell")
   18.81              return UITableViewCell()
   18.82          }
   18.83          return cell
   18.84 @@ -367,7 +367,7 @@
   18.85      private func setupCellForIndexPath(_ indexPath: IndexPath,
   18.86                                    in tableView: UITableView) -> UITableViewCell? {
   18.87          guard let vm = viewModel else {
   18.88 -            Logger.frontendLogger.errorAndCrash("No VM")
   18.89 +            Log.shared.errorAndCrash("No VM")
   18.90              return UITableViewCell()
   18.91          }
   18.92  
   18.93 @@ -380,7 +380,7 @@
   18.94                      as? RecipientCell,
   18.95                  let rowVm = section.rows[indexPath.row] as? RecipientCellViewModel
   18.96                  else {
   18.97 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
   18.98 +                    Log.shared.errorAndCrash("Invalid state")
   18.99                      return nil
  18.100              }
  18.101              cell.setup(with: rowVm)
  18.102 @@ -393,7 +393,7 @@
  18.103                      as? AccountCell,
  18.104                  let rowVm = section.rows[indexPath.row] as? AccountCellViewModel
  18.105                  else {
  18.106 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
  18.107 +                    Log.shared.errorAndCrash("Invalid state")
  18.108                      return nil
  18.109              }
  18.110              cell.setup(with: rowVm)
  18.111 @@ -404,7 +404,7 @@
  18.112                          as? SubjectCell,
  18.113                      let rowVm = section.rows[indexPath.row] as? SubjectCellViewModel
  18.114                      else {
  18.115 -                        Logger.frontendLogger.errorAndCrash("Invalid state")
  18.116 +                        Log.shared.errorAndCrash("Invalid state")
  18.117                      return nil
  18.118              }
  18.119              cell.setup(with: rowVm)
  18.120 @@ -415,7 +415,7 @@
  18.121                      as? BodyCell,
  18.122                  let rowVm = section.rows[indexPath.row] as? BodyCellViewModel
  18.123                  else {
  18.124 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
  18.125 +                    Log.shared.errorAndCrash("Invalid state")
  18.126                      return nil
  18.127              }
  18.128              cell.setup(with: rowVm)
  18.129 @@ -426,7 +426,7 @@
  18.130                      as? AttachmentCell,
  18.131                  let rowVm = section.rows[indexPath.row] as? AttachmentViewModel
  18.132                  else {
  18.133 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
  18.134 +                    Log.shared.errorAndCrash("Invalid state")
  18.135                      return nil
  18.136              }
  18.137              cell.setup(with: rowVm)
  18.138 @@ -482,7 +482,7 @@
  18.139          let deleteAction = SwipeAction(style: .destructive, title: "Delete") {
  18.140              [weak self] action, indexPath in
  18.141              guard let me = self else {
  18.142 -                Logger.frontendLogger.lostMySelf()
  18.143 +                Log.shared.errorAndCrash("Lost MySelf")
  18.144                  return
  18.145              }
  18.146              me.deleteAction(forCellAt: indexPath)
  18.147 @@ -501,7 +501,7 @@
  18.148              // The last cell is not yet displayed (as we are in "willDisplay ..."), thus async.
  18.149              DispatchQueue.main.async { [weak self] in
  18.150                  guard let me = self else {
  18.151 -                    Logger.frontendLogger.lostMySelf()
  18.152 +                    Log.shared.errorAndCrash("Lost MySelf")
  18.153                      return
  18.154                  }
  18.155                  me.setInitialFocus()
  18.156 @@ -521,7 +521,7 @@
  18.157          }
  18.158          isInitialFocusSet = true
  18.159          guard let vm = viewModel else {
  18.160 -            Logger.frontendLogger.errorAndCrash("No VM")
  18.161 +            Log.shared.errorAndCrash("No VM")
  18.162              return
  18.163          }
  18.164          let idxPath = vm.initialFocus()
  18.165 @@ -535,13 +535,13 @@
  18.166  
  18.167      private func setPreviousFocusAfterPicker() {
  18.168          guard let vm = viewModel else {
  18.169 -            Logger.frontendLogger.errorAndCrash("No VM")
  18.170 +            Log.shared.errorAndCrash("No VM")
  18.171              return
  18.172          }
  18.173          let idxPath = vm.beforePickerFocus()
  18.174          guard let cellToFocus = tableView.cellForRow(at: idxPath)
  18.175              as? TextViewContainingTableViewCell else {
  18.176 -                Logger.frontendLogger.errorAndCrash("Error casting")
  18.177 +                Log.shared.errorAndCrash("Error casting")
  18.178                  return
  18.179          }
  18.180          cellToFocus.setFocus()
  18.181 @@ -549,7 +549,7 @@
  18.182  
  18.183      private func isLastRow(indexPath: IndexPath) -> Bool {
  18.184          guard let vm = viewModel else {
  18.185 -            Logger.frontendLogger.errorAndCrash("No VM")
  18.186 +            Log.shared.errorAndCrash("No VM")
  18.187              return false
  18.188          }
  18.189          let idxLastSection = vm.sections.count - 1
  18.190 @@ -579,14 +579,14 @@
  18.191  
  18.192      private func deleteAction(forAlertController ac: UIAlertController) -> UIAlertAction {
  18.193          guard let vm = viewModel else {
  18.194 -            Logger.frontendLogger.errorAndCrash("No VM")
  18.195 +            Log.shared.errorAndCrash("No VM")
  18.196              return UIAlertAction()
  18.197          }
  18.198          let action: UIAlertAction
  18.199          let text = vm.deleteActionTitle
  18.200          action = ac.action(text, .destructive) {[weak self] in
  18.201              guard let me = self else {
  18.202 -                Logger.frontendLogger.lostMySelf()
  18.203 +                Log.shared.errorAndCrash("Lost MySelf")
  18.204                  return
  18.205              }
  18.206              vm.handleDeleteActionTriggered()
  18.207 @@ -597,14 +597,14 @@
  18.208  
  18.209      private func saveAction(forAlertController ac: UIAlertController) -> UIAlertAction {
  18.210          guard let vm = viewModel else {
  18.211 -            Logger.frontendLogger.errorAndCrash("No VM")
  18.212 +            Log.shared.errorAndCrash("No VM")
  18.213              return UIAlertAction()
  18.214          }
  18.215          let action: UIAlertAction
  18.216          let text = vm.saveActionTitle
  18.217          action = ac.action(text, .default) { [weak self] in
  18.218              guard let me = self else {
  18.219 -                Logger.frontendLogger.lostMySelf()
  18.220 +                Log.shared.errorAndCrash("Lost MySelf")
  18.221                  return
  18.222              }
  18.223              vm.handleSaveActionTriggered()
  18.224 @@ -615,14 +615,14 @@
  18.225  
  18.226      private func keepInOutboxAction(forAlertController ac: UIAlertController) -> UIAlertAction {
  18.227          guard let vm = viewModel else {
  18.228 -            Logger.frontendLogger.errorAndCrash("No VM")
  18.229 +            Log.shared.errorAndCrash("No VM")
  18.230              return UIAlertAction()
  18.231          }
  18.232          let action: UIAlertAction
  18.233          let text = vm.keepInOutboxActionTitle
  18.234          action = ac.action(text, .default) {[weak self] in
  18.235              guard let me = self else {
  18.236 -                Logger.frontendLogger.lostMySelf()
  18.237 +                Log.shared.errorAndCrash("Lost MySelf")
  18.238                  return
  18.239              }
  18.240              me.dismiss()
  18.241 @@ -632,7 +632,7 @@
  18.242  
  18.243      private func cancelAction(forAlertController ac: UIAlertController) -> UIAlertAction {
  18.244          guard let vm = viewModel else {
  18.245 -            Logger.frontendLogger.errorAndCrash("No VM")
  18.246 +            Log.shared.errorAndCrash("No VM")
  18.247              return UIAlertAction()
  18.248          }
  18.249          return ac.action(vm.cancelActionTitle, .cancel)
    19.1 --- a/pEpForiOS/UI/Compose/Util/ComposeUtil.swift	Mon May 06 14:01:07 2019 +0200
    19.2 +++ b/pEpForiOS/UI/Compose/Util/ComposeUtil.swift	Wed May 08 12:31:03 2019 +0200
    19.3 @@ -36,7 +36,7 @@
    19.4                  result = om.to
    19.5              } else if om.parent.folderType != .sent, let omFrom = om.from {
    19.6                  guard let me = initialFrom(composeMode: composeMode, originalMessage: om) else {
    19.7 -                    Logger.utilLogger.errorAndCrash("No from")
    19.8 +                    Log.shared.errorAndCrash("No from")
    19.9                      return result
   19.10                  }
   19.11                  let origTos = om.to
   19.12 @@ -63,7 +63,7 @@
   19.13                  result = om.cc
   19.14              } else {
   19.15                  guard let me = initialFrom(composeMode: composeMode, originalMessage: om) else {
   19.16 -                    Logger.utilLogger.errorAndCrash("No from")
   19.17 +                    Log.shared.errorAndCrash("No from")
   19.18                      return result
   19.19                  }
   19.20                  let origCcs = om.cc
   19.21 @@ -147,12 +147,12 @@
   19.22          withDataFrom state: ComposeViewModel.ComposeViewModelState) -> Message? {
   19.23          guard let from = state.from,
   19.24              let account = Account.by(address: from.address) else {
   19.25 -                Logger.frontendLogger.errorAndCrash(
   19.26 +                Log.shared.errorAndCrash(
   19.27                      "We have a problem here getting the senders account.")
   19.28                  return nil
   19.29          }
   19.30          guard let f = Folder.by(account: account, folderType: .outbox) else {
   19.31 -            Logger.utilLogger.errorAndCrash("No outbox")
   19.32 +            Log.shared.errorAndCrash("No outbox")
   19.33              return nil
   19.34          }
   19.35  
   19.36 @@ -191,7 +191,7 @@
   19.37                                           accordingTo composeState:
   19.38          ComposeViewModel.ComposeViewModelState) {
   19.39          guard let composeMode = composeState.initData?.composeMode else {
   19.40 -            Logger.utilLogger.errorAndCrash("No init data")
   19.41 +            Log.shared.errorAndCrash("No init data")
   19.42              return
   19.43          }
   19.44          if composeMode == .replyFrom || composeMode == .replyAll,
    20.1 --- a/pEpForiOS/UI/Compose/Util/DocumentAttachmentPickerViewController/DocumentAttachmentPickerViewModel.swift	Mon May 06 14:01:07 2019 +0200
    20.2 +++ b/pEpForiOS/UI/Compose/Util/DocumentAttachmentPickerViewController/DocumentAttachmentPickerViewModel.swift	Wed May 08 12:31:03 2019 +0200
    20.3 @@ -31,11 +31,11 @@
    20.4              createAttachment(forSecurityScopedResource: url) {
    20.5                  [weak self] (attachment: Attachment?) in
    20.6                  guard let me = self else {
    20.7 -                    Logger.frontendLogger.lostMySelf()
    20.8 +                    Log.shared.errorAndCrash("Lost MySelf")
    20.9                      return
   20.10                  }
   20.11                  guard let safeAttachment = attachment else {
   20.12 -                    Logger.frontendLogger.errorAndCrash("No attachment")
   20.13 +                    Log.shared.errorAndCrash("No attachment")
   20.14                      return
   20.15                  }
   20.16                  GCD.onMain {
   20.17 @@ -63,7 +63,7 @@
   20.18              CFURLStartAccessingSecurityScopedResource(cfUrl)
   20.19              defer { CFURLStopAccessingSecurityScopedResource(cfUrl) }
   20.20              guard  let resourceData = try? Data(contentsOf: resourceUrl)  else {
   20.21 -                Logger.frontendLogger.errorAndCrash("No data for URL.")
   20.22 +                Log.shared.errorAndCrash("No data for URL.")
   20.23                  completion(nil)
   20.24                  return
   20.25              }
    21.1 --- a/pEpForiOS/UI/Compose/Util/MediaAttachmentPickerProvider/MediaAttachmentPickerProviderViewModel.swift	Mon May 06 14:01:07 2019 +0200
    21.2 +++ b/pEpForiOS/UI/Compose/Util/MediaAttachmentPickerProvider/MediaAttachmentPickerProviderViewModel.swift	Wed May 08 12:31:03 2019 +0200
    21.3 @@ -48,7 +48,7 @@
    21.4          guard
    21.5              let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage,
    21.6              let url = info[UIImagePickerController.InfoKey.referenceURL] as? URL else {
    21.7 -                Logger.frontendLogger.errorAndCrash("No Data")
    21.8 +                Log.shared.errorAndCrash("No Data")
    21.9                  return
   21.10          }
   21.11  
   21.12 @@ -59,17 +59,17 @@
   21.13  
   21.14      private func createMovieAttchmentAndInformResultDelegate(info: [UIImagePickerController.InfoKey: Any]) {
   21.15          guard let url = info[UIImagePickerController.InfoKey.mediaURL] as? URL else {
   21.16 -            Logger.frontendLogger.errorAndCrash("No URL")
   21.17 +            Log.shared.errorAndCrash("No URL")
   21.18              return
   21.19          }
   21.20  
   21.21          createAttachment(forResource: url) {[weak self] (attachment)  in
   21.22              guard let me = self else {
   21.23 -                Logger.frontendLogger.lostMySelf()
   21.24 +                Log.shared.errorAndCrash("Lost MySelf")
   21.25                  return
   21.26              }
   21.27              guard let att = attachment else {
   21.28 -                Logger.frontendLogger.errorAndCrash("No Attachment")
   21.29 +                Log.shared.errorAndCrash("No Attachment")
   21.30                  return
   21.31              }
   21.32              let result = MediaAttachment(type: .movie, attachment: att)
   21.33 @@ -83,11 +83,11 @@
   21.34                                    completion: @escaping (Attachment?) -> Void) {
   21.35          attachmentFileIOQueue.async { [weak self] in
   21.36              guard let me = self else {
   21.37 -                Logger.frontendLogger.lostMySelf()
   21.38 +                Log.shared.errorAndCrash("Lost MySelf")
   21.39                  return
   21.40              }
   21.41              guard let resourceData = try? Data(contentsOf: resourceUrl) else {
   21.42 -                Logger.frontendLogger.errorAndCrash("Cound not get data for URL")
   21.43 +                Log.shared.errorAndCrash("Cound not get data for URL")
   21.44                  completion(nil)
   21.45                  return
   21.46              }
    22.1 --- a/pEpForiOS/UI/Compose/ViewModel/ComposeViewModel+InitData.swift	Mon May 06 14:01:07 2019 +0200
    22.2 +++ b/pEpForiOS/UI/Compose/ViewModel/ComposeViewModel+InitData.swift	Wed May 08 12:31:03 2019 +0200
    22.3 @@ -163,12 +163,12 @@
    22.4          /// Is sutable for isDraftsOrOutbox || composeMode == .forward only.
    22.5          mutating private func setBodyPotetionallyTakingOverAttachments() {
    22.6              guard let msg = originalMessage else {
    22.7 -                Logger.frontendLogger.errorAndCrash("Inconsitant state")
    22.8 +                Log.shared.errorAndCrash("Inconsitant state")
    22.9                  return
   22.10              }
   22.11  
   22.12              guard isDraftsOrOutbox || composeMode == .forward else {
   22.13 -                Logger.frontendLogger.errorAndCrash("Unsupported mode or message")
   22.14 +                Log.shared.errorAndCrash("Unsupported mode or message")
   22.15                  return
   22.16              }
   22.17              if let html = msg.longMessageFormatted {
   22.18 @@ -220,7 +220,7 @@
   22.19          // Assure the image is set.
   22.20          if attachment.image == nil {
   22.21              guard let safeData = attachment.data else {
   22.22 -                Logger.frontendLogger.errorAndCrash("No data")
   22.23 +                Log.shared.errorAndCrash("No data")
   22.24                  return
   22.25              }
   22.26              attachment.image = UIImage(data: safeData)
    23.1 --- a/pEpForiOS/UI/Compose/ViewModel/ComposeViewModel.swift	Mon May 06 14:01:07 2019 +0200
    23.2 +++ b/pEpForiOS/UI/Compose/ViewModel/ComposeViewModel.swift	Wed May 08 12:31:03 2019 +0200
    23.3 @@ -77,7 +77,7 @@
    23.4          guard
    23.5              let vm = bodySection?.rows.first,
    23.6              let body = indexPath(for: vm) else {
    23.7 -                Logger.frontendLogger.errorAndCrash("No body")
    23.8 +                Log.shared.errorAndCrash("No body")
    23.9                  return IndexPath(row: 0, section: 0)
   23.10          }
   23.11          return body
   23.12 @@ -129,12 +129,12 @@
   23.13  
   23.14      public func handleUserClickedSendButton() {
   23.15          guard let msg = ComposeUtil.messageToSend(withDataFrom: state) else {
   23.16 -            Logger.frontendLogger.warn("No message for sending")
   23.17 +            Log.shared.warn("No message for sending")
   23.18              return
   23.19          }
   23.20          msg.save()
   23.21          guard let data = state.initData else {
   23.22 -            Logger.frontendLogger.errorAndCrash("No data")
   23.23 +            Log.shared.errorAndCrash("No data")
   23.24              return
   23.25          }
   23.26          if data.isDraftsOrOutbox {
   23.27 @@ -152,7 +152,7 @@
   23.28  
   23.29      public func handleRemovedRow(at indexPath: IndexPath) {
   23.30          guard let removeeVM = viewModel(for: indexPath) as? AttachmentViewModel else {
   23.31 -                Logger.frontendLogger.errorAndCrash("Only attachmnets can be removed by the user")
   23.32 +                Log.shared.errorAndCrash("Only attachmnets can be removed by the user")
   23.33                  return
   23.34          }
   23.35          removeNonInlinedAttachment(removeeVM.attachment)
   23.36 @@ -160,7 +160,7 @@
   23.37  
   23.38      private func deleteOriginalMessage() {
   23.39          guard let data = state.initData else {
   23.40 -            Logger.frontendLogger.errorAndCrash("No data")
   23.41 +            Log.shared.errorAndCrash("No data")
   23.42              return
   23.43          }
   23.44          guard let om = data.originalMessage else {
   23.45 @@ -183,7 +183,7 @@
   23.46          for section in sections where section.type == .recipients {
   23.47              for row  in section.rows where row is RecipientCellViewModel {
   23.48                  guard let recipientVM = row as? RecipientCellViewModel else {
   23.49 -                    Logger.frontendLogger.errorAndCrash("Cast error")
   23.50 +                    Log.shared.errorAndCrash("Cast error")
   23.51                      return false
   23.52                  }
   23.53                  if recipientVM.isDirty {
   23.54 @@ -362,14 +362,14 @@
   23.55  extension ComposeViewModel {
   23.56      private func removeNonInlinedAttachment(_ removee: Attachment) {
   23.57          guard let section = section(for: .attachments) else {
   23.58 -            Logger.frontendLogger.errorAndCrash("Only attachmnets can be removed by the user")
   23.59 +            Log.shared.errorAndCrash("Only attachmnets can be removed by the user")
   23.60              return
   23.61          }
   23.62          // Remove from section
   23.63          var newAttachmentVMs = [AttachmentViewModel]()
   23.64          for vm in section.rows {
   23.65              guard let aVM = vm as? AttachmentViewModel else {
   23.66 -                Logger.frontendLogger.errorAndCrash("Error casting")
   23.67 +                Log.shared.errorAndCrash("Error casting")
   23.68                  return
   23.69              }
   23.70              if aVM.attachment != removee {
   23.71 @@ -395,7 +395,7 @@
   23.72              existing.rows.append(AttachmentViewModel(attachment: att))
   23.73          } else {
   23.74              guard let new = Section(type: .attachments, for: state, cellVmDelegate: self) else {
   23.75 -                Logger.frontendLogger.errorAndCrash("Invalid state")
   23.76 +                Log.shared.errorAndCrash("Invalid state")
   23.77                  return
   23.78              }
   23.79              sections.append(new)
   23.80 @@ -422,7 +422,7 @@
   23.81              let idxPath = lastRowWithSuggestions,
   23.82              let recipientVM = sections[idxPath.section].rows[idxPath.row] as? RecipientCellViewModel
   23.83              else {
   23.84 -                Logger.frontendLogger.errorAndCrash("No row VM")
   23.85 +                Log.shared.errorAndCrash("No row VM")
   23.86              return
   23.87          }
   23.88          recipientVM.add(recipient: identity)
   23.89 @@ -473,7 +473,7 @@
   23.90          didSelect mediaAttachment: MediaAttachmentPickerProviderViewModel.MediaAttachment) {
   23.91          if mediaAttachment.type == .image {
   23.92              guard let bodyViewModel = bodyVM else {
   23.93 -                Logger.frontendLogger.errorAndCrash("No bodyVM. Maybe valid as picking is async.")
   23.94 +                Log.shared.errorAndCrash("No bodyVM. Maybe valid as picking is async.")
   23.95                  return
   23.96              }
   23.97              bodyViewModel.inline(attachment: mediaAttachment.attachment)
   23.98 @@ -498,7 +498,7 @@
   23.99  
  23.100      public var deleteActionTitle: String {
  23.101          guard let data = state.initData else {
  23.102 -            Logger.frontendLogger.errorAndCrash("No data")
  23.103 +            Log.shared.errorAndCrash("No data")
  23.104              return ""
  23.105          }
  23.106          let title: String
  23.107 @@ -517,7 +517,7 @@
  23.108  
  23.109      public var saveActionTitle: String {
  23.110          guard let data = state.initData else {
  23.111 -            Logger.frontendLogger.errorAndCrash("No data")
  23.112 +            Log.shared.errorAndCrash("No data")
  23.113              return ""
  23.114          }
  23.115          let title: String
  23.116 @@ -541,7 +541,7 @@
  23.117  
  23.118      public func handleDeleteActionTriggered() {
  23.119          guard let data = state.initData else {
  23.120 -            Logger.frontendLogger.errorAndCrash("No data")
  23.121 +            Log.shared.errorAndCrash("No data")
  23.122              return
  23.123          }
  23.124          if data.isOutbox {
  23.125 @@ -552,7 +552,7 @@
  23.126  
  23.127      public func handleSaveActionTriggered() {
  23.128          guard let data = state.initData else {
  23.129 -            Logger.frontendLogger.errorAndCrash("No data")
  23.130 +            Log.shared.errorAndCrash("No data")
  23.131              return
  23.132          }
  23.133          if data.isDraftsOrOutbox {
  23.134 @@ -568,12 +568,12 @@
  23.135          }
  23.136  
  23.137          guard let msg = ComposeUtil.messageToSend(withDataFrom: state) else {
  23.138 -            Logger.frontendLogger.errorAndCrash("No message")
  23.139 +            Log.shared.errorAndCrash("No message")
  23.140              return
  23.141          }
  23.142          let acc = msg.parent.account
  23.143          guard let f = Folder.by(account:acc, folderType: .drafts) else {
  23.144 -            Logger.frontendLogger.errorAndCrash("No drafts")
  23.145 +            Log.shared.errorAndCrash("No drafts")
  23.146              return
  23.147          }
  23.148          msg.parent = f
  23.149 @@ -617,7 +617,7 @@
  23.150  
  23.151      func recipientCellViewModel(_ vm: RecipientCellViewModel, didBeginEditing text: String) {
  23.152          guard let idxPath = indexPath(for: vm) else {
  23.153 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  23.154 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  23.155              return
  23.156          }
  23.157          lastRowWithSuggestions = idxPath
  23.158 @@ -633,7 +633,7 @@
  23.159  
  23.160      func recipientCellViewModel(_ vm: RecipientCellViewModel, textChanged newText: String) {
  23.161          guard let idxPath = indexPath(for: vm) else {
  23.162 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  23.163 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  23.164              return
  23.165          }
  23.166          lastRowWithSuggestions = idxPath
  23.167 @@ -650,7 +650,7 @@
  23.168  extension ComposeViewModel: AccountCellViewModelResultDelegate {
  23.169      func accountCellViewModel(_ vm: AccountCellViewModel, accountChangedTo account: Account) {
  23.170          guard let idxPath = indexPath(for: vm) else {
  23.171 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  23.172 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  23.173              return
  23.174          }
  23.175          state.from = account.user
  23.176 @@ -664,7 +664,7 @@
  23.177  
  23.178      func subjectCellViewModelDidChangeSubject(_ vm: SubjectCellViewModel) {
  23.179          guard let idxPath = indexPath(for: vm) else {
  23.180 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  23.181 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  23.182              return
  23.183          }
  23.184          state.subject = vm.content ?? ""
  23.185 @@ -703,7 +703,7 @@
  23.186          state.bodyHtml = html
  23.187          state.bodyPlaintext = plain
  23.188          guard let idxPath = indexPath(for: vm) else {
  23.189 -            Logger.frontendLogger.errorAndCrash("We got called by a non-existing VM?")
  23.190 +            Log.shared.errorAndCrash("We got called by a non-existing VM?")
  23.191              return
  23.192          }
  23.193          delegate?.contentChanged(inRowAt: idxPath)
    24.1 --- a/pEpForiOS/UI/Compose/ViewModel/ComposeViewModelState.swift	Mon May 06 14:01:07 2019 +0200
    24.2 +++ b/pEpForiOS/UI/Compose/ViewModel/ComposeViewModelState.swift	Wed May 08 12:31:03 2019 +0200
    24.3 @@ -124,7 +124,7 @@
    24.4  
    24.5          private func setup() {
    24.6              guard let initData = initData else {
    24.7 -                Logger.frontendLogger.errorAndCrash("No data")
    24.8 +                Log.shared.errorAndCrash("No data")
    24.9                  return
   24.10              }
   24.11              toRecipients = initData.toRecipients
    25.1 --- a/pEpForiOS/UI/EmailDisplay/Background/AttachmentToLocalURLOperation.swift	Mon May 06 14:01:07 2019 +0200
    25.2 +++ b/pEpForiOS/UI/EmailDisplay/Background/AttachmentToLocalURLOperation.swift	Wed May 08 12:31:03 2019 +0200
    25.3 @@ -21,7 +21,7 @@
    25.4  
    25.5      override func main() {
    25.6          guard let data = attachment.data else {
    25.7 -            Logger.backendLogger.warn("Attachment without data")
    25.8 +            Log.shared.warn("Attachment without data")
    25.9              return
   25.10          }
   25.11          var tmpDirURL: URL?
   25.12 @@ -44,7 +44,7 @@
   25.13              try data.write(to: theURL)
   25.14              fileURL = theURL
   25.15          } catch {
   25.16 -            Logger.backendLogger.log(error: error)
   25.17 +            Log.shared.log(error: error)
   25.18          }
   25.19      }
   25.20  }
    26.1 --- a/pEpForiOS/UI/EmailDisplay/EmailViewController.swift	Mon May 06 14:01:07 2019 +0200
    26.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailViewController.swift	Wed May 08 12:31:03 2019 +0200
    26.3 @@ -186,7 +186,7 @@
    26.4      // Sets the destructive bottom bar item accordint to the message (trash/archive)
    26.5      private func setupDestructiveButtonIcon() {
    26.6          guard let msg = message else {
    26.7 -            Logger.frontendLogger.errorAndCrash("No message")
    26.8 +            Log.shared.errorAndCrash("No message")
    26.9              return
   26.10          }
   26.11  
   26.12 @@ -236,7 +236,7 @@
   26.13              storyboard.instantiateViewController(withIdentifier: SecureWebViewController.storyboardId)
   26.14                  as? SecureWebViewController
   26.15              else {
   26.16 -                Logger.frontendLogger.errorAndCrash("Cast error")
   26.17 +                Log.shared.errorAndCrash("Cast error")
   26.18                  return SecureWebViewController()
   26.19          }
   26.20          vc.zoomingEnabled = true
   26.21 @@ -267,7 +267,7 @@
   26.22  
   26.23      private func setup(contentCell: MessageContentCell, rowData: ComposeFieldModel) {
   26.24          guard let m = message else {
   26.25 -            Logger.frontendLogger.errorAndCrash("No msg.")
   26.26 +            Log.shared.errorAndCrash("No msg.")
   26.27              return
   26.28          }
   26.29          if let htmlBody = htmlBody(message: m) {
   26.30 @@ -329,7 +329,7 @@
   26.31              message = m
   26.32          }
   26.33  
   26.34 -        Logger.frontendLogger.log("next, will reload table view")
   26.35 +        Log.shared.log("next, will reload table view")
   26.36          configureTableRows()
   26.37          tableView.reloadData()
   26.38          configureView()
   26.39 @@ -341,7 +341,7 @@
   26.40              message = m
   26.41          }
   26.42  
   26.43 -        Logger.frontendLogger.log("previous, will reload table view")
   26.44 +        Log.shared.log("previous, will reload table view")
   26.45          configureTableRows()
   26.46          tableView.reloadData()
   26.47          configureView()
   26.48 @@ -353,19 +353,19 @@
   26.49          let alert = ReplyAlertCreator(replyAllChecker: ReplyAllPossibleChecker())
   26.50              .withReplyOption { [weak self] action in
   26.51                  guard let me = self else {
   26.52 -                    Logger.frontendLogger.lostMySelf()
   26.53 +                    Log.shared.errorAndCrash("Lost MySelf")
   26.54                      return
   26.55                  }
   26.56                  me.performSegue(withIdentifier: .segueReplyFrom , sender: self)
   26.57              }.withReplyAllOption(forMessage: message) { [weak self] action in
   26.58                  guard let me = self else {
   26.59 -                    Logger.frontendLogger.lostMySelf()
   26.60 +                    Log.shared.errorAndCrash("Lost MySelf")
   26.61                      return
   26.62                  }
   26.63                  me.performSegue(withIdentifier: .segueReplyAllForm , sender: self)
   26.64              }.withFordwardOption { [weak self] action in
   26.65                  guard let me = self else {
   26.66 -                    Logger.frontendLogger.lostMySelf()
   26.67 +                    Log.shared.errorAndCrash("Lost MySelf")
   26.68                      return
   26.69                  }
   26.70                  me.performSegue(withIdentifier: .segueForward , sender: self)
   26.71 @@ -463,7 +463,7 @@
   26.72  
   26.73      override func tableView(
   26.74          _ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   26.75 -        Logger.frontendLogger.log("cell for %d:%d", indexPath.section, indexPath.row)
   26.76 +        Log.shared.log("cell for %d:%d", indexPath.section, indexPath.row)
   26.77          guard
   26.78              let row = tableData?.getRow(at: indexPath.row),
   26.79              let cell = tableView.dequeueReusableCell(
   26.80 @@ -485,7 +485,7 @@
   26.81          _ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
   26.82          guard
   26.83              let row = tableData?.getRow(at: indexPath.row) else {
   26.84 -                Logger.frontendLogger.errorAndCrash("Missing data")
   26.85 +                Log.shared.errorAndCrash("Missing data")
   26.86                  return tableView.estimatedRowHeight
   26.87          }
   26.88  
   26.89 @@ -525,7 +525,7 @@
   26.90          case .segueReplyFrom, .segueReplyAllForm, .segueForward:
   26.91              guard  let nav = segue.destination as? UINavigationController,
   26.92                  let destination = nav.topViewController as? ComposeTableViewController else {
   26.93 -                    Logger.frontendLogger.errorAndCrash("No DVC?")
   26.94 +                    Log.shared.errorAndCrash("No DVC?")
   26.95                      break
   26.96              }
   26.97              destination.appConfig = appConfig
   26.98 @@ -536,7 +536,7 @@
   26.99          case .segueShowMoveToFolder:
  26.100              guard  let nav = segue.destination as? UINavigationController,
  26.101                  let destination = nav.topViewController as? MoveToAccountViewController else {
  26.102 -                    Logger.frontendLogger.errorAndCrash("No DVC?")
  26.103 +                    Log.shared.errorAndCrash("No DVC?")
  26.104                      break
  26.105              }
  26.106              destination.appConfig = appConfig
  26.107 @@ -549,7 +549,7 @@
  26.108              guard let nv = segue.destination as? UINavigationController,
  26.109                  let vc = nv.topViewController as? HandshakeViewController,
  26.110                  let titleView = navigationItem.titleView else {
  26.111 -                Logger.frontendLogger.errorAndCrash("No DVC?")
  26.112 +                Log.shared.errorAndCrash("No DVC?")
  26.113                  break
  26.114              }
  26.115  
  26.116 @@ -576,7 +576,7 @@
  26.117          } else if segueId == .segueForward {
  26.118              return  .forward
  26.119          } else {
  26.120 -            Logger.frontendLogger.errorAndCrash("Unsupported input")
  26.121 +            Log.shared.errorAndCrash("Unsupported input")
  26.122              return .replyFrom
  26.123          }
  26.124      }
    27.1 --- a/pEpForiOS/UI/EmailDisplay/Stuff that is named Compose but is used only in EmailView/ComposeDataSource.swift	Mon May 06 14:01:07 2019 +0200
    27.2 +++ b/pEpForiOS/UI/EmailDisplay/Stuff that is named Compose but is used only in EmailView/ComposeDataSource.swift	Wed May 08 12:31:03 2019 +0200
    27.3 @@ -40,12 +40,12 @@
    27.4          } else {
    27.5              filterRows(filter: { $0.type != .mailingList} )
    27.6          }
    27.7 -        Logger.frontendLogger.log("filtering rows")
    27.8 +        Log.shared.log("filtering rows")
    27.9      }
   27.10  
   27.11      func numberOfRows() -> Int {
   27.12          let visibleRows = getVisibleRows()
   27.13 -        Logger.frontendLogger.log("number of rows -> %d", visibleRows.count)
   27.14 +        Log.shared.log("number of rows -> %d", visibleRows.count)
   27.15          return visibleRows.count
   27.16      }
   27.17  
   27.18 @@ -74,7 +74,7 @@
   27.19  
   27.20          subscript(index: Int) -> Row? {
   27.21              if index < 0 || index > (attachments.count - 1) {
   27.22 -                Logger.frontendLogger.errorAndCrash("Index out of bounds")
   27.23 +                Log.shared.errorAndCrash("Index out of bounds")
   27.24                  return nil
   27.25              }
   27.26              let attachment = attachments[index]
   27.27 @@ -115,7 +115,7 @@
   27.28  
   27.29          mutating func remove(at index: Int) {
   27.30              if index < 0 || index > (attachments.count - 1) {
   27.31 -                Logger.frontendLogger.errorAndCrash("Index out of bounds")
   27.32 +                Log.shared.errorAndCrash("Index out of bounds")
   27.33                  return
   27.34              }
   27.35              attachments.remove(at: index)
    28.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Mon May 06 14:01:07 2019 +0200
    28.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Wed May 08 12:31:03 2019 +0200
    28.3 @@ -202,7 +202,7 @@
    28.4          }
    28.5          if splitViewController.isCollapsed {
    28.6              guard let vm = model else {
    28.7 -                Logger.frontendLogger.errorAndCrash("Invalid state")
    28.8 +                Log.shared.errorAndCrash("Invalid state")
    28.9                  return
   28.10              }
   28.11              let unreadFilterActive = vm.unreadFilterEnabled()
   28.12 @@ -422,7 +422,7 @@
   28.13      
   28.14      @IBAction func filterButtonHasBeenPressed(_ sender: UIBarButtonItem) {
   28.15          guard let vm = model else {
   28.16 -            Logger.frontendLogger.errorAndCrash("We should have a model here")
   28.17 +            Log.shared.errorAndCrash("We should have a model here")
   28.18              return
   28.19          }
   28.20          vm.isFilterEnabled = !vm.isFilterEnabled
   28.21 @@ -443,7 +443,7 @@
   28.22  
   28.23      private func updateFilterButtonView() {
   28.24          guard let vm = model else {
   28.25 -            Logger.frontendLogger.errorAndCrash("We should have a model here")
   28.26 +            Log.shared.errorAndCrash("We should have a model here")
   28.27              return
   28.28          }
   28.29  
   28.30 @@ -489,7 +489,7 @@
   28.31              }
   28.32              theCell.configure(for:viewModel)
   28.33          } else {
   28.34 -            Logger.frontendLogger.errorAndCrash("dequeued wrong cell")
   28.35 +            Log.shared.errorAndCrash("dequeued wrong cell")
   28.36          }
   28.37  
   28.38          return cell
   28.39 @@ -509,7 +509,7 @@
   28.40          var swipeActions = [SwipeAction]()
   28.41  
   28.42          guard let model = model else {
   28.43 -            Logger.frontendLogger.errorAndCrash("Should have VM")
   28.44 +            Log.shared.errorAndCrash("Should have VM")
   28.45              return nil
   28.46          }
   28.47  
   28.48 @@ -520,7 +520,7 @@
   28.49                          title: destructiveAction.title(forDisplayMode: .titleAndImage)) {
   28.50                  [weak self] action, indexPath in
   28.51                  guard let me = self else {
   28.52 -                    Logger.frontendLogger.lostMySelf()
   28.53 +                    Log.shared.errorAndCrash("Lost MySelf")
   28.54                      return
   28.55                  }
   28.56  
   28.57 @@ -536,7 +536,7 @@
   28.58              let flagAction = SwipeAction(style: .default, title: "Flag") {
   28.59                  [weak self] action, indexPath in
   28.60                  guard let me = self else {
   28.61 -                    Logger.frontendLogger.lostMySelf()
   28.62 +                    Log.shared.errorAndCrash("Lost MySelf")
   28.63                      return
   28.64                  }
   28.65                  me.flagAction(forCellAt: indexPath)
   28.66 @@ -556,7 +556,7 @@
   28.67              let moreAction = SwipeAction(style: .default, title: "More") {
   28.68                  [weak self] action, indexPath in
   28.69                  guard let me = self else {
   28.70 -                    Logger.frontendLogger.lostMySelf()
   28.71 +                    Log.shared.errorAndCrash("Lost MySelf")
   28.72                      return
   28.73                  }
   28.74                  me.moreAction(forCellAt: indexPath)
   28.75 @@ -592,7 +592,7 @@
   28.76              }
   28.77          } else {
   28.78              guard let model = model else {
   28.79 -                Logger.frontendLogger.errorAndCrash("No folder")
   28.80 +                Log.shared.errorAndCrash("No folder")
   28.81                  return
   28.82              }
   28.83              lastSelectedIndexPath = indexPath
   28.84 @@ -620,7 +620,7 @@
   28.85      override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell,
   28.86                              forRowAt indexPath: IndexPath) {
   28.87          guard let vm = model else {
   28.88 -            Logger.frontendLogger.errorAndCrash("No model.")
   28.89 +            Log.shared.errorAndCrash("No model.")
   28.90              return
   28.91          }
   28.92          vm.fetchOlderMessagesIfRequired(forIndexPath: indexPath)
   28.93 @@ -663,7 +663,7 @@
   28.94  
   28.95      func didDismissSearchController(_ searchController: UISearchController) {
   28.96          guard let vm = model else {
   28.97 -            Logger.frontendLogger.errorAndCrash("No chance to remove filter, sorry.")
   28.98 +            Log.shared.errorAndCrash("No chance to remove filter, sorry.")
   28.99              return
  28.100          }
  28.101          vm.removeSearchFilter()
  28.102 @@ -687,7 +687,7 @@
  28.103                  storyboard.instantiateViewController(withIdentifier: "threadViewController")
  28.104                      as? ThreadViewController
  28.105                  else {
  28.106 -                    Logger.frontendLogger.errorAndCrash("Segue issue")
  28.107 +                    Log.shared.errorAndCrash("Segue issue")
  28.108                      return
  28.109              }
  28.110  
  28.111 @@ -783,7 +783,7 @@
  28.112      func emailListViewModel(viewModel: EmailListViewModel,
  28.113                              didChangeSeenStateForDataAt indexPaths: [IndexPath]) {
  28.114          guard let isIphone = splitViewController?.isCollapsed, let vm = model else {
  28.115 -            Logger.frontendLogger.errorAndCrash("Invalid state")
  28.116 +            Log.shared.errorAndCrash("Invalid state")
  28.117              return
  28.118          }
  28.119  
  28.120 @@ -861,7 +861,7 @@
  28.121          let title = NSLocalizedString("Move to Folder", comment: "EmailList action title")
  28.122          return UIAlertAction(title: title, style: .default) { [weak self] action in
  28.123              guard let me = self else {
  28.124 -                Logger.frontendLogger.lostMySelf()
  28.125 +                Log.shared.errorAndCrash("Lost MySelf")
  28.126                  return
  28.127              }
  28.128              me.performSegue(withIdentifier: .segueShowMoveToFolder, sender: me)
  28.129 @@ -873,7 +873,7 @@
  28.130          return  UIAlertAction(title: title, style: .cancel) {
  28.131              [weak self] action in
  28.132              guard let me = self else {
  28.133 -                Logger.frontendLogger.lostMySelf()
  28.134 +                Log.shared.errorAndCrash("Lost MySelf")
  28.135                  return
  28.136              }
  28.137              me.tableView.beginUpdates()
  28.138 @@ -887,7 +887,7 @@
  28.139          return UIAlertAction(title: title, style: .default) {
  28.140              [weak self] action in
  28.141              guard let me = self else {
  28.142 -                Logger.frontendLogger.lostMySelf()
  28.143 +                Log.shared.errorAndCrash("Lost MySelf")
  28.144                  return
  28.145              }
  28.146              me.performSegue(withIdentifier: .segueReply, sender: me)
  28.147 @@ -900,7 +900,7 @@
  28.148              return UIAlertAction(title: title, style: .default) {
  28.149                  [weak self] action in
  28.150                  guard let me = self else {
  28.151 -                    Logger.frontendLogger.lostMySelf()
  28.152 +                    Log.shared.errorAndCrash("Lost MySelf")
  28.153                      return
  28.154                  }
  28.155                  me.performSegue(withIdentifier: .segueReplyAll, sender: me)
  28.156 @@ -915,7 +915,7 @@
  28.157          return UIAlertAction(title: title, style: .default) {
  28.158              [weak self] action in
  28.159              guard let me = self else {
  28.160 -                Logger.frontendLogger.lostMySelf()
  28.161 +                Log.shared.errorAndCrash("Lost MySelf")
  28.162                  return
  28.163              }
  28.164              me.performSegue(withIdentifier: .segueForward, sender: me)
  28.165 @@ -939,11 +939,11 @@
  28.166  
  28.167      func flagAction(forCellAt indexPath: IndexPath) {
  28.168          guard let row = model?.viewModel(for: indexPath.row) else {
  28.169 -            Logger.frontendLogger.errorAndCrash("No data for indexPath!")
  28.170 +            Log.shared.errorAndCrash("No data for indexPath!")
  28.171              return
  28.172          }
  28.173          guard let cell = self.tableView.cellForRow(at: indexPath) as? EmailListViewCell else {
  28.174 -            Logger.frontendLogger.errorAndCrash("No cell for indexPath!")
  28.175 +            Log.shared.errorAndCrash("No cell for indexPath!")
  28.176              return
  28.177          }
  28.178          if row.isFlagged {
  28.179 @@ -1013,7 +1013,7 @@
  28.180                  let vc = nav.rootViewController as? EmailViewController,
  28.181                  let indexPath = lastSelectedIndexPath,
  28.182                  let message = model?.message(representedByRowAt: indexPath) else {
  28.183 -                    Logger.frontendLogger.errorAndCrash("Segue issue")
  28.184 +                    Log.shared.errorAndCrash("Segue issue")
  28.185                      return
  28.186              }
  28.187              vc.appConfig = appConfig
  28.188 @@ -1030,7 +1030,7 @@
  28.189                      return
  28.190              }
  28.191              guard let message = model?.message(representedByRowAt: indexPath) else {
  28.192 -                Logger.frontendLogger.errorAndCrash("Segue issue")
  28.193 +                Log.shared.errorAndCrash("Segue issue")
  28.194                  return
  28.195              }
  28.196              vc.appConfig = appConfig
  28.197 @@ -1041,7 +1041,7 @@
  28.198              model?.updateThreadListDelegate = viewModel*/
  28.199          case .segueShowFilter:
  28.200              guard let destiny = segue.destination as? FilterTableViewController  else {
  28.201 -                Logger.frontendLogger.errorAndCrash("Segue issue")
  28.202 +                Log.shared.errorAndCrash("Segue issue")
  28.203                  return
  28.204              }
  28.205              destiny.appConfig = appConfig
  28.206 @@ -1053,7 +1053,7 @@
  28.207              guard
  28.208                  let nav = segue.destination as? UINavigationController,
  28.209                  let vc = nav.rootViewController as? LoginViewController else {
  28.210 -                    Logger.frontendLogger.errorAndCrash("Segue issue")
  28.211 +                    Log.shared.errorAndCrash("Segue issue")
  28.212                      return
  28.213              }
  28.214              vc.appConfig = appConfig
  28.215 @@ -1062,7 +1062,7 @@
  28.216              break
  28.217          case .segueFolderViews:
  28.218              guard let vC = segue.destination as? FolderTableViewController  else {
  28.219 -                Logger.frontendLogger.errorAndCrash("Segue issue")
  28.220 +                Log.shared.errorAndCrash("Segue issue")
  28.221                  return
  28.222              }
  28.223              vC.appConfig = appConfig
  28.224 @@ -1080,7 +1080,7 @@
  28.225              guard  let nav = segue.destination as? UINavigationController,
  28.226                  let destination = nav.topViewController as? MoveToAccountViewController
  28.227                  else {
  28.228 -                    Logger.frontendLogger.errorAndCrash("No DVC?")
  28.229 +                    Log.shared.errorAndCrash("No DVC?")
  28.230                      break
  28.231              }
  28.232  
  28.233 @@ -1093,7 +1093,7 @@
  28.234              //No initialization needed
  28.235              break
  28.236          default:
  28.237 -            Logger.frontendLogger.errorAndCrash("Unhandled segue")
  28.238 +            Log.shared.errorAndCrash("Unhandled segue")
  28.239              break
  28.240          }
  28.241      }
  28.242 @@ -1109,7 +1109,7 @@
  28.243              let composeVc = nav.topViewController as? ComposeTableViewController,
  28.244              let composeMode = composeMode(for: segueId),
  28.245              let vm = model else {
  28.246 -                Logger.frontendLogger.errorAndCrash("composeViewController setup issue")
  28.247 +                Log.shared.errorAndCrash("composeViewController setup issue")
  28.248                  return
  28.249          }
  28.250          composeVc.appConfig = appConfig
  28.251 @@ -1118,7 +1118,7 @@
  28.252              // This is not a simple compose (but reply, forward or such),
  28.253              // thus we have to pass the original message.
  28.254              guard let indexPath = lastSelectedIndexPath else {
  28.255 -                    Logger.frontendLogger.errorAndCrash("Invalid state")
  28.256 +                    Log.shared.errorAndCrash("Invalid state")
  28.257                      return
  28.258              }
  28.259  
    29.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewModel+EmailDisplayDelegate.swift	Mon May 06 14:01:07 2019 +0200
    29.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewModel+EmailDisplayDelegate.swift	Wed May 08 12:31:03 2019 +0200
    29.3 @@ -23,7 +23,7 @@
    29.4  
    29.5          MessageModelUtil.performAndWait { [weak self] in
    29.6              guard let me = self else {
    29.7 -                Logger.frontendLogger.lostMySelf()
    29.8 +                Log.shared.errorAndCrash("Lost MySelf")
    29.9                  return
   29.10              }
   29.11              me.didDelete(message: message)
    30.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewModel+MessageFolderDelegate.swift	Mon May 06 14:01:07 2019 +0200
    30.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewModel+MessageFolderDelegate.swift	Wed May 08 12:31:03 2019 +0200
    30.3 @@ -17,7 +17,7 @@
    30.4      func didCreate(message: Message) {
    30.5          DispatchQueue.main.async { [weak self] in
    30.6              guard let me = self else {
    30.7 -                Logger.frontendLogger.lostMySelf()
    30.8 +                Log.shared.errorAndCrash("Lost MySelf")
    30.9                  return
   30.10              }
   30.11              me.didCreateInternal(message: message)
   30.12 @@ -27,7 +27,7 @@
   30.13      func didUpdate(message: Message) {
   30.14          DispatchQueue.main.async { [weak self] in
   30.15              guard let me = self else {
   30.16 -                Logger.frontendLogger.lostMySelf()
   30.17 +                Log.shared.errorAndCrash("Lost MySelf")
   30.18                  return
   30.19              }
   30.20              me.didUpdateInternal(message: message)
   30.21 @@ -37,7 +37,7 @@
   30.22      func didDelete(message: Message) {
   30.23          DispatchQueue.main.async { [weak self] in
   30.24              guard let me = self else {
   30.25 -                Logger.frontendLogger.lostMySelf()
   30.26 +                Log.shared.errorAndCrash("Lost MySelf")
   30.27                  return
   30.28              }
   30.29              me.didDeleteInternal(message: message)
   30.30 @@ -140,7 +140,7 @@
   30.31  
   30.32          // We do have this message in our (top message) model, so we do have to update it
   30.33          guard let existingMessage = messages.object(at: indexExisting) else {
   30.34 -            Logger.frontendLogger.errorAndCrash(
   30.35 +            Log.shared.errorAndCrash(
   30.36                  "We should have the message at this point")
   30.37              return
   30.38          }
   30.39 @@ -193,7 +193,7 @@
   30.40          // The updated message has to be shown. Add it to the model ...
   30.41          let indexInserted = me.messages.insert(object: previewMessage)
   30.42          if indexExisting != indexInserted {
   30.43 -            Logger.frontendLogger.warn(
   30.44 +            Log.shared.warn(
   30.45                  "When updating a message, the the new index of the message must be the same as the old index. Something is fishy here."
   30.46              )
   30.47          }
    31.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Mon May 06 14:01:07 2019 +0200
    31.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewModel.swift	Wed May 08 12:31:03 2019 +0200
    31.3 @@ -165,7 +165,7 @@
    31.4  
    31.5      func viewModel(for index: Int) -> MessageViewModel? {
    31.6          guard let messageViewModel = messages.object(at: index) else {
    31.7 -            Logger.frontendLogger.errorAndCrash("InconsistencyviewModel vs. model")
    31.8 +            Log.shared.errorAndCrash("InconsistencyviewModel vs. model")
    31.9              return nil
   31.10          }
   31.11          return messageViewModel
   31.12 @@ -283,7 +283,7 @@
   31.13  
   31.14          for pvm in deletees {
   31.15              guard let message = pvm.message() else {
   31.16 -                Logger.frontendLogger.errorAndCrash("No mesage")
   31.17 +                Log.shared.errorAndCrash("No mesage")
   31.18                  return
   31.19              }
   31.20              delete(message: message)
   31.21 @@ -334,7 +334,7 @@
   31.22  
   31.23      func delete(forIndexPath indexPath: IndexPath) {
   31.24          guard let deletedMessage = deleteMessage(at: indexPath) else {
   31.25 -            Logger.frontendLogger.errorAndCrash(
   31.26 +            Log.shared.errorAndCrash(
   31.27                  "Not sure if this is a valid case. Remove this log if so.")
   31.28              return
   31.29          }
   31.30 @@ -442,7 +442,7 @@
   31.31          if folderToShow is UnifiedInbox {
   31.32              // folderToShow is unified inbox, fetch parent folder from DB.
   31.33              guard let folder = messages.object(at: index)?.message()?.parent else {
   31.34 -                    Logger.frontendLogger.errorAndCrash("Dangling Message")
   31.35 +                    Log.shared.errorAndCrash("Dangling Message")
   31.36                      return folderToShow
   31.37              }
   31.38              parentFolder = folder
   31.39 @@ -555,7 +555,7 @@
   31.40  
   31.41      public func removeSearchFilter() {
   31.42          guard let filter = folderToShow.filter else {
   31.43 -            Logger.frontendLogger.errorAndCrash("No folder.")
   31.44 +            Log.shared.errorAndCrash("No folder.")
   31.45              return
   31.46          }
   31.47          let filtersChanged = filter.removeSearchFilter()
   31.48 @@ -570,7 +570,7 @@
   31.49          }
   31.50  
   31.51          guard let folderFilter = folderToShow.filter else {
   31.52 -            Logger.frontendLogger.errorAndCrash("We just set the filter but do not have one?")
   31.53 +            Log.shared.errorAndCrash("We just set the filter but do not have one?")
   31.54              return CompositeFilter<FilterBase>.defaultFilter()
   31.55          }
   31.56          return folderFilter
   31.57 @@ -580,7 +580,7 @@
   31.58  
   31.59      func folderIsDraft(_ parentFolder: Folder?) -> Bool {
   31.60          guard let folder = parentFolder else {
   31.61 -            Logger.frontendLogger.errorAndCrash("No parent.")
   31.62 +            Log.shared.errorAndCrash("No parent.")
   31.63              return false
   31.64          }
   31.65          return folder.folderType == .drafts
   31.66 @@ -588,7 +588,7 @@
   31.67  
   31.68      func folderIsOutbox(_ parentFolder: Folder?) -> Bool {
   31.69          guard let folder = parentFolder else {
   31.70 -            Logger.frontendLogger.errorAndCrash("No parent.")
   31.71 +            Log.shared.errorAndCrash("No parent.")
   31.72              return false
   31.73          }
   31.74          return folder.folderType == .outbox
    32.1 --- a/pEpForiOS/UI/Filter/ViewModel/FilterViewModel.swift	Mon May 06 14:01:07 2019 +0200
    32.2 +++ b/pEpForiOS/UI/Filter/ViewModel/FilterViewModel.swift	Wed May 08 12:31:03 2019 +0200
    32.3 @@ -46,7 +46,7 @@
    32.4          case .accouts:
    32.5              for account in Account.all() {
    32.6                  guard let icon = UIImage(named: "folders-icon-inbox") else {
    32.7 -                    Logger.frontendLogger.errorAndCrash("Error Loading images")
    32.8 +                    Log.shared.errorAndCrash("Error Loading images")
    32.9                      return
   32.10                  }
   32.11                  items.append(
   32.12 @@ -59,7 +59,7 @@
   32.13              break
   32.14          case .include:
   32.15              guard let unreadIcon = UIImage(named: "icon-unread") else {
   32.16 -                Logger.frontendLogger.errorAndCrash("Error Loading images")
   32.17 +                Log.shared.errorAndCrash("Error Loading images")
   32.18                  return
   32.19              }
   32.20              items.append(
   32.21 @@ -70,7 +70,7 @@
   32.22                                      filter: UnreadFilter()))
   32.23  
   32.24              guard let flaggedIcon = UIImage(named: "icon-flagged") else {
   32.25 -                Logger.frontendLogger.errorAndCrash("Error Loading images")
   32.26 +                Log.shared.errorAndCrash("Error Loading images")
   32.27                  return
   32.28              }
   32.29              items.append(
   32.30 @@ -82,7 +82,7 @@
   32.31              break
   32.32          case .other:
   32.33              guard let attachIcon = UIImage(named: "attachment-list-icon") else {
   32.34 -                Logger.frontendLogger.errorAndCrash("Error Loading images")
   32.35 +                Log.shared.errorAndCrash("Error Loading images")
   32.36                  return
   32.37              }
   32.38              items.append(
    33.1 --- a/pEpForiOS/UI/Folder/FolderTableViewController.swift	Mon May 06 14:01:07 2019 +0200
    33.2 +++ b/pEpForiOS/UI/Folder/FolderTableViewController.swift	Wed May 08 12:31:03 2019 +0200
    33.3 @@ -108,7 +108,7 @@
    33.4              header = CollapsibleTableViewHeader(reuseIdentifier: "header")
    33.5          }
    33.6          guard let vm = folderVM, let safeHeader = header else {
    33.7 -            Logger.frontendLogger.errorAndCrash("No header or no model.")
    33.8 +            Log.shared.errorAndCrash("No header or no model.")
    33.9              return header
   33.10          }
   33.11  
   33.12 @@ -127,7 +127,7 @@
   33.13      }
   33.14      override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
   33.15          guard let vm = folderVM else {
   33.16 -            Logger.frontendLogger.errorAndCrash("No model.")
   33.17 +            Log.shared.errorAndCrash("No model.")
   33.18              return 0.0
   33.19          }
   33.20          if vm[section].hidden {
   33.21 @@ -141,7 +141,7 @@
   33.22                              cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   33.23          let cell = tableView.dequeueReusableCell(withIdentifier: "Default", for: indexPath)
   33.24          guard let vm = folderVM else {
   33.25 -            Logger.frontendLogger.errorAndCrash("No model")
   33.26 +            Log.shared.errorAndCrash("No model")
   33.27              return cell
   33.28          }
   33.29          let fcvm = vm[indexPath.section][indexPath.item]
   33.30 @@ -160,7 +160,7 @@
   33.31      override func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath)
   33.32          -> Int {
   33.33              guard let vm = folderVM else {
   33.34 -                Logger.frontendLogger.errorAndCrash("No model")
   33.35 +                Log.shared.errorAndCrash("No model")
   33.36                  return 0
   33.37              }
   33.38          return vm[indexPath.section][indexPath.item].level - 1
   33.39 @@ -170,7 +170,7 @@
   33.40  
   33.41      override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
   33.42          guard let folderViewModel = folderVM else {
   33.43 -            Logger.frontendLogger.errorAndCrash("No model")
   33.44 +            Log.shared.errorAndCrash("No model")
   33.45              return
   33.46          }
   33.47          let cellViewModel = folderViewModel[indexPath.section][indexPath.row]
   33.48 @@ -189,7 +189,7 @@
   33.49              let vc = sb.instantiateViewController(
   33.50                  withIdentifier: EmailListViewController.storyboardId)
   33.51                  as? EmailListViewController else {
   33.52 -                    Logger.frontendLogger.errorAndCrash("Problem!")
   33.53 +                    Log.shared.errorAndCrash("Problem!")
   33.54                      return
   33.55          }
   33.56          vc.appConfig = appConfig
   33.57 @@ -214,7 +214,7 @@
   33.58              guard
   33.59                  let nav = segue.destination as? UINavigationController,
   33.60                  let vc = nav.rootViewController as? LoginViewController else {
   33.61 -                    Logger.frontendLogger.errorAndCrash("Missing VCs")
   33.62 +                    Log.shared.errorAndCrash("Missing VCs")
   33.63                      return
   33.64              }
   33.65              vc.appConfig = self.appConfig
   33.66 @@ -223,7 +223,7 @@
   33.67  
   33.68          } else if segue.identifier == "SettingsSegue" {
   33.69              guard let dvc = segue.destination as? SettingsTableViewController else {
   33.70 -                Logger.frontendLogger.errorAndCrash("Error casting DVC")
   33.71 +                Log.shared.errorAndCrash("Error casting DVC")
   33.72                  return
   33.73              }
   33.74              dvc.appConfig = self.appConfig
    34.1 --- a/pEpForiOS/UI/Folder/ViewModel/FolderSectionViewModel.swift	Mon May 06 14:01:07 2019 +0200
    34.2 +++ b/pEpForiOS/UI/Folder/ViewModel/FolderSectionViewModel.swift	Wed May 08 12:31:03 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          if let cachedContactImage = contactImageTool.cachedIdentityImage(for: ac.user) {
    35.1 --- a/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Mon May 06 14:01:07 2019 +0200
    35.2 +++ b/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    36.2 +++ b/pEpForiOS/UI/Handshake/ViewModel/HandshakePartnerTableViewCellViewModel.swift	Wed May 08 12:31:03 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 @@ -149,7 +149,7 @@
   36.13                  language: trustwordsLanguage,
   36.14                  full: trustwordsFull)
   36.15          } catch let err as NSError {
   36.16 -            Logger.frontendLogger.error("%{public}@", err.localizedDescription)
   36.17 +            Log.shared.error("%{public}@", err.localizedDescription)
   36.18              return nil
   36.19          }
   36.20      }
    37.1 --- a/pEpForiOS/UI/Login/LoginViewController.swift	Mon May 06 14:01:07 2019 +0200
    37.2 +++ b/pEpForiOS/UI/Login/LoginViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    38.2 +++ b/pEpForiOS/UI/Login/ViewModel/LoginViewModel.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    39.2 +++ b/pEpForiOS/UI/ManualLogin/SMTPSetup/SMTPSettingsTableViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    40.2 +++ b/pEpForiOS/UI/MoveToFolder/ViewModel/MoveToFolderViewModel.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    41.2 +++ b/pEpForiOS/UI/Settings/Setting/AccountSettings/AccountSettingsTableViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    42.2 +++ b/pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift	Wed May 08 12:31:03 2019 +0200
    42.3 @@ -158,7 +158,7 @@
    42.4          guard let viewModelPort = viewModel.port,
    42.5              let port = UInt16(viewModelPort),
    42.6              let address = viewModel.address 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          let transport = Server.Transport(fromString: viewModel.transport)
   42.12 @@ -201,7 +201,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 @@ -218,8 +218,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 @@ -229,8 +228,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	Mon May 06 14:01:07 2019 +0200
    43.2 +++ b/pEpForiOS/UI/Settings/Setting/LogViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    44.2 +++ b/pEpForiOS/UI/Settings/Setting/TrustedServerSetting/TrustedServerSettingsViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    45.2 +++ b/pEpForiOS/UI/Settings/Setting/TrustedServerSetting/TrustedServerSettingsViewModel.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    46.2 +++ b/pEpForiOS/UI/Settings/SettingsTableViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    47.2 +++ b/pEpForiOS/UI/Settings/ViewModel/SettingsCellViewModel.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    48.2 +++ b/pEpForiOS/UI/SplitView/PrimarySplitViewcontroller+ScreenComposerProtocol.swift	Wed May 08 12:31:03 2019 +0200
    48.3 @@ -26,7 +26,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 @@ -53,7 +53,7 @@
   48.13                  as? EmailViewController,
   48.14              let index = emailListViewModel.index(of: message)
   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	Mon May 06 14:01:07 2019 +0200
    49.2 +++ b/pEpForiOS/UI/Thread/Cells/FullMessageCell.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    50.2 +++ b/pEpForiOS/UI/Thread/ThreadViewController+SegueHandlerType.swift	Wed May 08 12:31:03 2019 +0200
    50.3 @@ -28,7 +28,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 @@ -41,7 +41,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 @@ -54,7 +54,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	Mon May 06 14:01:07 2019 +0200
    51.2 +++ b/pEpForiOS/UI/Thread/ThreadViewController.swift	Wed May 08 12:31:03 2019 +0200
    51.3 @@ -65,7 +65,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	Mon May 06 14:01:07 2019 +0200
    52.2 +++ b/pEpForiOS/UI/Util/AddToContactsViewController/AddToContactsViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    53.2 +++ b/pEpForiOS/UI/Util/BaseTableViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    54.2 +++ b/pEpForiOS/UI/Util/BaseViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    55.2 +++ b/pEpForiOS/UI/Util/Extensions/UIView+Autolayout.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    56.2 +++ b/pEpForiOS/UI/Util/InfoPlist.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    57.2 +++ b/pEpForiOS/UI/Util/SecureWebViewController/CidHandler.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    58.2 +++ b/pEpForiOS/UI/Util/SecureWebViewController/SecureWebViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    59.2 +++ b/pEpForiOS/UI/Util/SuggestTableViewController/SuggestTableViewController.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    60.2 +++ b/pEpForiOS/UI/Util/SuggestTableViewController/SuggestViewModel.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    61.2 +++ b/pEpForiOS/UI/Util/UIUtils.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    62.2 +++ b/pEpForiOS/Util/DebugMergePolicy.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    63.2 +++ b/pEpForiOS/Util/Extensions/ConnectionTransport+AccountSettings.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    64.2 +++ b/pEpForiOS/Util/Extensions/PEP_rating+Extension.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 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	Mon May 06 14:01:07 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	Mon May 06 14:01:07 2019 +0200
    67.2 +++ b/pEpForiOS/Util/ReferenceCounter.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    68.2 +++ b/pEpForiOS/Util/UserNotificationTool.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    69.2 +++ b/subModules/pEpIOSToolbox/pEpIOSToolbox.xcodeproj/project.pbxproj	Wed May 08 12:31:03 2019 +0200
    69.3 @@ -15,6 +15,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 @@ -64,6 +65,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 @@ -167,6 +169,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 @@ -221,6 +231,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 @@ -372,6 +383,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	Mon May 06 14:01:07 2019 +0200
    70.2 +++ b/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/Data+Extensions.swift	Wed May 08 12:31:03 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	Mon May 06 14:01:07 2019 +0200
    71.2 +++ b/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/String+Extensions.swift	Wed May 08 12:31:03 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