mirror of
https://github.com/TextureGroup/Texture.git
synced 2026-04-07 19:17:39 +00:00
Remove iOS 8 support from logging code. (#1462)
This commit is contained in:
@@ -1586,7 +1586,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
|
||||
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;
|
||||
}
|
||||
@@ -1877,7 +1877,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
|
||||
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) {
|
||||
@@ -2253,7 +2253,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
|
||||
_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];
|
||||
@@ -2315,7 +2315,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
|
||||
} 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);
|
||||
|
||||
@@ -618,7 +618,7 @@ ASLayoutElementStyleExtensibilityForwarding
|
||||
{
|
||||
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.
|
||||
|
||||
@@ -1063,7 +1063,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__);
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
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 @@
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
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 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
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);
|
||||
}];
|
||||
|
||||
@@ -61,7 +61,7 @@ ASVisibilityDepthImplementation;
|
||||
{
|
||||
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 @@ ASVisibilityDepthImplementation;
|
||||
{
|
||||
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 @@ ASVisibilityDepthImplementation;
|
||||
- (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 @@ ASVisibilityDepthImplementation;
|
||||
- (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 @@ ASVisibilityDepthImplementation;
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ ASVisibilityDepthImplementation;
|
||||
- (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 @@ ASVisibilityDepthImplementation;
|
||||
- (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];
|
||||
|
||||
@@ -187,7 +187,7 @@ ASVisibilityDidMoveToParentViewController;
|
||||
- (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 @@ ASVisibilityDepthImplementation;
|
||||
|
||||
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.
|
||||
|
||||
+1
-44
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ typedef NS_ENUM(NSInteger, ASBatchContextState) {
|
||||
- (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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,13 +556,13 @@ typedef void (^ASDataControllerSynchronizationBlock)();
|
||||
|
||||
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 @@ typedef void (^ASDataControllerSynchronizationBlock)();
|
||||
// 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 @@ typedef void (^ASDataControllerSynchronizationBlock)();
|
||||
}
|
||||
}
|
||||
|
||||
as_log_debug(ASCollectionLog(), "New content: %@", newMap.smallDescription);
|
||||
os_log_debug(ASCollectionLog(), "New content: %@", newMap.smallDescription);
|
||||
|
||||
Class<ASDataControllerLayoutDelegate> layoutDelegateClass = [self.layoutDelegate class];
|
||||
++_editingTransactionGroupCount;
|
||||
|
||||
Reference in New Issue
Block a user