瀏覽代碼

AspenProject: introduce the APLog makro so we don't spam release builds with debug messages

Felix Paul Kühne 12 年之前
父節點
當前提交
c58ebdcbce
共有 2 個文件被更改,包括 9 次插入4 次删除
  1. 6 0
      AspenProject/AspenProject-Prefix.pch
  2. 3 4
      AspenProject/VLCPlaylistViewController.m

+ 6 - 0
AspenProject/AspenProject-Prefix.pch

@@ -12,3 +12,9 @@
     #import <UIKit/UIKit.h>
     #import <Foundation/Foundation.h>
 #endif
+
+#ifndef NDEBUG
+#define APLog(format, ...) NSLog(format, ## __VA_ARGS__)
+#else
+#define APLog(format, ...)
+#endif

+ 3 - 4
AspenProject/VLCPlaylistViewController.m

@@ -80,7 +80,7 @@
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    NSLog(@"found %u media", _foundMedia.count);
+    APLog(@"found %u media", _foundMedia.count);
     return _foundMedia.count;
 }
 
@@ -97,10 +97,9 @@
         }
     }
 
-
     MLFile *object = _foundMedia[indexPath.row];
     cell.textLabel.text = object.title;
-    NSLog(@"returning cell with title %@", object.title);
+    APLog(@"returning cell with title %@", object.title);
     return cell;
 }
 
@@ -153,7 +152,7 @@
 #pragma mark - UI implementation
 - (void)showAboutView:(id)sender
 {
-    NSLog(@"asked to show the about view");
+    APLog(@"asked to show the about view");
 }
 
 @end