NSLog => Dlog (Log only on debug build)

This commit is contained in:
German Laullon
2011-04-05 11:39:01 -07:00
parent ac704f0d4c
commit 656cb824a3
26 changed files with 61 additions and 49 deletions
+2 -2
View File
@@ -31,7 +31,7 @@
if(![[NSBundle bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework"] load])
if(![[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load])
NSLog(@"Could not load QuickLook");
DLog(@"Could not load QuickLook");
/* Value Transformers */
NSValueTransformer *transformer = [[PBNSURLPathUserDefaultsTransfomer alloc] init];
@@ -55,7 +55,7 @@
int serviceVersion = [[NSUserDefaults standardUserDefaults] integerForKey:@"Services Version"];
if (serviceVersion < 2)
{
NSLog(@"Updating services menu…");
DLog(@"Updating services menu…");
NSUpdateDynamicServices();
[[NSUserDefaults standardUserDefaults] setInteger:2 forKey:@"Services Version"];
}
+4 -4
View File
@@ -124,7 +124,7 @@
if(!theError){
NSString *filePath = [file fullPath];
fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"\t" withString:@"&nbsp;&nbsp;&nbsp;&nbsp;"];
NSLog(@"file.sha='%@'",file.sha);
DLog(@"file.sha='%@'",file.sha);
fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"{SHA_PREV}" withString:file.sha];
if(diffType==@"h") {
fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"{SHA}" withString:@"HEAD"];
@@ -372,7 +372,7 @@
int r_line,r_end;
line=[lines nextObject];
NSLog(@"-=%@=-",line);
DLog(@"-=%@=-",line);
NSString *header=[line substringFromIndex:3];
NSRange hr = NSMakeRange(0, [header rangeOfString:@" @@"].location);
header=[header substringWithRange:hr];
@@ -575,7 +575,7 @@
[res appendString:@"</tr>\n"];
}
[res appendString:@"</table>\n"];
//NSLog(@"%@",res);
//DLog(@"%@",res);
return (NSString *)res;
}
@@ -648,7 +648,7 @@
-(IBAction)updateSearch:(NSSearchField *)sender
{
NSString *searchString = [sender stringValue];
NSLog(@"searchString:%@",searchString);
DLog(@"searchString:%@",searchString);
if([searchString length]>0){
[view highlightAllOccurencesOfString:searchString];
+12
View File
@@ -5,3 +5,15 @@
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
#ifndef DLog
#ifdef DEBUG
# define DLog(...) NSLog(__VA_ARGS__)
#else
# define DLog(...) /* */
#endif
#endif
#ifndef ALog
#define ALog(...) DLog(__VA_ARGS__)
#endif
+4 -4
View File
@@ -451,11 +451,11 @@
// We're widening. See if we can expand this group and still be within availableWidth.
if (((theoreticalOccupiedWidth - contractedWidth) + expandedWidth) > availableWidth) {
// We'd be too wide if we expanded this group. Terminate iteration without updating _firstCollapsedGroup.
//NSLog(@"We'd be too wide if we expanded right now");
//DLog(@"We'd be too wide if we expanded right now");
break;
} // else, continue trying to expand groups.
theoreticalOccupiedWidth = ((theoreticalOccupiedWidth - contractedWidth) + expandedWidth);
//NSLog(@"We can continue expanding");
//DLog(@"We can continue expanding");
}
// Update _firstCollapsedGroup appropriately.
@@ -474,7 +474,7 @@
// Work out how many groups we need to actually change.
NSRange changedRange = NSMakeRange(0, [_groups count]);
BOOL adjusting = YES;
//NSLog(@"Old firstCollapsedGroup: %d, new: %d", oldFirstCollapsedGroup, _firstCollapsedGroup);
//DLog(@"Old firstCollapsedGroup: %d, new: %d", oldFirstCollapsedGroup, _firstCollapsedGroup);
if (_firstCollapsedGroup != oldFirstCollapsedGroup) {
if (narrower) {
// Narrower. _firstCollapsedGroup will be less (earlier) than oldFirstCollapsedGroup.
@@ -492,7 +492,7 @@
// If a change is required, ensure that each group is expanded or contracted as appropriate.
if (adjusting || shouldAdjustPopups) {
//NSLog(@"Got %@ - modifying groups %@", ((narrower) ? @"narrower" : @"wider"), NSStringFromRange(changedRange));
//DLog(@"Got %@ - modifying groups %@", ((narrower) ? @"narrower" : @"wider"), NSStringFromRange(changedRange));
NSInteger nextXCoord = NSNotFound;
if (adjusting) {
int i;
+1 -1
View File
@@ -36,7 +36,7 @@
unichar status = [submoduleStatusString characterAtIndex:0];
submoduleState = [PBGitSubmodule submoduleStateFromCharacter:status];
if (submoduleState == PBGitSubmoduleStateFailed) {
NSLog(@"Submodule status failed:\n %@", submoduleStatusString);
DLog(@"Submodule status failed:\n %@", submoduleStatusString);
return nil;
}
NSScanner *scanner = [NSScanner scannerWithString:[submoduleStatusString substringFromIndex:1]];
+1 -1
View File
@@ -71,7 +71,7 @@
if (code == NSOKButton) {
NSString *clonePath = [(NSOpenPanel *)sheet filename];
NSLog(@"clone path = %@", clonePath);
DLog(@"clone path = %@", clonePath);
[self.repository cloneRepositoryToPath:clonePath bare:self.isBare];
}
}
+6 -6
View File
@@ -63,7 +63,7 @@
// a little bit depending on how much the bottom half of the split view is dragged down.
- (NSRect)adjustScroll:(NSRect)proposedVisibleRect {
//NSLog(@"[%@ %s]: proposedVisibleRect: %@", [self class], _cmd, NSStringFromRect(proposedVisibleRect));
//DLog(@"[%@ %s]: proposedVisibleRect: %@", [self class], _cmd, NSStringFromRect(proposedVisibleRect));
NSRect newRect = proposedVisibleRect;
// !!! Andre Berg 20100330: only modify if -scrollSelectionToTopOfViewFrom: has set useAdjustScroll to YES
@@ -74,18 +74,18 @@
NSInteger adj = rh - ny;
// check the targeted row and see if we need to add or subtract the difference (if there is one)...
NSRect sr = [self rectOfRow:[self selectedRow]];
// NSLog(@"[%@ %s]: selectedRow %d, rect: %@", [self class], _cmd, [self selectedRow], NSStringFromRect(sr));
// DLog(@"[%@ %s]: selectedRow %d, rect: %@", [self class], _cmd, [self selectedRow], NSStringFromRect(sr));
if (sr.origin.y > proposedVisibleRect.origin.y) {
// NSLog(@"[%@ %s] selectedRow.origin.y > proposedVisibleRect.origin.y. adding adj (%d)", [self class], _cmd, adj);
// DLog(@"[%@ %s] selectedRow.origin.y > proposedVisibleRect.origin.y. adding adj (%d)", [self class], _cmd, adj);
newRect = NSMakeRect(newRect.origin.x, newRect.origin.y + adj, newRect.size.width, newRect.size.height);
} else if (sr.origin.y < proposedVisibleRect.origin.y) {
// NSLog(@"[%@ %s] selectedRow.origin.y < proposedVisibleRect.origin.y. subtracting ny (%d)", [self class], _cmd, ny);
// DLog(@"[%@ %s] selectedRow.origin.y < proposedVisibleRect.origin.y. subtracting ny (%d)", [self class], _cmd, ny);
newRect = NSMakeRect(newRect.origin.x, newRect.origin.y - ny , newRect.size.width, newRect.size.height);
} else {
// NSLog(@"[%@ %s] selectedRow.origin.y == proposedVisibleRect.origin.y. leaving as is", [self class], _cmd);
// DLog(@"[%@ %s] selectedRow.origin.y == proposedVisibleRect.origin.y. leaving as is", [self class], _cmd);
}
}
//NSLog(@"[%@ %s]: newRect: %@", [self class], _cmd, NSStringFromRect(newRect));
//DLog(@"[%@ %s]: newRect: %@", [self class], _cmd, NSStringFromRect(newRect));
return newRect;
}
+1 -1
View File
@@ -47,7 +47,7 @@
int retValue;
NSString *diff = [startCommit.repository outputInWorkdirForArguments:arguments retValue:&retValue];
if (retValue) {
NSLog(@"diff failed with retValue: %d for command: '%@' output: '%@'", retValue, [arguments componentsJoinedByString:@" "], diff);
DLog(@"diff failed with retValue: %d for command: '%@' output: '%@'", retValue, [arguments componentsJoinedByString:@" "], diff);
return;
}
+1 -1
View File
@@ -7,7 +7,7 @@
//
#import <Cocoa/Cocoa.h>
#import "GitX_Prefix.pch"
@interface PBEasyPipe : NSObject {
+3 -4
View File
@@ -8,7 +8,6 @@
#import "PBEasyPipe.h"
@implementation PBEasyPipe
+ (NSFileHandle*) handleForCommand: (NSString*) cmd withArgs: (NSArray*) args
@@ -33,9 +32,9 @@
[task setCurrentDirectoryPath:dir];
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"Show Debug Messages"])
NSLog(@"Starting command `%@ %@` in dir %@", cmd, [args componentsJoinedByString:@" "], dir);
DLog(@"Starting command `%@ %@` in dir %@", cmd, [args componentsJoinedByString:@" "], dir);
#ifdef CLI
NSLog(@"Starting command `%@ %@` in dir %@", cmd, [args componentsJoinedByString:@" "], dir);
DLog(@"Starting command `%@ %@` in dir %@", cmd, [args componentsJoinedByString:@" "], dir);
#endif
NSPipe* pipe = [NSPipe pipe];
@@ -128,7 +127,7 @@
data = [handle readDataToEndOfFile];
}
@catch (NSException * e) {
NSLog(@"Got a bad file descriptor in %@!", NSStringFromSelector(_cmd));
DLog(@"Got a bad file descriptor in %@!", NSStringFromSelector(_cmd));
if ([NSThread currentThread] != [NSThread mainThread])
[task waitUntilExit];
+1
View File
@@ -7,6 +7,7 @@
//
#import <Cocoa/Cocoa.h>
#import "GitX_Prefix.pch"
#define MIN_GIT_VERSION "1.6.0"
+2 -2
View File
@@ -43,7 +43,7 @@ static NSString* gitPath = nil;
return YES;
}
NSLog(@"Found a git binary at %@, but is only version %@", path, version);
DLog(@"Found a git binary at %@, but is only version %@", path, version);
return NO;
}
@@ -80,7 +80,7 @@ static NSString* gitPath = nil;
return;
}
NSLog(@"Could not find a git binary higher than version " MIN_GIT_VERSION);
DLog(@"Could not find a git binary higher than version " MIN_GIT_VERSION);
}
+ (NSString *) path;
+1 -1
View File
@@ -41,7 +41,7 @@
int ret;
[PBEasyPipe outputForCommand:[PBGitBinary path] withArgs:array inDir:nil retValue:&ret];
if (ret)
NSLog(@"Writing to config file failed!");
DLog(@"Writing to config file failed!");
[self didChangeValueForKey:[key substringToIndex:[key rangeOfString:@"."].location]];
}
+1 -1
View File
@@ -137,7 +137,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
previous = [[PBGraphCellInfo alloc] initWithPosition:newPos andLines:lines];
if (currentLine > maxLines)
NSLog(@"Number of lines: %i vs allocated: %i", currentLine, maxLines);
DLog(@"Number of lines: %i vs allocated: %i", currentLine, maxLines);
previous.nLines = currentLine;
previous.sign = commit.sign;
+1 -1
View File
@@ -65,7 +65,7 @@
}
}
//NSTimeInterval duration = [[NSDate date] timeIntervalSinceDate:start];
//NSLog(@"Graphed %i commits in %f seconds (%f/sec)", counter, duration, counter/duration);
//DLog(@"Graphed %i commits in %f seconds (%f/sec)", counter, duration, counter/duration);
[self sendCommits:commits];
[delegate performSelectorOnMainThread:@selector(finishedGraphing) withObject:nil waitUntilDone:NO];
+1 -1
View File
@@ -1282,7 +1282,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
- (void) finalize
{
//NSLog(@"Dealloc of repository");
//DLog(@"Dealloc of repository");
[super finalize];
}
@end
+4 -4
View File
@@ -165,7 +165,7 @@ using namespace std;
if (parentString.size() != 0)
{
if (((parentString.size() + 1) % 41) != 0) {
NSLog(@"invalid parents: %zu", parentString.size());
DLog(@"invalid parents: %zu", parentString.size());
continue;
}
int nParents = (parentString.size() + 1) / 41;
@@ -191,7 +191,7 @@ using namespace std;
stream >> c; // Remove separator
stream >> c;
if (c != '>' && c != '<' && c != '^' && c != '-')
NSLog(@"Error loading commits: sign not correct");
DLog(@"Error loading commits: sign not correct");
[newCommit setSign: c];
}
@@ -216,7 +216,7 @@ using namespace std;
if (![currentThread isCancelled]) {
NSTimeInterval duration = [[NSDate date] timeIntervalSinceDate:start];
NSLog(@"Loaded %i commits in %f seconds (%f/sec)", num, duration, num/duration);
DLog(@"Loaded %i commits in %f seconds (%f/sec)", num, duration, num/duration);
// Make sure the commits are stored before exiting.
NSDictionary *update = [NSDictionary dictionaryWithObjectsAndKeys:currentThread, kRevListThreadKey, revisions, kRevListRevisionsKey, nil];
@@ -225,7 +225,7 @@ using namespace std;
[self performSelectorOnMainThread:@selector(finishedParsing) withObject:nil waitUntilDone:NO];
}
else {
NSLog(@"[%@ %@] thread has been canceled", [self class], NSStringFromSelector(_cmd));
DLog(@"[%@ %@] thread has been canceled", [self class], NSStringFromSelector(_cmd));
}
[task terminate];
+1 -1
View File
@@ -170,7 +170,7 @@ static NSString * const kObservingContextSubmodules = @"submodulesChanged";
-(void)evaluateRemoteBadge:(PBGitSVRemoteItem *)remote
{
NSLog(@"remote.title=%@",[remote title]);
DLog(@"remote.title=%@",[remote title]);
[remote setAlert:[self remoteNeedFetch:[remote title]]];
}
+2 -2
View File
@@ -221,12 +221,12 @@
}
res=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff", sha, des,[self fullPath], nil]];
if ([res length]==0) {
NSLog(@"--%@",[res length]);
DLog(@"--%@",[res length]);
if (anError != NULL) {
*anError = [NSError errorWithDomain:@"diff" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"No Diff",NSLocalizedDescriptionKey,nil]];
}
}else{
NSLog(@"--%@",[res substringToIndex:80]);
DLog(@"--%@",[res substringToIndex:80]);
}
}else{
if (anError != NULL) {
+2 -2
View File
@@ -33,7 +33,7 @@
- (void)windowWillClose:(NSNotification *)notification
{
//NSLog(@"Window will close!");
//DLog(@"Window will close!");
if (sidebarController)
[sidebarController closeView];
@@ -226,7 +226,7 @@
sp=[[sidebarController historyViewController] historySplitView];
break;
}
NSLog(@"sp=%@",sp);
DLog(@"sp=%@",sp);
if(sp!=nil) {
[self collapseSplitView:sp show:[sender isSelectedForSegment:[sender selectedSegment]]];
}
+2 -2
View File
@@ -47,10 +47,10 @@
if ([[url host] isEqualToString:@"app"]) {
NSString *app=[[url path] substringFromIndex:1];
NSString *appPath=[[NSWorkspace sharedWorkspace] fullPathForApplication:app];
NSLog(@"app=%@ appPath=%@",app,appPath);
DLog(@"app=%@ appPath=%@",app,appPath);
if(appPath){
NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:appPath];
NSLog(@"icon=%@",icon);
DLog(@"icon=%@",icon);
[[self client] URLProtocol:self didLoadData:[icon TIFFRepresentation]];
[[self client] URLProtocolDidFinishLoading:self];
}else{
+1 -1
View File
@@ -130,7 +130,7 @@ NSString * const kGitXProgressErrorInfo = @"PBGitXProgressErrorInfo";
- (void) checkTask:(NSTimer *)timer
{
if (![gitTask isRunning]) {
NSLog(@"[%@ %@] gitTask terminated without notification", [self class], NSStringFromSelector(_cmd));
DLog(@"[%@ %@] gitTask terminated without notification", [self class], NSStringFromSelector(_cmd));
[self taskCompleted:nil];
}
}
+4 -4
View File
@@ -73,12 +73,12 @@
- (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)dictionary
{
NSLog(@"Error from webkit: %@", dictionary);
DLog(@"Error from webkit: %@", dictionary);
}
- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
{
NSLog(@"Message from webkit: %@", message);
DLog(@"Message from webkit: %@", message);
}
- (NSURLRequest *)webView:(WebView *)sender
@@ -114,7 +114,7 @@
- (void) log: (NSString*) logMessage
{
NSLog(@"%@", logMessage);
DLog(@"%@", logMessage);
}
- (BOOL) isReachable:(NSString *)hostname
@@ -189,7 +189,7 @@
{
WebScriptObject *a = [callbacks objectForKey: object];
if (!a) {
NSLog(@"Could not find a callback for object: %@", object);
DLog(@"Could not find a callback for object: %@", object);
return;
}
+1 -1
View File
@@ -262,7 +262,7 @@ contextMenuItemsForElement:(NSDictionary *)element
if ([[ref shortName] isEqualToString:selectedRefString])
return [contextMenuDelegate menuItemsForRef:ref];
}
NSLog(@"Could not find selected ref!");
DLog(@"Could not find selected ref!");
return defaultMenuItems;
}
if ([node hasAttributes] && [[node attributes] getNamedItem:@"representedFile"])
+1 -1
View File
@@ -42,7 +42,7 @@
}else if([node nodeType]==DOM_ELEMENT_NODE){
count+=[self highlightAllOccurencesOfString:str inNode:node];
}else{
NSLog(@"--->%@",node);
DLog(@"--->%@",node);
}
node=[node nextSibling];
}
+1 -1
View File
@@ -336,7 +336,7 @@ int main( int argc, const char* argv[] )
SecKeychainItemFreeContent (NULL,passwordData);
NSString *pas=[[NSString stringWithCString:passwordData encoding:NSASCIIStringEncoding] substringToIndex:passwordLength];
printf( "%s", [pas UTF8String] );
//NSLog(@"--> '%@'",pas);
//DLog(@"--> '%@'",pas);
return 0;
}else if (status != errSecItemNotFound) {
return -1;