Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/Logger.swift
branchIOS-1540_GOOD
changeset 9026 30c7f02bdc5f
parent 9024 b11f7271fd69
child 9027 919fcd1cda19
equal deleted inserted replaced
9025:52ece0de6d5d 9026:30c7f02bdc5f
   163 
   163 
   164     public func errorAndCrash(function: String = #function,
   164     public func errorAndCrash(function: String = #function,
   165                               filePath: String = #file,
   165                               filePath: String = #file,
   166                               fileLine: Int = #line,
   166                               fileLine: Int = #line,
   167                               error: Error) {
   167                               error: Error) {
   168         os_log("%@:%d %@: %@",
   168         os_log("*** errorAndCrash: %@ (%@:%d %@)",
   169                log: osLogger as! OSLog,
   169                log: osLogger as! OSLog,
   170                type: .fault,
   170                type: .fault,
       
   171                "\(error)",
   171                filePath,
   172                filePath,
   172                fileLine,
   173                fileLine,
   173                function,
   174                function)
   174                "\(error)")
   175 
   175 
   176         SystemUtils.crash("*** errorAndCrash: \(error) (\(filePath):\(fileLine) \(function))")
   176         SystemUtils.crash("\(filePath):\(fileLine) \(function): - \(error)")
       
   177     }
   177     }
   178 
   178 
   179     public func errorAndCrash(function: String = #function,
   179     public func errorAndCrash(function: String = #function,
   180                               filePath: String = #file,
   180                               filePath: String = #file,
   181                               fileLine: Int = #line,
   181                               fileLine: Int = #line,
   182                               message: String) {
   182                               message: String) {
   183         os_log("%@:%d %@: %@",
   183         os_log("*** errorAndCrash: %@ (%@:%d %@)",
   184                log: osLogger as! OSLog,
   184                log: osLogger as! OSLog,
   185                type: .fault,
   185                type: .fault,
       
   186                message,
   186                filePath,
   187                filePath,
   187                fileLine,
   188                fileLine,
   188                function,
   189                function)
   189                "\(message)")
   190 
   190 
   191         SystemUtils.crash("*** errorAndCrash: \(message) (\(filePath):\(fileLine) \(function))")
   191         SystemUtils.crash("\(filePath):\(fileLine) \(function): - \(message)")
       
   192     }
   192     }
   193 
   193 
   194     public func errorAndCrash(function: String = #function,
   194     public func errorAndCrash(function: String = #function,
   195                               filePath: String = #file,
   195                               filePath: String = #file,
   196                               fileLine: Int = #line,
   196                               fileLine: Int = #line,
   201                 function: function,
   201                 function: function,
   202                 filePath: filePath,
   202                 filePath: filePath,
   203                 fileLine: fileLine,
   203                 fileLine: fileLine,
   204                 args: args)
   204                 args: args)
   205 
   205 
   206         SystemUtils.crash("\(filePath):\(function):\(fileLine) - \(message)")
   206         SystemUtils.crash("*** errorAndCrash: \(message) (\(filePath):\(fileLine) \(function))")
   207     }
   207     }
   208 
   208 
   209     /**
   209     /**
   210      Logs an error.
   210      Logs an error.
   211      */
   211      */