diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index d8dc9fdfe..0e1b9e67e 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -1585,7 +1585,7 @@ - (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath if ([self.collectionViewLayout isKindOfClass:[ASCollectionLayout class]]) { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - as_log_debug(ASCollectionLog(), "Collection node item interactive movement is not supported when using a layout delegate. This message will only be logged once. Node: %@", ASObjectDescriptionMakeTiny(self)); + os_log_debug(ASCollectionLog(), "Collection node item interactive movement is not supported when using a layout delegate. This message will only be logged once. Node: %@", ASObjectDescriptionMakeTiny(self)); }); return NO; } @@ -1876,7 +1876,7 @@ - (void)_beginBatchFetching if (_asyncDelegateFlags.collectionNodeWillBeginBatchFetch) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ GET_COLLECTIONNODE_OR_RETURN(collectionNode, (void)0); - as_log_debug(ASCollectionLog(), "Beginning batch fetch for %@ with context %@", collectionNode, _batchContext); + os_log_debug(ASCollectionLog(), "Beginning batch fetch for %@ with context %@", collectionNode, _batchContext); [_asyncDelegate collectionNode:collectionNode willBeginBatchFetchWithContext:_batchContext]; }); } else if (_asyncDelegateFlags.collectionViewWillBeginBatchFetch) { @@ -2252,7 +2252,7 @@ - (void)rangeController:(ASRangeController *)rangeController updateWithChangeSet _superIsPendingDataLoad = YES; updates(); [self _superReloadData:nil completion:nil]; - as_log_debug(ASCollectionLog(), "Did reloadData %@", self.collectionNode); + os_log_debug(ASCollectionLog(), "Did reloadData %@", self.collectionNode); [changeSet executeCompletionHandlerWithFinished:YES]; } else { [_layoutFacilitator collectionViewWillPerformBatchUpdates]; @@ -2314,7 +2314,7 @@ - (void)rangeController:(ASRangeController *)rangeController updateWithChangeSet } completion:completion]; } - as_log_debug(ASCollectionLog(), "Completed batch update %{public}@", self.collectionNode); + os_log_debug(ASCollectionLog(), "Completed batch update %{public}@", self.collectionNode); // Flush any range changes that happened as part of submitting the update. as_activity_scope(changeSet.rootActivity); diff --git a/Source/ASDisplayNode+Layout.mm b/Source/ASDisplayNode+Layout.mm index 02c9a0685..28b2a0fc4 100644 --- a/Source/ASDisplayNode+Layout.mm +++ b/Source/ASDisplayNode+Layout.mm @@ -618,7 +618,7 @@ - (void)transitionLayoutWithSizeRange:(ASSizeRange)constrainedSize { ASDisplayNodeAssertMainThread(); as_activity_create_for_scope("Transition node layout"); - as_log_debug(ASLayoutLog(), "Transition layout for %@ sizeRange %@ anim %d asyncMeasure %d", self, NSStringFromASSizeRange(constrainedSize), animated, shouldMeasureAsync); + os_log_debug(ASLayoutLog(), "Transition layout for %@ sizeRange %@ anim %d asyncMeasure %d", self, NSStringFromASSizeRange(constrainedSize), animated, shouldMeasureAsync); if (constrainedSize.max.width <= 0.0 || constrainedSize.max.height <= 0.0) { // Using CGSizeZero for the sizeRange can cause negative values in client layout code. diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index 7416fb773..46a710ad2 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -1063,7 +1063,7 @@ - (void)__layout // Performing layout on a zero-bounds view often results in frame calculations // with negative sizes after applying margins, which will cause // layoutThatFits: on subnodes to assert. - as_log_debug(OS_LOG_DISABLED, "Warning: No size given for node before node was trying to layout itself: %@. Please provide a frame for the node.", self); + os_log_debug(OS_LOG_DISABLED, "Warning: No size given for node before node was trying to layout itself: %@. Please provide a frame for the node.", self); return; } diff --git a/Source/ASMainThreadDeallocation.mm b/Source/ASMainThreadDeallocation.mm index 1cf90ada0..94bddb8ea 100644 --- a/Source/ASMainThreadDeallocation.mm +++ b/Source/ASMainThreadDeallocation.mm @@ -42,7 +42,7 @@ - (void)scheduleIvarsForMainThreadDeallocation } if ([object_getClass(value) needsMainThreadDeallocation]) { - as_log_debug(ASMainThreadDeallocationLog(), "%@: Trampolining ivar '%s' value %@ for main deallocation.", self, ivar_getName(ivar), value); + os_log_debug(ASMainThreadDeallocationLog(), "%@: Trampolining ivar '%s' value %@ for main deallocation.", self, ivar_getName(ivar), value); // Release the ivar's reference before handing the object to the queue so we // don't risk holding onto it longer than the queue does. @@ -50,7 +50,7 @@ - (void)scheduleIvarsForMainThreadDeallocation ASPerformMainThreadDeallocation(&value); } else { - as_log_debug(ASMainThreadDeallocationLog(), "%@: Not trampolining ivar '%s' value %@.", self, ivar_getName(ivar), value); + os_log_debug(ASMainThreadDeallocationLog(), "%@: Not trampolining ivar '%s' value %@.", self, ivar_getName(ivar), value); } } } diff --git a/Source/ASMultiplexImageNode.mm b/Source/ASMultiplexImageNode.mm index e7b69a7e7..650627be3 100644 --- a/Source/ASMultiplexImageNode.mm +++ b/Source/ASMultiplexImageNode.mm @@ -626,7 +626,7 @@ - (void)_loadNextImage NSURL *nextImageURL = (_dataSourceFlags.URL) ? [_dataSource multiplexImageNode:self URLForImageIdentifier:nextImageIdentifier] : nil; // If we fail to get a URL for the image, we have no source and can't proceed. if (!nextImageURL) { - as_log_error(ASImageLoadingLog(), "Could not acquire URL %@ ident: (%@)", self, nextImageIdentifier); + os_log_error(ASImageLoadingLog(), "Could not acquire URL %@ ident: (%@)", self, nextImageIdentifier); finishedLoadingBlock(nil, nil, [NSError errorWithDomain:ASMultiplexImageNodeErrorDomain code:ASMultiplexImageNodeErrorCodeNoSourceForImage userInfo:nil]); return; } @@ -684,7 +684,7 @@ - (void)_loadNextImage if (downloadedImage) { as_log_verbose(ASImageLoadingLog(), "Acquired image from download for %@ id: %@ img: %@", strongSelf, nextImageIdentifier, downloadedImage); } else { - as_log_error(ASImageLoadingLog(), "Error downloading image for %@ id: %@ err: %@", strongSelf, nextImageIdentifier, error); + os_log_error(ASImageLoadingLog(), "Error downloading image for %@ id: %@ err: %@", strongSelf, nextImageIdentifier, error); } finishedLoadingBlock(downloadedImage, nextImageIdentifier, error); }]; diff --git a/Source/ASNavigationController.mm b/Source/ASNavigationController.mm index 0e4abc339..2fbc4880c 100644 --- a/Source/ASNavigationController.mm +++ b/Source/ASNavigationController.mm @@ -61,7 +61,7 @@ - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BO { as_activity_create_for_scope("Pop multiple from ASNavigationController"); NSArray *viewControllers = [super popToViewController:viewController animated:animated]; - as_log_info(ASNodeLog(), "Popped %@ to %@, removing %@", self, viewController, ASGetDescriptionValueString(viewControllers)); + os_log_info(ASNodeLog(), "Popped %@ to %@, removing %@", self, viewController, ASGetDescriptionValueString(viewControllers)); [self visibilityDepthDidChange]; return viewControllers; @@ -71,7 +71,7 @@ - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated { as_activity_create_for_scope("Pop to root of ASNavigationController"); NSArray *viewControllers = [super popToRootViewControllerAnimated:animated]; - as_log_info(ASNodeLog(), "Popped view controllers %@ from %@", ASGetDescriptionValueString(viewControllers), self); + os_log_info(ASNodeLog(), "Popped view controllers %@ from %@", ASGetDescriptionValueString(viewControllers), self); [self visibilityDepthDidChange]; return viewControllers; @@ -88,7 +88,7 @@ - (void)setViewControllers:(NSArray *)viewControllers - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated { as_activity_create_for_scope("Set view controllers of ASNavigationController"); - as_log_info(ASNodeLog(), "Set view controllers of %@ to %@ animated: %d", self, ASGetDescriptionValueString(viewControllers), animated); + os_log_info(ASNodeLog(), "Set view controllers of %@ to %@ animated: %d", self, ASGetDescriptionValueString(viewControllers), animated); [super setViewControllers:viewControllers animated:animated]; [self visibilityDepthDidChange]; } @@ -96,7 +96,7 @@ - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { as_activity_create_for_scope("Push view controller on ASNavigationController"); - as_log_info(ASNodeLog(), "Pushing %@ onto %@", viewController, self); + os_log_info(ASNodeLog(), "Pushing %@ onto %@", viewController, self); [super pushViewController:viewController animated:animated]; [self visibilityDepthDidChange]; } @@ -105,7 +105,7 @@ - (UIViewController *)popViewControllerAnimated:(BOOL)animated { as_activity_create_for_scope("Pop view controller from ASNavigationController"); UIViewController *viewController = [super popViewControllerAnimated:animated]; - as_log_info(ASNodeLog(), "Popped %@ from %@", viewController, self); + os_log_info(ASNodeLog(), "Popped %@ from %@", viewController, self); [self visibilityDepthDidChange]; return viewController; } diff --git a/Source/ASTabBarController.mm b/Source/ASTabBarController.mm index 18ed4b431..63867f1a4 100644 --- a/Source/ASTabBarController.mm +++ b/Source/ASTabBarController.mm @@ -66,7 +66,7 @@ - (void)setViewControllers:(NSArray<__kindof UIViewController *> *)viewControlle - (void)setSelectedIndex:(NSUInteger)selectedIndex { as_activity_create_for_scope("Set selected index of ASTabBarController"); - as_log_info(ASNodeLog(), "Selected tab %tu of %@", selectedIndex, self); + os_log_info(ASNodeLog(), "Selected tab %tu of %@", selectedIndex, self); [super setSelectedIndex:selectedIndex]; [self visibilityDepthDidChange]; @@ -75,7 +75,7 @@ - (void)setSelectedIndex:(NSUInteger)selectedIndex - (void)setSelectedViewController:(__kindof UIViewController *)selectedViewController { as_activity_create_for_scope("Set selected view controller of ASTabBarController"); - as_log_info(ASNodeLog(), "Selected view controller %@ of %@", selectedViewController, self); + os_log_info(ASNodeLog(), "Selected view controller %@ of %@", selectedViewController, self); [super setSelectedViewController:selectedViewController]; [self visibilityDepthDidChange]; diff --git a/Source/ASViewController.mm b/Source/ASViewController.mm index e736b2554..1328c3363 100644 --- a/Source/ASViewController.mm +++ b/Source/ASViewController.mm @@ -187,7 +187,7 @@ - (void)_updateNodeFallbackSafeArea - (void)viewWillAppear:(BOOL)animated { as_activity_create_for_scope("ASViewController will appear"); - as_log_debug(ASNodeLog(), "View controller %@ will appear", self); + os_log_debug(ASNodeLog(), "View controller %@ will appear", self); [super viewWillAppear:animated]; @@ -325,7 +325,7 @@ - (void)propagateNewTraitCollection:(ASPrimitiveTraitCollection)traitCollection if (ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(traitCollection, oldTraitCollection) == NO) { as_activity_scope_verbose(as_activity_create("Propagate ASViewController trait collection", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)); - as_log_debug(ASNodeLog(), "Propagating new traits for %@: %@", self, NSStringFromASPrimitiveTraitCollection(traitCollection)); + os_log_debug(ASNodeLog(), "Propagating new traits for %@: %@", self, NSStringFromASPrimitiveTraitCollection(traitCollection)); ASTraitCollectionPropagateDown(self.node, traitCollection); // Once we've propagated all the traits, layout this node. diff --git a/Source/Base/ASLog.h b/Source/Base/ASLog.h index 8f3d86160..b8b01b4c4 100644 --- a/Source/Base/ASLog.h +++ b/Source/Base/ASLog.h @@ -119,51 +119,8 @@ AS_EXTERN os_log_t ASLockingLog(void); #define as_activity_create_for_scope(description) \ as_activity_scope(as_activity_create(description, AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)) -/** - * The logging macros are not guarded by deployment-target checks like the activity macros are, but they are - * only available on iOS >= 9 at runtime, so just make them conditional. - */ - -#define as_log_create(subsystem, category) ({ \ -os_log_t __val; \ -if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ - __val = os_log_create(subsystem, category); \ -} else { \ - __val = (os_log_t)0; \ -} \ -__val; \ -}) - -#define as_log_debug(log, format, ...) \ -if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ - os_log_debug(log, format, ##__VA_ARGS__); \ -} else { \ - (void)0; \ -} \ - -#define as_log_info(log, format, ...) \ -if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ - os_log_info(log, format, ##__VA_ARGS__); \ -} else { \ - (void)0; \ -} \ - -#define as_log_error(log, format, ...) \ -if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ - os_log_error(log, format, ##__VA_ARGS__); \ -} else { \ - (void)0; \ -} \ - -#define as_log_fault(log, format, ...) \ -if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ - os_log_fault(log, format, ##__VA_ARGS__); \ -} else { \ - (void)0; \ -} \ - #if ASEnableVerboseLogging - #define as_log_verbose(log, format, ...) as_log_debug(log, format, ##__VA_ARGS__) + #define as_log_verbose(log, format, ...) os_log_debug(log, format, ##__VA_ARGS__) #else #define as_log_verbose(log, format, ...) #endif diff --git a/Source/Base/ASLog.mm b/Source/Base/ASLog.mm index 02daf2ea8..ccdf2c286 100644 --- a/Source/Base/ASLog.mm +++ b/Source/Base/ASLog.mm @@ -24,29 +24,29 @@ ASDISPLAYNODE_INLINE BOOL ASLoggingIsEnabled() { } os_log_t ASNodeLog() { - return (ASNodeLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(as_log_create("org.TextureGroup.Texture", "Node")) : OS_LOG_DISABLED; + return (ASNodeLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Node")) : OS_LOG_DISABLED; } os_log_t ASLayoutLog() { - return (ASLayoutLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(as_log_create("org.TextureGroup.Texture", "Layout")) : OS_LOG_DISABLED; + return (ASLayoutLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Layout")) : OS_LOG_DISABLED; } os_log_t ASCollectionLog() { - return (ASCollectionLogEnabled && ASLoggingIsEnabled()) ?ASCreateOnce(as_log_create("org.TextureGroup.Texture", "Collection")) : OS_LOG_DISABLED; + return (ASCollectionLogEnabled && ASLoggingIsEnabled()) ?ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Collection")) : OS_LOG_DISABLED; } os_log_t ASDisplayLog() { - return (ASDisplayLogEnabled && ASLoggingIsEnabled()) ?ASCreateOnce(as_log_create("org.TextureGroup.Texture", "Display")) : OS_LOG_DISABLED; + return (ASDisplayLogEnabled && ASLoggingIsEnabled()) ?ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Display")) : OS_LOG_DISABLED; } os_log_t ASImageLoadingLog() { - return (ASImageLoadingLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(as_log_create("org.TextureGroup.Texture", "ImageLoading")) : OS_LOG_DISABLED; + return (ASImageLoadingLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "ImageLoading")) : OS_LOG_DISABLED; } os_log_t ASMainThreadDeallocationLog() { - return (ASMainThreadDeallocationLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(as_log_create("org.TextureGroup.Texture", "MainDealloc")) : OS_LOG_DISABLED; + return (ASMainThreadDeallocationLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "MainDealloc")) : OS_LOG_DISABLED; } os_log_t ASLockingLog() { - return (ASLockingLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(as_log_create("org.TextureGroup.Texture", "Locking")) : OS_LOG_DISABLED; + return (ASLockingLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Locking")) : OS_LOG_DISABLED; } diff --git a/Source/Details/ASBatchContext.mm b/Source/Details/ASBatchContext.mm index 2eadb8fc2..a3395f6cf 100644 --- a/Source/Details/ASBatchContext.mm +++ b/Source/Details/ASBatchContext.mm @@ -48,7 +48,7 @@ - (void)beginBatchFetching - (void)completeBatchFetching:(BOOL)didComplete { if (didComplete) { - as_log_debug(ASCollectionLog(), "Completed batch fetch with context %@", self); + os_log_debug(ASCollectionLog(), "Completed batch fetch with context %@", self); atomic_store(&_state, ASBatchContextStateCompleted); } } diff --git a/Source/Details/ASDataController.mm b/Source/Details/ASDataController.mm index 07388f4c6..90b3ebf99 100644 --- a/Source/Details/ASDataController.mm +++ b/Source/Details/ASDataController.mm @@ -556,13 +556,13 @@ - (void)updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet if (changeSet.includesReloadData) { if (_initialReloadDataHasBeenCalled) { - as_log_debug(ASCollectionLog(), "reloadData %@", ASViewToDisplayNode(ASDynamicCast(self.dataSource, UIView))); + os_log_debug(ASCollectionLog(), "reloadData %@", ASViewToDisplayNode(ASDynamicCast(self.dataSource, UIView))); } else { - as_log_debug(ASCollectionLog(), "Initial reloadData %@", ASViewToDisplayNode(ASDynamicCast(self.dataSource, UIView))); + os_log_debug(ASCollectionLog(), "Initial reloadData %@", ASViewToDisplayNode(ASDynamicCast(self.dataSource, UIView))); _initialReloadDataHasBeenCalled = YES; } } else { - as_log_debug(ASCollectionLog(), "performBatchUpdates %@ %@", ASViewToDisplayNode(ASDynamicCast(self.dataSource, UIView)), changeSet); + os_log_debug(ASCollectionLog(), "performBatchUpdates %@ %@", ASViewToDisplayNode(ASDynamicCast(self.dataSource, UIView)), changeSet); } NSTimeInterval transactionQueueFlushDuration = 0.0f; @@ -575,7 +575,7 @@ - (void)updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet // See ASUICollectionViewTests.testThatIssuingAnUpdateBeforeInitialReloadIsUnacceptable // for the issue that UICollectionView has that we're choosing to workaround. if (!_initialReloadDataHasBeenCalled) { - as_log_debug(ASCollectionLog(), "%@ Skipped update because load hasn't happened.", ASObjectDescriptionMakeTiny(_dataSource)); + os_log_debug(ASCollectionLog(), "%@ Skipped update because load hasn't happened.", ASObjectDescriptionMakeTiny(_dataSource)); [changeSet executeCompletionHandlerWithFinished:YES]; return; } @@ -639,7 +639,7 @@ - (void)updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet } } - as_log_debug(ASCollectionLog(), "New content: %@", newMap.smallDescription); + os_log_debug(ASCollectionLog(), "New content: %@", newMap.smallDescription); Class layoutDelegateClass = [self.layoutDelegate class]; ++_editingTransactionGroupCount;