From dcb8ef671b8fa9b525286d834f29d54df07c42ce Mon Sep 17 00:00:00 2001 From: Brian Olsen Date: Thu, 29 Mar 2018 13:39:29 +1100 Subject: [PATCH] More debug logging --- Framework/src/MZDataProviderPlugin.m | 6 ++++++ Framework/src/MZOperationsController.m | 14 +++++++++++--- Framework/src/MZPluginController.m | 7 ++++++- Framework/src/MZTaskOperation.m | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Framework/src/MZDataProviderPlugin.m b/Framework/src/MZDataProviderPlugin.m index a997ae4d..219f72f8 100644 --- a/Framework/src/MZDataProviderPlugin.m +++ b/Framework/src/MZDataProviderPlugin.m @@ -9,6 +9,12 @@ @implementation MZDataProviderPlugin +- (BOOL)isEnabled +{ + return YES; +} + + - (NSArray *)types { NSArray* types = [self.bundle objectForInfoDictionaryKey:@"CFBundleDocumentTypes"]; diff --git a/Framework/src/MZOperationsController.m b/Framework/src/MZOperationsController.m index a312d5ad..510d6831 100644 --- a/Framework/src/MZOperationsController.m +++ b/Framework/src/MZOperationsController.m @@ -100,15 +100,22 @@ - (void)addOperationsToQueue:(NSOperationQueue*)queue - (void)operationFinished:(GTMKeyValueChangeNotification *)notification { + MZLoggerDebug("Finished operation"); @synchronized(self) { - if(self.finished) + if(self.finished) { + MZLoggerDebug("Everything already finished"); return; - for(NSOperation* op in self.operations) - if(![op isFinished]) + } + for(NSOperation* op in self.operations) { + if(![op isFinished]) { + MZLoggerDebug("Not all finished"); return; + } + } self.finished = YES; } + MZLoggerDebug("Sending operationsFinished"); [self retain]; [self performSelectorOnMainThread:@selector(operationsFinished) withObject:nil waitUntilDone:YES]; [self release]; @@ -116,6 +123,7 @@ - (void)operationFinished:(GTMKeyValueChangeNotification *)notification - (void)errorChanged:(GTMKeyValueChangeNotification *)notification { + MZLoggerDebug("Error changed"); MZErrorOperation* op = [notification object]; self.error = op.error; } diff --git a/Framework/src/MZPluginController.m b/Framework/src/MZPluginController.m index 2f93c69d..b47e8b21 100644 --- a/Framework/src/MZPluginController.m +++ b/Framework/src/MZPluginController.m @@ -550,6 +550,9 @@ - (BOOL)loadPluginFromSource:(id)source error:(NSError **)error; [plugin didLoad]; if([[self delegate] respondsToSelector:@selector(pluginController:loadedPlugin:)]) [[self delegate] pluginController:self loadedPlugin:plugin]; + if (![plugin isEnabled]) { + MZLoggerInfo(@"Disabled plugin '%@'", identifier); + } return YES; } @@ -705,8 +708,10 @@ - (MZSearchProviderPlugin *)searchProviderWithIdentifier:(NSString *)identifier extra:(NSDictionary *)extra { MZDataProviderPlugin* provider = [self dataProviderForPath:fileName]; - if(!provider) + if(!provider) { + MZLoggerInfo(@"No plugin for file '%@'", fileName); return nil; + } id otherDelegate = [MZReadNotification notifierWithController:self delegate:theDelegate]; return [provider loadFromFile:fileName delegate:otherDelegate queue:loadQueue extra:extra]; diff --git a/Framework/src/MZTaskOperation.m b/Framework/src/MZTaskOperation.m index 27a45ff1..289d5e50 100644 --- a/Framework/src/MZTaskOperation.m +++ b/Framework/src/MZTaskOperation.m @@ -307,7 +307,7 @@ - (void)setErrorString:(NSString *)err code:(int)status } NSString* program = [[task launchPath] lastPathComponent]; - MZLoggerError(@"%@", err); + MZLoggerError(@"Task error %@", err); NSDictionary* dict = [NSDictionary dictionaryWithObject:err forKey:NSLocalizedDescriptionKey]; self.error = [NSError errorWithDomain:program code:status userInfo:dict];