Authored by Olivier Poitrey

Merge pull request #721 from rivera-ernesto/improve_logging

Improve logging and fix arm64 warnings when printing integers with %d
@@ -8,6 +8,10 @@ @@ -8,6 +8,10 @@
8 8
9 #import "SDWebImagePrefetcher.h" 9 #import "SDWebImagePrefetcher.h"
10 10
  11 +#if !defined(DEBUG) && !defined (SD_VERBOSE)
  12 +#define NSLog(...)
  13 +#endif
  14 +
11 @interface SDWebImagePrefetcher () 15 @interface SDWebImagePrefetcher ()
12 16
13 @property (strong, nonatomic) SDWebImageManager *manager; 17 @property (strong, nonatomic) SDWebImageManager *manager;
@@ -60,17 +64,13 @@ @@ -60,17 +64,13 @@
60 if (self.progressBlock) { 64 if (self.progressBlock) {
61 self.progressBlock(self.finishedCount,[self.prefetchURLs count]); 65 self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
62 } 66 }
63 -#ifdef SD_VERBOSE  
64 - NSLog(@"Prefetched %d out of %d", self.finishedCount, self.prefetchURLs.count);  
65 -#endif 67 + NSLog(@"Prefetched %@ out of %@", @(self.finishedCount), @(self.prefetchURLs.count));
66 } 68 }
67 else { 69 else {
68 if (self.progressBlock) { 70 if (self.progressBlock) {
69 self.progressBlock(self.finishedCount,[self.prefetchURLs count]); 71 self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
70 } 72 }
71 -#ifdef SD_VERBOSE  
72 - NSLog(@"Prefetched %d out of %d (Failed)", self.finishedCount, [self.prefetchURLs count]);  
73 -#endif 73 + NSLog(@"Prefetched %@ out of %@ (Failed)", @(self.finishedCount), @(self.prefetchURLs.count));
74 74
75 // Add last failed 75 // Add last failed
76 self.skippedCount++; 76 self.skippedCount++;
@@ -100,9 +100,7 @@ @@ -100,9 +100,7 @@
100 100
101 - (void)reportStatus { 101 - (void)reportStatus {
102 NSUInteger total = [self.prefetchURLs count]; 102 NSUInteger total = [self.prefetchURLs count];
103 -#ifdef SD_VERBOSE  
104 - NSLog(@"Finished prefetching (%d successful, %d skipped, timeElasped %.2f)", total - self.skippedCount, self.skippedCount, CFAbsoluteTimeGetCurrent() - self.startedTime);  
105 -#endif 103 + NSLog(@"Finished prefetching (%@ successful, %@ skipped, timeElasped %.2f)", @(total - self.skippedCount), @(self.skippedCount), CFAbsoluteTimeGetCurrent() - self.startedTime);
106 if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) { 104 if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) {
107 [self.delegate imagePrefetcher:self 105 [self.delegate imagePrefetcher:self
108 didFinishWithTotalCount:(total - self.skippedCount) 106 didFinishWithTotalCount:(total - self.skippedCount)