IOS-1276 dump filename etc. directly in the log message
authorDirk Zimmermann <dz@pep.security>
Thu, 17 Jan 2019 08:33:29 +0100
changeset 7534cdd48f08b1a9
parent 7533 44eac055cd12
child 7535 e1651e9a8765
IOS-1276 dump filename etc. directly in the log message
pEpForiOS/Util/Logger.swift
     1.1 --- a/pEpForiOS/Util/Logger.swift	Thu Jan 17 08:33:29 2019 +0100
     1.2 +++ b/pEpForiOS/Util/Logger.swift	Thu Jan 17 08:33:29 2019 +0100
     1.3 @@ -270,76 +270,109 @@
     1.4                         args: [CVarArg]) {
     1.5          let theLog = osLogger as! OSLog
     1.6          let theType = severity.osLogType()
     1.7 -        os_log("%@:%d %@:",
     1.8 -               log: theLog,
     1.9 -               type: theType,
    1.10 -               filePath,
    1.11 -               fileLine,
    1.12 -               function)
    1.13          switch args.count {
    1.14          case 0:
    1.15              os_log(message,
    1.16                     log: theLog,
    1.17 -                   type: theType)
    1.18 +                   type: theType,
    1.19 +                   filePath,
    1.20 +                   fileLine,
    1.21 +                   function)
    1.22          case 1:
    1.23              os_log(message,
    1.24                     log: theLog,
    1.25                     type: theType,
    1.26 +                   filePath,
    1.27 +                   fileLine,
    1.28 +                   function,
    1.29                     args[0])
    1.30          case 2:
    1.31              os_log(message,
    1.32                     log: theLog,
    1.33                     type: theType,
    1.34 +                   filePath,
    1.35 +                   fileLine,
    1.36 +                   function,
    1.37                     args[0], args[1])
    1.38          case 3:
    1.39              os_log(message,
    1.40                     log: theLog,
    1.41                     type: theType,
    1.42 +                   filePath,
    1.43 +                   fileLine,
    1.44 +                   function,
    1.45                     args[0], args[1], args[2])
    1.46          case 4:
    1.47              os_log(message,
    1.48                     log: theLog,
    1.49                     type: theType,
    1.50 +                   filePath,
    1.51 +                   fileLine,
    1.52 +                   function,
    1.53                     args[0], args[1], args[2], args[3])
    1.54          case 5:
    1.55              os_log(message,
    1.56                     log: theLog,
    1.57                     type: theType,
    1.58 +                   filePath,
    1.59 +                   fileLine,
    1.60 +                   function,
    1.61                     args[0], args[1], args[2], args[3], args[4])
    1.62          case 6:
    1.63              os_log(message,
    1.64                     log: theLog,
    1.65                     type: theType,
    1.66 +                   filePath,
    1.67 +                   fileLine,
    1.68 +                   function,
    1.69                     args[0], args[1], args[2], args[3], args[4], args[5])
    1.70          case 7:
    1.71              os_log(message,
    1.72                     log: theLog,
    1.73                     type: theType,
    1.74 +                   filePath,
    1.75 +                   fileLine,
    1.76 +                   function,
    1.77                     args[0], args[1], args[2], args[3], args[4], args[5], args[6])
    1.78          case 8:
    1.79              os_log(message,
    1.80                     log: theLog,
    1.81                     type: theType,
    1.82 +                   filePath,
    1.83 +                   fileLine,
    1.84 +                   function,
    1.85                     args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7])
    1.86          case 9:
    1.87              os_log(message,
    1.88                     log: theLog,
    1.89                     type: theType,
    1.90 +                   filePath,
    1.91 +                   fileLine,
    1.92 +                   function,
    1.93                     args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
    1.94                     args[8])
    1.95          case 10:
    1.96              os_log(message,
    1.97                     log: theLog,
    1.98                     type: theType,
    1.99 +                   filePath,
   1.100 +                   fileLine,
   1.101 +                   function,
   1.102                     args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
   1.103                     args[8], args[9])
   1.104          default:
   1.105              os_log("Using more than 10 parameters",
   1.106                     log: theLog,
   1.107 -                   type: .error)
   1.108 +                   type: .error,
   1.109 +                   filePath,
   1.110 +                   fileLine,
   1.111 +                   function)
   1.112              os_log(message,
   1.113                     log: theLog,
   1.114                     type: theType,
   1.115 +                   filePath,
   1.116 +                   fileLine,
   1.117 +                   function,
   1.118                     args)
   1.119          }
   1.120      }