diff options
-rw-r--r-- | SmartDeviceLink-iOS.podspec | 6 | ||||
-rw-r--r-- | SmartDeviceLink-iOS.xcodeproj/project.pbxproj | 54 | ||||
-rw-r--r-- | SmartDeviceLink/SDLConsoleController.h | 24 | ||||
-rw-r--r-- | SmartDeviceLink/SDLConsoleController.m | 200 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDebugTool.h | 55 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDebugTool.m | 281 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDebugToolConsole.h | 16 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.m | 25 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLogConstants.h | 27 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLogConstants.m | 16 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLogFileModule.h | 9 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLogFileModule.m | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLogFileModuleMap.h | 17 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLogFileModuleMap.m | 27 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLogMacros.h | 35 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLogTargetOSLog.m | 3 | ||||
-rw-r--r-- | SmartDeviceLink/SmartDeviceLink.h | 18 |
17 files changed, 127 insertions, 690 deletions
diff --git a/SmartDeviceLink-iOS.podspec b/SmartDeviceLink-iOS.podspec index 746009eae..4f6e4ecc9 100644 --- a/SmartDeviceLink-iOS.podspec +++ b/SmartDeviceLink-iOS.podspec @@ -21,9 +21,6 @@ s.public_header_files = [ 'SmartDeviceLink/SDLStreamingMediaManager.h', 'SmartDeviceLink/SDLTouchManager.h', 'SmartDeviceLink/SDLTouchManagerDelegate.h', -'SmartDeviceLink/SDLConsoleController.h', -'SmartDeviceLink/SDLDebugTool.h', -'SmartDeviceLink/SDLDebugToolConsole.h', 'SmartDeviceLink/SDLSiphonServer.h', 'SmartDeviceLink/SDLAbstractTransport.h', 'SmartDeviceLink/SDLIAPSessionDelegate.h', @@ -292,7 +289,8 @@ s.public_header_files = [ 'SmartDeviceLink/SDLLogFilter.h', 'SmartDeviceLink/SDLLogConstants.h', 'SmartDeviceLink/SDLLogConfiguration.h', -'SmartDeviceLink/SDLLogManager.h' +'SmartDeviceLink/SDLLogManager.h', +'SmartDeviceLink/SDLLogMacros.h' ] end diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index f1cb9e723..da072587f 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -351,14 +351,10 @@ 5D61FC661A84238C00846EE7 /* SDLCompassDirection.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FA791A84238A00846EE7 /* SDLCompassDirection.m */; }; 5D61FC671A84238C00846EE7 /* SDLComponentVolumeStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FA7A1A84238A00846EE7 /* SDLComponentVolumeStatus.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D61FC681A84238C00846EE7 /* SDLComponentVolumeStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FA7B1A84238A00846EE7 /* SDLComponentVolumeStatus.m */; }; - 5D61FC691A84238C00846EE7 /* SDLConsoleController.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FA7C1A84238A00846EE7 /* SDLConsoleController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5D61FC6A1A84238C00846EE7 /* SDLConsoleController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FA7D1A84238A00846EE7 /* SDLConsoleController.m */; }; 5D61FC6B1A84238C00846EE7 /* SDLCreateInteractionChoiceSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FA7E1A84238A00846EE7 /* SDLCreateInteractionChoiceSet.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D61FC6C1A84238C00846EE7 /* SDLCreateInteractionChoiceSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FA7F1A84238A00846EE7 /* SDLCreateInteractionChoiceSet.m */; }; 5D61FC6D1A84238C00846EE7 /* SDLCreateInteractionChoiceSetResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FA801A84238A00846EE7 /* SDLCreateInteractionChoiceSetResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D61FC6E1A84238C00846EE7 /* SDLCreateInteractionChoiceSetResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FA811A84238A00846EE7 /* SDLCreateInteractionChoiceSetResponse.m */; }; - 5D61FC6F1A84238C00846EE7 /* SDLDebugTool.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FA821A84238A00846EE7 /* SDLDebugTool.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5D61FC701A84238C00846EE7 /* SDLDebugTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FA831A84238A00846EE7 /* SDLDebugTool.m */; }; 5D61FC721A84238C00846EE7 /* SDLDeleteCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FA851A84238A00846EE7 /* SDLDeleteCommand.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D61FC731A84238C00846EE7 /* SDLDeleteCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FA861A84238A00846EE7 /* SDLDeleteCommand.m */; }; 5D61FC741A84238C00846EE7 /* SDLDeleteCommandResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FA871A84238A00846EE7 /* SDLDeleteCommandResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -857,7 +853,6 @@ 5DBF06351E64A9FE00A5CF03 /* SDLLogConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DBF06331E64A9FE00A5CF03 /* SDLLogConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DBF06391E64ABBE00A5CF03 /* SDLLogConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DBF06371E64ABBE00A5CF03 /* SDLLogConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DBF063A1E64ABBE00A5CF03 /* SDLLogConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBF06381E64ABBE00A5CF03 /* SDLLogConfiguration.m */; }; - 5DBF063C1E64B15D00A5CF03 /* SDLLogConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBF063B1E64B15D00A5CF03 /* SDLLogConstants.m */; }; 5DC978261B7A38640012C2F1 /* SDLGlobalsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */; }; 5DCF76F51ACDBAD300BB647B /* SDLSendLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DCF76F31ACDBAD300BB647B /* SDLSendLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DCF76F61ACDBAD300BB647B /* SDLSendLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DCF76F41ACDBAD300BB647B /* SDLSendLocation.m */; }; @@ -874,10 +869,12 @@ 5DD67CBC1E661C84009CD394 /* SDLLogTargetOSLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DD67CBA1E661C84009CD394 /* SDLLogTargetOSLog.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DD67CBD1E661C84009CD394 /* SDLLogTargetOSLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DD67CBB1E661C84009CD394 /* SDLLogTargetOSLog.m */; }; 5DD67CBF1E687D6D009CD394 /* SDLLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DD67CBE1E687D6D009CD394 /* SDLLog.swift */; }; + 5DD67CC31E68AE82009CD394 /* SDLLogFileModuleMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DD67CC11E68AE82009CD394 /* SDLLogFileModuleMap.h */; }; + 5DD67CC41E68AE82009CD394 /* SDLLogFileModuleMap.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DD67CC21E68AE82009CD394 /* SDLLogFileModuleMap.m */; }; + 5DD67CC71E68B568009CD394 /* SDLLogMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DD67CC51E68B568009CD394 /* SDLLogMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DE372A11ACB2ED300849FAA /* SDLHMICapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DE3729F1ACB2ED300849FAA /* SDLHMICapabilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DE372A21ACB2ED300849FAA /* SDLHMICapabilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DE372A01ACB2ED300849FAA /* SDLHMICapabilities.m */; }; 5DE372A41ACB336600849FAA /* SDLHMICapabilitiesSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DE372A31ACB336600849FAA /* SDLHMICapabilitiesSpec.m */; }; - 5DE372A61ACC35B400849FAA /* SDLDebugToolConsole.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DE372A51ACC35B400849FAA /* SDLDebugToolConsole.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DE5ABB71B0E38C90067BB02 /* SDLSystemRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FBD21A84238B00846EE7 /* SDLSystemRequest.h */; }; 5DE5ABB81B0E38C90067BB02 /* SDLSystemRequestResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FBD41A84238B00846EE7 /* SDLSystemRequestResponse.h */; }; 5DFFB9151BD7C89700DB3F04 /* SDLConnectionManagerType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DFFB9141BD7C89700DB3F04 /* SDLConnectionManagerType.h */; }; @@ -1378,14 +1375,10 @@ 5D61FA791A84238A00846EE7 /* SDLCompassDirection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLCompassDirection.m; sourceTree = "<group>"; }; 5D61FA7A1A84238A00846EE7 /* SDLComponentVolumeStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLComponentVolumeStatus.h; sourceTree = "<group>"; }; 5D61FA7B1A84238A00846EE7 /* SDLComponentVolumeStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLComponentVolumeStatus.m; sourceTree = "<group>"; }; - 5D61FA7C1A84238A00846EE7 /* SDLConsoleController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLConsoleController.h; sourceTree = "<group>"; }; - 5D61FA7D1A84238A00846EE7 /* SDLConsoleController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLConsoleController.m; sourceTree = "<group>"; }; 5D61FA7E1A84238A00846EE7 /* SDLCreateInteractionChoiceSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLCreateInteractionChoiceSet.h; sourceTree = "<group>"; }; 5D61FA7F1A84238A00846EE7 /* SDLCreateInteractionChoiceSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLCreateInteractionChoiceSet.m; sourceTree = "<group>"; }; 5D61FA801A84238A00846EE7 /* SDLCreateInteractionChoiceSetResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLCreateInteractionChoiceSetResponse.h; sourceTree = "<group>"; }; 5D61FA811A84238A00846EE7 /* SDLCreateInteractionChoiceSetResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLCreateInteractionChoiceSetResponse.m; sourceTree = "<group>"; }; - 5D61FA821A84238A00846EE7 /* SDLDebugTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDebugTool.h; sourceTree = "<group>"; }; - 5D61FA831A84238A00846EE7 /* SDLDebugTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDebugTool.m; sourceTree = "<group>"; }; 5D61FA851A84238A00846EE7 /* SDLDeleteCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDeleteCommand.h; sourceTree = "<group>"; }; 5D61FA861A84238A00846EE7 /* SDLDeleteCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDeleteCommand.m; sourceTree = "<group>"; }; 5D61FA871A84238A00846EE7 /* SDLDeleteCommandResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDeleteCommandResponse.h; sourceTree = "<group>"; }; @@ -1883,7 +1876,6 @@ 5DBF06331E64A9FE00A5CF03 /* SDLLogConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLLogConstants.h; sourceTree = "<group>"; }; 5DBF06371E64ABBE00A5CF03 /* SDLLogConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLLogConfiguration.h; sourceTree = "<group>"; }; 5DBF06381E64ABBE00A5CF03 /* SDLLogConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLLogConfiguration.m; sourceTree = "<group>"; }; - 5DBF063B1E64B15D00A5CF03 /* SDLLogConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLLogConstants.m; sourceTree = "<group>"; }; 5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLGlobalsSpec.m; path = UtilitiesSpecs/SDLGlobalsSpec.m; sourceTree = "<group>"; }; 5DCF76F31ACDBAD300BB647B /* SDLSendLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLSendLocation.h; sourceTree = "<group>"; }; 5DCF76F41ACDBAD300BB647B /* SDLSendLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLSendLocation.m; sourceTree = "<group>"; }; @@ -1900,10 +1892,12 @@ 5DD67CBA1E661C84009CD394 /* SDLLogTargetOSLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLLogTargetOSLog.h; sourceTree = "<group>"; }; 5DD67CBB1E661C84009CD394 /* SDLLogTargetOSLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLLogTargetOSLog.m; sourceTree = "<group>"; }; 5DD67CBE1E687D6D009CD394 /* SDLLog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDLLog.swift; sourceTree = "<group>"; }; + 5DD67CC11E68AE82009CD394 /* SDLLogFileModuleMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLLogFileModuleMap.h; sourceTree = "<group>"; }; + 5DD67CC21E68AE82009CD394 /* SDLLogFileModuleMap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLLogFileModuleMap.m; sourceTree = "<group>"; }; + 5DD67CC51E68B568009CD394 /* SDLLogMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLLogMacros.h; sourceTree = "<group>"; }; 5DE3729F1ACB2ED300849FAA /* SDLHMICapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLHMICapabilities.h; sourceTree = "<group>"; }; 5DE372A01ACB2ED300849FAA /* SDLHMICapabilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLHMICapabilities.m; sourceTree = "<group>"; }; 5DE372A31ACB336600849FAA /* SDLHMICapabilitiesSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLHMICapabilitiesSpec.m; sourceTree = "<group>"; }; - 5DE372A51ACC35B400849FAA /* SDLDebugToolConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDebugToolConsole.h; sourceTree = "<group>"; }; 5DEE55BF1B8509CB004F0D0F /* SDLURLRequestTaskSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLURLRequestTaskSpec.m; path = "UtilitiesSpecs/HTTP Connection/SDLURLRequestTaskSpec.m"; sourceTree = "<group>"; }; 5DF2BB9C1B94E38A00CE5994 /* SDLURLSessionSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLURLSessionSpec.m; path = "UtilitiesSpecs/HTTP Connection/SDLURLSessionSpec.m"; sourceTree = "<group>"; }; 5DFFB9141BD7C89700DB3F04 /* SDLConnectionManagerType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLConnectionManagerType.h; sourceTree = "<group>"; }; @@ -3043,21 +3037,19 @@ 5D5934F51A8516C800687FB9 /* Logging */ = { isa = PBXGroup; children = ( + 5DD67CC01E68AE66009CD394 /* Modules */, 5DBF063D1E64BDAE00A5CF03 /* Log Targets */, - 5DBF061E1E64A81400A5CF03 /* Old */, 5DBF06211E64A83F00A5CF03 /* SDLLogManager.h */, 5DBF06221E64A83F00A5CF03 /* SDLLogManager.m */, - 5DBF06251E64A91D00A5CF03 /* SDLLogFileModule.h */, - 5DBF06261E64A91D00A5CF03 /* SDLLogFileModule.m */, 5DBF062B1E64A93A00A5CF03 /* SDLLogFilter.h */, 5DBF062C1E64A93A00A5CF03 /* SDLLogFilter.m */, 5DBF062F1E64A9C600A5CF03 /* SDLLogModel.h */, 5DBF06301E64A9C600A5CF03 /* SDLLogModel.m */, 5DBF06331E64A9FE00A5CF03 /* SDLLogConstants.h */, - 5DBF063B1E64B15D00A5CF03 /* SDLLogConstants.m */, 5DBF06371E64ABBE00A5CF03 /* SDLLogConfiguration.h */, 5DBF06381E64ABBE00A5CF03 /* SDLLogConfiguration.m */, 5DD67CBE1E687D6D009CD394 /* SDLLog.swift */, + 5DD67CC51E68B568009CD394 /* SDLLogMacros.h */, ); name = Logging; sourceTree = "<group>"; @@ -3658,18 +3650,6 @@ name = Dispatchers; sourceTree = "<group>"; }; - 5DBF061E1E64A81400A5CF03 /* Old */ = { - isa = PBXGroup; - children = ( - 5DE372A71ACC35C100849FAA /* @protocols */, - 5D61FA7C1A84238A00846EE7 /* SDLConsoleController.h */, - 5D61FA7D1A84238A00846EE7 /* SDLConsoleController.m */, - 5D61FA821A84238A00846EE7 /* SDLDebugTool.h */, - 5D61FA831A84238A00846EE7 /* SDLDebugTool.m */, - ); - name = Old; - sourceTree = "<group>"; - }; 5DBF063D1E64BDAE00A5CF03 /* Log Targets */ = { isa = PBXGroup; children = ( @@ -3718,12 +3698,15 @@ name = "Apple SysLog"; sourceTree = "<group>"; }; - 5DE372A71ACC35C100849FAA /* @protocols */ = { + 5DD67CC01E68AE66009CD394 /* Modules */ = { isa = PBXGroup; children = ( - 5DE372A51ACC35B400849FAA /* SDLDebugToolConsole.h */, + 5DBF06251E64A91D00A5CF03 /* SDLLogFileModule.h */, + 5DBF06261E64A91D00A5CF03 /* SDLLogFileModule.m */, + 5DD67CC11E68AE82009CD394 /* SDLLogFileModuleMap.h */, + 5DD67CC21E68AE82009CD394 /* SDLLogFileModuleMap.m */, ); - name = "@protocols"; + name = Modules; sourceTree = "<group>"; }; 5DEE55BE1B8509A5004F0D0F /* HTTP Connection */ = { @@ -3875,6 +3858,7 @@ 5D61FC531A84238C00846EE7 /* SDLButtonEventMode.h in Headers */, 5D61FC781A84238C00846EE7 /* SDLDeleteFileResponse.h in Headers */, 5D61FC5F1A84238C00846EE7 /* SDLCharacterSet.h in Headers */, + 5DD67CC71E68B568009CD394 /* SDLLogMacros.h in Headers */, 5D61FCFF1A84238C00846EE7 /* SDLOnAppInterfaceUnregistered.h in Headers */, 5D61FDC51A84238C00846EE7 /* SDLTCPTransport.h in Headers */, 5D6CC8EF1C610E660027F60A /* SDLSecurityType.h in Headers */, @@ -3888,7 +3872,6 @@ 5D61FC9C1A84238C00846EE7 /* SDLEmergencyEventType.h in Headers */, 5D61FD131A84238C00846EE7 /* SDLOnLanguageChange.h in Headers */, 5D61FDE71A84238C00846EE7 /* SDLUnsubscribeButton.h in Headers */, - 5D61FC691A84238C00846EE7 /* SDLConsoleController.h in Headers */, 5D61FCAB1A84238C00846EE7 /* SDLFuelCutoffStatus.h in Headers */, 5D1665C81CF8CA3D00CC4CA1 /* SDLPermissionFilter.h in Headers */, E9C32B911AB20BA200F283AF /* SDLIAPSession.h in Headers */, @@ -3903,7 +3886,6 @@ 5D61FE111A84238C00846EE7 /* SDLWarningLightStatus.h in Headers */, 5D61FC7A1A84238C00846EE7 /* SDLDeleteInteractionChoiceSet.h in Headers */, 5D61FC3B1A84238C00846EE7 /* SDLAlertManeuverResponse.h in Headers */, - 5D61FC6F1A84238C00846EE7 /* SDLDebugTool.h in Headers */, 5D61FDB71A84238C00846EE7 /* SDLSyncPData.h in Headers */, 5D61FD011A84238C00846EE7 /* SDLOnAudioPassThru.h in Headers */, 5D61FDCB1A84238C00846EE7 /* SDLTextFieldName.h in Headers */, @@ -3925,7 +3907,6 @@ 5D61FD9F1A84238C00846EE7 /* SDLSoftButton.h in Headers */, 5DD67CBC1E661C84009CD394 /* SDLLogTargetOSLog.h in Headers */, 5D61FD551A84238C00846EE7 /* SDLPutFile.h in Headers */, - 5DE372A61ACC35B400849FAA /* SDLDebugToolConsole.h in Headers */, 5D61FD091A84238C00846EE7 /* SDLOnDriverDistraction.h in Headers */, E9C32B9E1AB20C5900F283AF /* EAAccessoryManager+SDLProtocols.h in Headers */, 5D61FC4B1A84238C00846EE7 /* SDLBeltStatus.h in Headers */, @@ -3966,6 +3947,7 @@ 5D61FC761A84238C00846EE7 /* SDLDeleteFile.h in Headers */, 5D61FD211A84238C00846EE7 /* SDLOnVehicleData.h in Headers */, DA9F7E731DCC004C00ACAE48 /* SDLGetWaypointsResponse.h in Headers */, + 5DD67CC31E68AE82009CD394 /* SDLLogFileModuleMap.h in Headers */, 5D61FD7D1A84238C00846EE7 /* SDLScrollableMessageResponse.h in Headers */, 5D61FD431A84238C00846EE7 /* SDLProtocol.h in Headers */, 5D8B17531AC9E11B006A6E1C /* SDLDialNumberResponse.h in Headers */, @@ -4417,10 +4399,8 @@ 5D61FDFE1A84238C00846EE7 /* SDLVehicleDataActiveStatus.m in Sources */, 5D61FCD01A84238C00846EE7 /* SDLImageField.m in Sources */, 5D61FC3C1A84238C00846EE7 /* SDLAlertManeuverResponse.m in Sources */, - 5D61FC6A1A84238C00846EE7 /* SDLConsoleController.m in Sources */, DA9F7E741DCC004C00ACAE48 /* SDLGetWaypointsResponse.m in Sources */, 5D61FD4D1A84238C00846EE7 /* SDLProtocolMessageDisassembler.m in Sources */, - 5D61FC701A84238C00846EE7 /* SDLDebugTool.m in Sources */, 5D61FD4B1A84238C00846EE7 /* SDLProtocolMessageAssembler.m in Sources */, 5D61FCC41A84238C00846EE7 /* SDLHMIPermissions.m in Sources */, 5D61FE141A84238C00846EE7 /* SDLWiperStatus.m in Sources */, @@ -4599,7 +4579,6 @@ 5D61FDAC1A84238C00846EE7 /* SDLStartTime.m in Sources */, 5D61FDA01A84238C00846EE7 /* SDLSoftButton.m in Sources */, E9C32B951AB20BA200F283AF /* SDLStreamDelegate.m in Sources */, - 5DBF063C1E64B15D00A5CF03 /* SDLLogConstants.m in Sources */, 5D61FCD21A84238C00846EE7 /* SDLImageFieldName.m in Sources */, 5D61FD761A84238C00846EE7 /* SDLRPCResponse.m in Sources */, 5D3E48761D6F3B330000BFEF /* SDLAsynchronousOperation.m in Sources */, @@ -4631,6 +4610,7 @@ 5D61FD7E1A84238C00846EE7 /* SDLScrollableMessageResponse.m in Sources */, 5D61FD3A1A84238C00846EE7 /* SDLPrerecordedSpeech.m in Sources */, 5D61FCA11A84238C00846EE7 /* SDLEncodedSyncPDataResponse.m in Sources */, + 5DD67CC41E68AE82009CD394 /* SDLLogFileModuleMap.m in Sources */, 5D61FD401A84238C00846EE7 /* SDLPrioritizedObjectCollection.m in Sources */, 5D61FDC61A84238C00846EE7 /* SDLTCPTransport.m in Sources */, 5D61FE0E1A84238C00846EE7 /* SDLVRCapabilities.m in Sources */, diff --git a/SmartDeviceLink/SDLConsoleController.h b/SmartDeviceLink/SDLConsoleController.h deleted file mode 100644 index 26cbd39cb..000000000 --- a/SmartDeviceLink/SDLConsoleController.h +++ /dev/null @@ -1,24 +0,0 @@ -// SDLConsoleController.h -// - -#import <Foundation/Foundation.h> -#import <UIKit/UIKit.h> - -#import "SDLDebugTool.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SDLConsoleController : UITableViewController <SDLDebugToolConsole> { - NSMutableArray<NSDictionary<NSString *, id>*> *messageList; - BOOL atBottom; - NSDateFormatter *dateFormatter; -} - -@property (strong, nonatomic, readonly) NSMutableArray<NSDictionary<NSString *, id>*> *messageList; - -- (instancetype)initWithTableView:(UITableView *)tableView; - - -@end - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLConsoleController.m b/SmartDeviceLink/SDLConsoleController.m deleted file mode 100644 index 2b18e4d0f..000000000 --- a/SmartDeviceLink/SDLConsoleController.m +++ /dev/null @@ -1,200 +0,0 @@ -// SDLConsoleController.m -// - -#import "SDLConsoleController.h" - -#import "SDLRPCResponse.h" - - -@implementation SDLConsoleController - -@synthesize messageList; - -- (instancetype)initWithTableView:(UITableView *)tableView { - if (self = [super initWithStyle:UITableViewStylePlain]) { - self.tableView = tableView; - self.tableView.delegate = self; - self.tableView.dataSource = self; - [self viewDidLoad]; - } - return self; -} - - -- (void)append:(id)toAppend { - dispatch_async(dispatch_get_main_queue(), ^{ - //Insert the new data - NSMutableDictionary<NSString *, id> *dictionary = [NSMutableDictionary dictionary]; - - [dictionary setObject:toAppend forKey:@"object"]; - [dictionary setObject:[NSDate date] forKey:@"date"]; - - [messageList addObject:dictionary]; - NSIndexPath *newIndex = [NSIndexPath indexPathForRow:(messageList.count - 1) inSection:0]; - [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndex] withRowAnimation:UITableViewRowAnimationNone]; - - //If we were at the bottom, scroll to the new bottom. - if (atBottom) { - [self.tableView scrollToRowAtIndexPath:newIndex atScrollPosition:UITableViewScrollPositionBottom animated:YES]; - } - - [self.tableView reloadData]; - }); -} - -- (BOOL)isLastRowVisible { - if (messageList.count == 0) { - return YES; - } else { - NSIndexPath *lastIndex = [NSIndexPath indexPathForRow:(messageList.count - 1) inSection:0]; - - NSArray<NSIndexPath *> *visibleRowIndexes = [self.tableView indexPathsForVisibleRows]; - for (NSIndexPath *aPath in visibleRowIndexes) { - if ([aPath compare:lastIndex] == NSOrderedSame) { - return YES; - } - } - } - return NO; -} - - -#pragma mark - -#pragma mark SDLDebugTool Console Delegate - -- (void)logInfo:(NSString *)info { - [self append:info]; -} - -- (void)logException:(NSException *)ex withMessage:(NSString *)message { - [self append:message]; - [self append:[ex description]]; -} - -- (void)logMessage:(SDLRPCMessage *)message { - [self append:message]; -} - - -#pragma mark - -#pragma mark View lifecycle - - -- (void)viewDidLoad { - [SDLDebugTool addConsole:self]; - - [super viewDidLoad]; - - atBottom = YES; - - messageList = [[NSMutableArray alloc] initWithCapacity:100]; - dateFormatter = [[NSDateFormatter alloc] init]; - dateFormatter.dateFormat = @"hh:mm:ss.SSS"; -} - -#pragma mark - -#pragma mark Scroll View Delegate - -- (void)updateWhetherScrolledToBottom { - if ([self isLastRowVisible]) { - atBottom = YES; - } else { - atBottom = NO; - } -} - -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { - [self updateWhetherScrolledToBottom]; -} - -- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)willDecelerate { - [self updateWhetherScrolledToBottom]; -} - - -#pragma mark - -#pragma mark Table view data source - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - // Return the number of sections. - return 1; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - // Return the number of rows in the section. - return messageList.count; -} - -// Customize the appearance of table view cells. -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; - } - - NSDictionary<NSString *, id> *currentDictionary = [messageList objectAtIndex:indexPath.row]; - id msg = [currentDictionary objectForKey:@"object"]; - - NSString *tempdetail = [@"Time: " stringByAppendingString:[dateFormatter stringFromDate:[currentDictionary objectForKey:@"date"]]]; - - if ([msg isKindOfClass:SDLRPCMessage.class]) { - SDLRPCMessage *rpc = msg; - NSString *title = [NSString stringWithFormat:@"%@ (%@)", rpc.name, rpc.messageType]; - - cell.textLabel.text = title; - - if ([rpc.messageType isEqualToString:@"response"]) { - SDLRPCResponse *response = (SDLRPCResponse *)rpc; - - NSString *detail = [NSString stringWithFormat:@"%@ - %@", tempdetail, [response resultCode]]; - cell.detailTextLabel.text = detail; - } else { - cell.detailTextLabel.text = tempdetail; - } - - } else { - cell.textLabel.text = msg; - cell.detailTextLabel.text = tempdetail; - } - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSDictionary<NSString *, id> *currentDictionary = [messageList objectAtIndex:indexPath.row]; - id obj = [currentDictionary objectForKey:@"object"]; - - NSString *alertText = nil; - if (obj == nil || [obj isKindOfClass:SDLRPCMessage.class]) { - SDLRPCMessage *rpc = obj; - NSDictionary *dictionary = [rpc serializeAsDictionary:2]; - NSError *error = nil; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary - options:NSJSONWritingPrettyPrinted - error:&error]; - - if (!jsonData) { - alertText = @"Error parsing the JSON."; - } else { - alertText = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - } - - } else { - alertText = [NSString stringWithFormat:@"%@", [obj description]]; - } - - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"RPCMessage", nil) message:alertText delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; - [alertView show]; - alertView = nil; - - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; -} - - -@end diff --git a/SmartDeviceLink/SDLDebugTool.h b/SmartDeviceLink/SDLDebugTool.h deleted file mode 100644 index 9cb588edd..000000000 --- a/SmartDeviceLink/SDLDebugTool.h +++ /dev/null @@ -1,55 +0,0 @@ -// SDLDebugTool.h -// - - -#import "SDLDebugToolConsole.h" -#import <Foundation/Foundation.h> - -@class SDLRPCMessage; - - -typedef NS_ENUM(UInt8, SDLDebugType) { - SDLDebugType_Debug = 0, - SDLDebugType_Transport_iAP = 1, - SDLDebugType_Transport_TCP = 2, - SDLDebugType_Protocol = 3, - SDLDebugType_RPC = 4, - SDLDebugType_APP = 5 -}; - -typedef NS_ENUM(UInt8, SDLDebugOutput) { - SDLDebugOutput_All = 0xFF, - SDLDebugOutput_DeviceConsole = 1, - SDLDebugOutput_DebugToolConsole = 2, - SDLDebugOutput_File = 4 -}; - - -NS_ASSUME_NONNULL_BEGIN - -@interface SDLDebugTool : NSObject { -} - -+ (void)enable; -+ (void)disable; -+ (void)addConsole:(NSObject<SDLDebugToolConsole> *)console; -+ (void)addConsole:(NSObject<SDLDebugToolConsole> *)console toGroup:(NSString *)groupName; -+ (void)removeConsole:(NSObject<SDLDebugToolConsole> *)console; -+ (void)removeConsole:(NSObject<SDLDebugToolConsole> *)console fromGroup:(NSString *)groupName; -+ (void)logInfo:(NSString *)info; -+ (void)logFormat:(NSString *)info, ...; -+ (void)logInfo:(NSString *)info withType:(SDLDebugType)type; -+ (void)logInfo:(NSString *)info withType:(SDLDebugType)type toOutput:(SDLDebugOutput)output; -+ (void)logInfo:(NSString *)info andBinaryData:(NSData *)data withType:(SDLDebugType)type toOutput:(SDLDebugOutput)output; -+ (void)logInfo:(NSString *)info withType:(SDLDebugType)type toOutput:(SDLDebugOutput)output toGroup:(NSString *)consoleGroupName; - -+ (void)enableDebugToLogFile; -+ (void)disableDebugToLogFile; -+ (void)writeToLogFile:(NSString *)info; - -+ (NSString *)stringForDebugType:(SDLDebugType)type; - - -@end - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLDebugTool.m b/SmartDeviceLink/SDLDebugTool.m deleted file mode 100644 index f41dff9a7..000000000 --- a/SmartDeviceLink/SDLDebugTool.m +++ /dev/null @@ -1,281 +0,0 @@ -// SDLDebugTool.m -// - -#import "SDLDebugTool.h" -#import "NSThread+ThreadIndex.h" -#import "SDLHexUtility.h" -#import "SDLRPCMessage.h" - -@interface SDLDebugTool () - -@property (nonatomic, assign) BOOL enabled; -@property (nonatomic, assign) BOOL debugToLogFile; -@property (nonatomic, strong) NSMutableDictionary<NSString *, NSMutableSet<NSObject<SDLDebugToolConsole> *> *> *namedConsoleSets; -@property (nonatomic, strong) NSDateFormatter *logDateFormatter; -@property (nonatomic, strong) NSFileHandle *logFileHandle; -@property (nonatomic, strong) dispatch_queue_t logQueue; - -@end - - -@implementation SDLDebugTool - -#pragma mark - Lifecycle - -- (instancetype)init { - self = [super init]; - if (!self) { - return nil; - } - - _enabled = YES; - _debugToLogFile = NO; - _logQueue = dispatch_queue_create("com.sdl.log.file", DISPATCH_QUEUE_SERIAL); - - return self; -} - -+ (SDLDebugTool *)sharedTool { - static SDLDebugTool *sharedTool = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedTool = [[self alloc] init]; - }); - - return sharedTool; -} - -+ (void)enable { - [SDLDebugTool sharedTool].enabled = YES; -} - -+ (void)disable { - [SDLDebugTool sharedTool].enabled = NO; -} - - -#pragma mark - Console Management - -+ (void)addConsole:(NSObject<SDLDebugToolConsole> *)console { - [self addConsole:console toGroup:@"default"]; -} - -- (void)sdl_addConsole:(NSObject<SDLDebugToolConsole> *)console toGroup:(NSString *)groupName { - // Make sure master dictionary exists - if (self.namedConsoleSets == nil) { - self.namedConsoleSets = [NSMutableDictionary new]; - } - - // Make sure the set to contain this group's elements exists - if ([self.namedConsoleSets objectForKey:groupName] == nil) { - [self.namedConsoleSets setValue:[NSMutableSet new] forKey:groupName]; - } - - // Add the console to the set - [[self.namedConsoleSets valueForKey:groupName] addObject:console]; -} - -+ (void)addConsole:(NSObject<SDLDebugToolConsole> *)console toGroup:(NSString *)groupName { - [[self sharedTool] sdl_addConsole:console toGroup:groupName]; -} - -+ (void)removeConsole:(NSObject<SDLDebugToolConsole> *)console { - [self removeConsole:console fromGroup:@"default"]; -} - -+ (void)removeConsole:(NSObject<SDLDebugToolConsole> *)console fromGroup:(NSString *)groupName { - [[SDLDebugTool getConsoleListenersForGroup:groupName] removeObject:console]; -} - -+ (NSMutableSet<NSObject<SDLDebugToolConsole> *> *)getConsoleListenersForGroup:(NSString *)groupName { - return [[self sharedTool] sdl_getConsoleListenersForGroup:groupName]; -} - -- (NSMutableSet<NSObject<SDLDebugToolConsole> *> *)sdl_getConsoleListenersForGroup:(NSString *)groupName { - return [self.namedConsoleSets valueForKey:groupName]; -} - - -#pragma mark - Logging - -+ (void)logInfo:(NSString *)info { - [self logInfo:info withType:SDLDebugType_Debug toOutput:SDLDebugOutput_All toGroup:@"default"]; -} - -+ (void)logFormat:(NSString *)info, ... { - va_list args; - va_start(args, info); - - NSString *format = [[NSString alloc] initWithFormat:info arguments:args]; - [self logInfo:format]; -} - -+ (void)logInfo:(NSString *)info withType:(SDLDebugType)type { - [self logInfo:info withType:type toOutput:SDLDebugOutput_All toGroup:@"default"]; -} - -+ (void)logInfo:(NSString *)info withType:(SDLDebugType)type toOutput:(SDLDebugOutput)output { - [SDLDebugTool logInfo:info withType:type toOutput:output toGroup:@"default"]; -} - -+ (void)logInfo:(NSString *)info andBinaryData:(NSData *)data withType:(SDLDebugType)type toOutput:(SDLDebugOutput)output { - if (![SDLDebugTool sharedTool].enabled) { - return; - } - - // convert binary data to string, append the two strings, then pass to usual log method. - NSMutableString *outputString = [[NSMutableString alloc] init]; - if (info) { - [outputString appendString:info]; - } - - if (data) { - @autoreleasepool { - NSString *dataString = [SDLHexUtility getHexString:data]; - if (dataString) { - [outputString appendString:dataString]; - } - } - } - - [SDLDebugTool logInfo:outputString withType:type toOutput:output toGroup:@"default"]; -} - -// The designated logInfo method. All outputs should be performed here. -+ (void)logInfo:(NSString *)info withType:(SDLDebugType)type toOutput:(SDLDebugOutput)output toGroup:(NSString *)consoleGroupName { - if (![SDLDebugTool sharedTool].enabled) { - return; - } - - // Format the message, prepend the thread id - NSString *outputString = [NSString stringWithFormat:@"[%li] %@", (long)[[NSThread currentThread] threadIndex], info]; - - // Output to the various destinations - - //Output To DeviceConsole - if ((output & SDLDebugOutput_DeviceConsole) == SDLDebugOutput_DeviceConsole) { - NSLog(@"%@", outputString); - } - - //Output To DebugToolConsoles - if ((output & SDLDebugOutput_DebugToolConsole) == SDLDebugOutput_DebugToolConsole) { - NSSet<NSObject<SDLDebugToolConsole> *> *consoleListeners = [self getConsoleListenersForGroup:consoleGroupName]; - for (NSObject<SDLDebugToolConsole> *console in consoleListeners) { - [console logInfo:outputString]; - } - } - - //Output To LogFile - if ((output & SDLDebugOutput_File) == SDLDebugOutput_File) { - [SDLDebugTool writeToLogFile:outputString]; - } -} - - -#pragma mark - File Handling - -+ (void)enableDebugToLogFile { - [[self sharedTool] sdl_enableDebugToLogFile]; -} - -- (void)sdl_enableDebugToLogFile { - if (self.debugToLogFile) { - return; - } - - [SDLDebugTool logInfo:@"Enabling Log File" withType:SDLDebugType_Debug]; - - self.debugToLogFile = YES; - - //Delete Log File If It Exists - NSArray<NSString *> *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = [paths objectAtIndex:0]; - NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"smartdevicelink.log"]; - - NSFileManager *manager = [NSFileManager defaultManager]; - if ([manager fileExistsAtPath:filePath]) { - [manager removeItemAtPath:filePath error:nil]; - } - - // Create log file - [manager createFileAtPath:filePath contents:nil attributes:nil]; - self.logFileHandle = [NSFileHandle fileHandleForWritingAtPath:filePath]; - [self.logFileHandle seekToEndOfFile]; -} - -+ (void)disableDebugToLogFile { - [[self sharedTool] sdl_disableDebugToLogFile]; -} - -- (void)sdl_disableDebugToLogFile { - self.debugToLogFile = false; -} - -+ (void)writeToLogFile:(NSString *)info { - [[self sharedTool] sdl_writeToLogFile:info]; -} - -- (void)sdl_writeToLogFile:(NSString *)info { - // Warning: do not call any logInfo method from here. recursion of death. - if (!self.debugToLogFile || info == NULL || info.length == 0) { - return; - } - - dispatch_async(self.logQueue, ^{ - // Create timestamp string, add it in front of the message to be logged - NSDate *currentDate = [NSDate date]; - NSString *dateString = [self.logDateFormatter stringFromDate:currentDate]; - NSString *outputString = [dateString stringByAppendingFormat:@": %@\n", info]; - - // File write takes an NSData, so convert string to data. - NSData *dataToLog = [outputString dataUsingEncoding:NSUTF8StringEncoding]; - - if (self.logFileHandle != nil) { - [self.logFileHandle seekToEndOfFile]; - [self.logFileHandle writeData:dataToLog]; - } else { - NSLog(@"SDL ERROR: Unable to log to file. File handle does not exist."); - } - }); -} - -- (NSDateFormatter *)logDateFormatter { - if (_logDateFormatter == nil) { - _logDateFormatter = [[NSDateFormatter alloc] init]; - [_logDateFormatter setDateFormat:@"MM/dd/YY HH:mm:ss.SSS"]; - } - - return _logDateFormatter; -} - - -#pragma mark - Helper Methods - -+ (NSString *)stringForDebugType:(SDLDebugType)debugType { - switch (debugType) { - case SDLDebugType_Debug: - return @"DBG"; - break; - case SDLDebugType_Transport_iAP: - return @"iAP"; - break; - case SDLDebugType_Transport_TCP: - return @"TCP"; - break; - case SDLDebugType_Protocol: - return @"Pro"; - break; - case SDLDebugType_RPC: - return @"RPC"; - break; - case SDLDebugType_APP: - return @"APP"; - break; - - default: - return @"Invalid DebugType"; - break; - } -} - -@end diff --git a/SmartDeviceLink/SDLDebugToolConsole.h b/SmartDeviceLink/SDLDebugToolConsole.h deleted file mode 100644 index 941061851..000000000 --- a/SmartDeviceLink/SDLDebugToolConsole.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// SDLDebugToolConsole.h -// SmartDeviceLink-iOS - -#import <Foundation/Foundation.h> - -NS_ASSUME_NONNULL_BEGIN - -@protocol SDLDebugToolConsole <NSObject> - -@required -- (void)logInfo:(NSString *)info; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index dba15fbdd..9f55c84f2 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -22,6 +22,9 @@ #import "SDLLockScreenConfiguration.h" #import "SDLLockScreenManager.h" #import "SDLLockScreenPresenter.h" +#import "SDLLogConfiguration.h" +#import "SDLLogFileModuleMap.h" +#import "SDLLogManager.h" #import "SDLManagerDelegate.h" #import "SDLNotificationDispatcher.h" #import "SDLOnAppInterfaceUnregistered.h" @@ -83,11 +86,12 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; } // Dependencies - _configuration = configuration; + _configuration = [configuration copy]; _delegate = delegate; // Logging - [self.class sdl_updateLoggingWithFlags:self.configuration.lifecycleConfig.logFlags]; + _configuration.loggingConfig.logModules = [_configuration.loggingConfig.logModules setByAddingObjectsFromSet:[SDLLogFileModuleMap sdlModuleMap]]; + [SDLLogManager startWithConfiguration:_configuration.loggingConfig]; // Private properties _lifecycleStateMachine = [[SDLStateMachine alloc] initWithTarget:self initialState:SDLLifecycleStateStopped states:[self.class sdl_stateTransitionDictionary]]; @@ -410,23 +414,6 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; return YES; } -+ (void)sdl_updateLoggingWithFlags : (SDLLogOutput)logFlags { - if (logFlags == SDLLogOutputNone) { - [SDLDebugTool disable]; - return; - } - - if ((logFlags & SDLLogOutputConsole) == SDLLogOutputConsole) { - [SDLDebugTool enable]; - } - - if ((logFlags & SDLLogOutputFile) == SDLLogOutputFile) { - [SDLDebugTool enableDebugToLogFile]; - } else { - [SDLDebugTool disableDebugToLogFile]; - } -} - #pragma mark SDL notification observers diff --git a/SmartDeviceLink/SDLLogConstants.h b/SmartDeviceLink/SDLLogConstants.h index 57b0caeb1..427bf4c96 100644 --- a/SmartDeviceLink/SDLLogConstants.h +++ b/SmartDeviceLink/SDLLogConstants.h @@ -13,7 +13,6 @@ NS_ASSUME_NONNULL_BEGIN typedef BOOL (^SDLLogFilterBlock)(SDLLogModel *log); -typedef NSString * __nonnull (^SLLogFormatBlock)(SDLLogModel *log, NSDateFormatter *dateFormatter); typedef NS_OPTIONS(NSUInteger, SDLLogFlag) { SDLLogFlagVerbose = 1 << 0, @@ -37,30 +36,4 @@ typedef NS_ENUM(NSUInteger, SDLLogFormatType) { SDLLogFormatTypeDetailed, }; -#pragma mark - Macros - -#pragma mark - General Macros -#define SDLLOG_FILE [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] stringByDeletingPathExtension] -#define SDLLOG_FUNC [NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] - -#pragma mark Debug Logs - -#if DEBUG - -#define SDLLogV(msg, ...) [SDLLogManager logWithLevel:SDLLogLevelVerbose fileName:SDLLOG_FILE functionName:SDLLOG_FUNC line:__LINE__ message:msg, ##__VA_ARGS__]; -#define SDLLogD(msg, ...) [SDLLogManager logWithLevel:SDLLogLevelDebug fileName:SDLLOG_FILE functionName:SDLLOG_FUNC line:__LINE__ message:msg, ##__VA_ARGS__]; - -#else - -#define SDLLogV(msg, ...) -#define SDLLogD(msg, ...) - -#endif - - -#pragma mark Release Logs - -#define SDLLogW(msg, ...) [SDLLogManager logWithLevel:SDLLogLevelWarning fileName:SDLLOG_FILE functionName:SDLLOG_FUNC line:__LINE__ message:msg, ##__VA_ARGS__]; -#define SDLLogE(msg, ...) [SDLLogManager logWithLevel:SDLLogLevelError fileName:SDLLOG_FILE functionName:SDLLOG_FUNC line:__LINE__ message:msg, ##__VA_ARGS__]; - NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLLogConstants.m b/SmartDeviceLink/SDLLogConstants.m deleted file mode 100644 index 1ee5efea2..000000000 --- a/SmartDeviceLink/SDLLogConstants.m +++ /dev/null @@ -1,16 +0,0 @@ -// -// SDLLogConstants.m -// SmartDeviceLink-iOS -// -// Created by Joel Fischer on 2/27/17. -// Copyright © 2017 smartdevicelink. All rights reserved. -// - -#import <Foundation/Foundation.h> - - -NS_ASSUME_NONNULL_BEGIN - - - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLLogFileModule.h b/SmartDeviceLink/SDLLogFileModule.h index 051d6be65..6bd568eb4 100644 --- a/SmartDeviceLink/SDLLogFileModule.h +++ b/SmartDeviceLink/SDLLogFileModule.h @@ -57,6 +57,15 @@ NS_ASSUME_NONNULL_BEGIN */ - (instancetype)initWithName:(NSString *)name files:(NSSet<NSString *> *)files; +/** + Returns an initialized `SDLLogFileModule` that contains a custom name and set of files. The logging level is the same as the current global logging file by using `SDLLogLevelDefault`. + + @param name The name of this module. This will be used when printing a formatted log for a file within this module e.g. "Transport". + @param files The files this module covers. This should correspond to a `__FILE__` or `#file` call for use when comparing a log to this module. Any log originating in a file contained in this set will then use this module's log level and print the module name. + @return An initialized `SDLLogFileModule` + */ ++ (instancetype)moduleWithName:(NSString *)name files:(NSSet<NSString *> *)files; + /** Returns whether or not this module contains a given file. diff --git a/SmartDeviceLink/SDLLogFileModule.m b/SmartDeviceLink/SDLLogFileModule.m index c7a081365..78aba6589 100644 --- a/SmartDeviceLink/SDLLogFileModule.m +++ b/SmartDeviceLink/SDLLogFileModule.m @@ -33,6 +33,10 @@ NS_ASSUME_NONNULL_BEGIN return [self initWithName:name files:files level:SDLLogLevelDefault]; } ++ (instancetype)moduleWithName:(NSString *)name files:(NSSet<NSString *> *)files { + return [[self alloc] initWithName:name files:files]; +} + - (BOOL)containsFile:(NSString *)fileName { return [self.files containsObject:fileName]; } diff --git a/SmartDeviceLink/SDLLogFileModuleMap.h b/SmartDeviceLink/SDLLogFileModuleMap.h new file mode 100644 index 000000000..e079cd7e9 --- /dev/null +++ b/SmartDeviceLink/SDLLogFileModuleMap.h @@ -0,0 +1,17 @@ +// +// SDLLogFileModuleMap.h +// SmartDeviceLink-iOS +// +// Created by Joel Fischer on 3/2/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@class SDLLogFileModule; + +@interface SDLLogFileModuleMap : NSObject + ++ (NSSet<SDLLogFileModule *> *)sdlModuleMap; + +@end diff --git a/SmartDeviceLink/SDLLogFileModuleMap.m b/SmartDeviceLink/SDLLogFileModuleMap.m new file mode 100644 index 000000000..391ea0827 --- /dev/null +++ b/SmartDeviceLink/SDLLogFileModuleMap.m @@ -0,0 +1,27 @@ +// +// SDLLogFileModuleMap.m +// SmartDeviceLink-iOS +// +// Created by Joel Fischer on 3/2/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLLogFileModuleMap.h" + +#import "SDLLogFileModule.h" + +@implementation SDLLogFileModuleMap + ++ (NSSet<SDLLogFileModule *> *)sdlModuleMap { + return [NSSet setWithArray:@[[self sdl_transportModule], [self sdl_fileManagerModule]]]; +} + ++ (SDLLogFileModule *)sdl_transportModule { + return [SDLLogFileModule moduleWithName:@"Transport" files:[NSSet setWithArray:@[]]]; +} + ++ (SDLLogFileModule *)sdl_fileManagerModule { + return [SDLLogFileModule moduleWithName:@"File Manager" files:[NSSet setWithArray:@[]]]; +} + +@end diff --git a/SmartDeviceLink/SDLLogMacros.h b/SmartDeviceLink/SDLLogMacros.h new file mode 100644 index 000000000..6bf0ecd0e --- /dev/null +++ b/SmartDeviceLink/SDLLogMacros.h @@ -0,0 +1,35 @@ +// +// SDLLogMacros.h +// SmartDeviceLink-iOS +// +// Created by Joel Fischer on 3/2/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#pragma mark - Macros + +#pragma mark - General Macros +#define SDLLOG_FILE [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] stringByDeletingPathExtension] +#define SDLLOG_FUNC [NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] + +#pragma mark Debug Logs + +#if DEBUG + +#define SDLLogV(msg, ...) [SDLLogManager logWithLevel:SDLLogLevelVerbose fileName:SDLLOG_FILE functionName:SDLLOG_FUNC line:__LINE__ message:msg, ##__VA_ARGS__]; +#define SDLLogD(msg, ...) [SDLLogManager logWithLevel:SDLLogLevelDebug fileName:SDLLOG_FILE functionName:SDLLOG_FUNC line:__LINE__ message:msg, ##__VA_ARGS__]; + +#else + +#define SDLLogV(msg, ...) +#define SDLLogD(msg, ...) + +#endif + + +#pragma mark Release Logs + +#define SDLLogW(msg, ...) [SDLLogManager logWithLevel:SDLLogLevelWarning fileName:SDLLOG_FILE functionName:SDLLOG_FUNC line:__LINE__ message:msg, ##__VA_ARGS__]; +#define SDLLogE(msg, ...) [SDLLogManager logWithLevel:SDLLogLevelError fileName:SDLLOG_FILE functionName:SDLLOG_FUNC line:__LINE__ message:msg, ##__VA_ARGS__]; diff --git a/SmartDeviceLink/SDLLogTargetOSLog.m b/SmartDeviceLink/SDLLogTargetOSLog.m index 8774a76d5..22d7dc4af 100644 --- a/SmartDeviceLink/SDLLogTargetOSLog.m +++ b/SmartDeviceLink/SDLLogTargetOSLog.m @@ -63,6 +63,9 @@ NS_ASSUME_NONNULL_BEGIN case SDLLogLevelDebug: return OS_LOG_TYPE_INFO; case SDLLogLevelWarning: return OS_LOG_TYPE_ERROR; case SDLLogLevelError: return OS_LOG_TYPE_FAULT; + default: + NSAssert(NO, @"The OFF and DEFAULT log levels are not valid to log with."); + return OS_LOG_TYPE_DEFAULT; } } diff --git a/SmartDeviceLink/SmartDeviceLink.h b/SmartDeviceLink/SmartDeviceLink.h index 7b560925d..53f87b6e3 100644 --- a/SmartDeviceLink/SmartDeviceLink.h +++ b/SmartDeviceLink/SmartDeviceLink.h @@ -18,11 +18,6 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLTouchManager.h" #import "SDLTouchManagerDelegate.h" -/***** Debug *****/ -#import "SDLConsoleController.h" -#import "SDLDebugTool.h" -#import "SDLDebugToolConsole.h" - /***** Transport *****/ #import "SDLAbstractTransport.h" #import "SDLIAPSessionDelegate.h" @@ -316,13 +311,14 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLRPCResponseNotification.h" // Logger +#import "SDLLogConstants.h" +#import "SDLLogConfiguration.h" +#import "SDLLogFileModule.h" +#import "SDLLogFilter.h" +#import "SDLLogManager.h" +#import "SDLLogMacros.h" #import "SDLLogTarget.h" #import "SDLLogTargetASL.h" +#import "SDLLogTargetConsole.h" #import "SDLLogTargetFile.h" #import "SDLLogTargetOSLog.h" -#import "SDLLogTargetConsole.h" -#import "SDLLogFileModule.h" -#import "SDLLogFilter.h" -#import "SDLLogConstants.h" -#import "SDLLogConfiguration.h" -#import "SDLLogManager.h" |