Skip to content

Commit

Permalink
Merge pull request #721 from rivera-ernesto/improve_logging
Browse files Browse the repository at this point in the history
Improve logging and fix arm64 warnings when printing integers with %d
  • Loading branch information
Olivier Poitrey committed May 22, 2014
2 parents 36d5069 + 29302f4 commit 1c50603
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions SDWebImage/SDWebImagePrefetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

#import "SDWebImagePrefetcher.h"

#if !defined(DEBUG) && !defined (SD_VERBOSE)
#define NSLog(...)
#endif

@interface SDWebImagePrefetcher ()

@property (strong, nonatomic) SDWebImageManager *manager;
Expand Down Expand Up @@ -60,17 +64,13 @@ - (void)startPrefetchingAtIndex:(NSUInteger)index {
if (self.progressBlock) {
self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
}
#ifdef SD_VERBOSE
NSLog(@"Prefetched %d out of %d", self.finishedCount, self.prefetchURLs.count);
#endif
NSLog(@"Prefetched %@ out of %@", @(self.finishedCount), @(self.prefetchURLs.count));
}
else {
if (self.progressBlock) {
self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
}
#ifdef SD_VERBOSE
NSLog(@"Prefetched %d out of %d (Failed)", self.finishedCount, [self.prefetchURLs count]);
#endif
NSLog(@"Prefetched %@ out of %@ (Failed)", @(self.finishedCount), @(self.prefetchURLs.count));

// Add last failed
self.skippedCount++;
Expand Down Expand Up @@ -100,9 +100,7 @@ - (void)startPrefetchingAtIndex:(NSUInteger)index {

- (void)reportStatus {
NSUInteger total = [self.prefetchURLs count];
#ifdef SD_VERBOSE
NSLog(@"Finished prefetching (%d successful, %d skipped, timeElasped %.2f)", total - self.skippedCount, self.skippedCount, CFAbsoluteTimeGetCurrent() - self.startedTime);
#endif
NSLog(@"Finished prefetching (%@ successful, %@ skipped, timeElasped %.2f)", @(total - self.skippedCount), @(self.skippedCount), CFAbsoluteTimeGetCurrent() - self.startedTime);
if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) {
[self.delegate imagePrefetcher:self
didFinishWithTotalCount:(total - self.skippedCount)
Expand Down

0 comments on commit 1c50603

Please sign in to comment.