summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-01-27 08:59:52 -0500
committerGitHub <noreply@github.com>2017-01-27 08:59:52 -0500
commit83df97217f4439e1555671eadf4a9e7bd07b4f1d (patch)
tree68926e51b59436affb32d102c60b84377103f5b1
parenta3eef8de162910a0c02a9a005b692c4172a153b1 (diff)
parent632cf0b5a03fcbb1ded545edeacf537b82ef0054 (diff)
downloadsdl_ios-83df97217f4439e1555671eadf4a9e7bd07b4f1d.tar.gz
Merge pull request #513 from smartdevicelink/hotfix/issue_512_debug_tool
Fixed SDLDebugTool deleting log file after proxy restart
-rw-r--r--SmartDeviceLink/SDLDebugTool.m4
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m12
2 files changed, 12 insertions, 4 deletions
diff --git a/SmartDeviceLink/SDLDebugTool.m b/SmartDeviceLink/SDLDebugTool.m
index 8bf8c7bda..c07f206c1 100644
--- a/SmartDeviceLink/SDLDebugTool.m
+++ b/SmartDeviceLink/SDLDebugTool.m
@@ -185,6 +185,10 @@
}
- (void)sdl_enableDebugToLogFile {
+ if (self.debugToLogFile) {
+ return;
+ }
+
[SDLDebugTool logInfo:@"Enabling Log File" withType:SDLDebugType_Debug];
self.debugToLogFile = YES;
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index e322452f3..a9d5a86a1 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -87,6 +87,9 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
_configuration = configuration;
_delegate = delegate;
+ // Logging
+ [self.class sdl_updateLoggingWithFlags:self.configuration.lifecycleConfig.logFlags];
+
// Private properties
_lifecycleStateMachine = [[SDLStateMachine alloc] initWithTarget:self initialState:SDLLifecycleStateStopped states:[self.class sdl_stateTransitionDictionary]];
_lastCorrelationId = 0;
@@ -99,6 +102,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
_permissionManager = [[SDLPermissionManager alloc] init];
_lockScreenManager = [[SDLLockScreenManager alloc] initWithConfiguration:_configuration.lockScreenConfig notificationDispatcher:_notificationDispatcher presenter:[[SDLLockScreenPresenter alloc] init]];
+ // Notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(transportDidConnect) name:SDLTransportDidConnect object:_notificationDispatcher];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(transportDidDisconnect) name:SDLTransportDidDisconnect object:_notificationDispatcher];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hmiStatusDidChange:) name:SDLDidChangeHMIStatusNotification object:_notificationDispatcher];
@@ -150,9 +154,6 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
}
- (void)didEnterStateStarted {
- // Set up our logging capabilities based on the config
- [self.class sdl_updateLoggingWithFlags:self.configuration.lifecycleConfig.logFlags];
-
// Start up the internal proxy object
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -412,7 +413,10 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
}
+ (void)sdl_updateLoggingWithFlags:(SDLLogOutput)logFlags {
- [SDLDebugTool disable];
+ if (logFlags == SDLLogOutputNone) {
+ [SDLDebugTool disable];
+ return;
+ }
if ((logFlags & SDLLogOutputConsole) == SDLLogOutputConsole) {
[SDLDebugTool enable];