Skip to content

Commit 656cb82

Browse files
committed
NSLog => Dlog (Log only on debug build)
1 parent ac704f0 commit 656cb82

26 files changed

+61
-49
lines changed

ApplicationController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ - (ApplicationController*)init
3131

3232
if(![[NSBundle bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework"] load])
3333
if(![[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load])
34-
NSLog(@"Could not load QuickLook");
34+
DLog(@"Could not load QuickLook");
3535

3636
/* Value Transformers */
3737
NSValueTransformer *transformer = [[PBNSURLPathUserDefaultsTransfomer alloc] init];
@@ -55,7 +55,7 @@ - (void)registerServices
5555
int serviceVersion = [[NSUserDefaults standardUserDefaults] integerForKey:@"Services Version"];
5656
if (serviceVersion < 2)
5757
{
58-
NSLog(@"Updating services menu…");
58+
DLog(@"Updating services menu…");
5959
NSUpdateDynamicServices();
6060
[[NSUserDefaults standardUserDefaults] setInteger:2 forKey:@"Services Version"];
6161
}

GLFileView.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ - (void) showFile
124124
if(!theError){
125125
NSString *filePath = [file fullPath];
126126
fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"\t" withString:@"&nbsp;&nbsp;&nbsp;&nbsp;"];
127-
NSLog(@"file.sha='%@'",file.sha);
127+
DLog(@"file.sha='%@'",file.sha);
128128
fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"{SHA_PREV}" withString:file.sha];
129129
if(diffType==@"h") {
130130
fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"{SHA}" withString:@"HEAD"];
@@ -372,7 +372,7 @@ + (NSString *)parseDiffChunk:(NSString *)txt
372372
int r_line,r_end;
373373

374374
line=[lines nextObject];
375-
NSLog(@"-=%@=-",line);
375+
DLog(@"-=%@=-",line);
376376
NSString *header=[line substringFromIndex:3];
377377
NSRange hr = NSMakeRange(0, [header rangeOfString:@" @@"].location);
378378
header=[header substringWithRange:hr];
@@ -575,7 +575,7 @@ - (NSString *) parseBlame:(NSString *)txt
575575
[res appendString:@"</tr>\n"];
576576
}
577577
[res appendString:@"</table>\n"];
578-
//NSLog(@"%@",res);
578+
//DLog(@"%@",res);
579579

580580
return (NSString *)res;
581581
}
@@ -648,7 +648,7 @@ - (void)restoreSplitViewPositiion
648648
-(IBAction)updateSearch:(NSSearchField *)sender
649649
{
650650
NSString *searchString = [sender stringValue];
651-
NSLog(@"searchString:%@",searchString);
651+
DLog(@"searchString:%@",searchString);
652652

653653
if([searchString length]>0){
654654
[view highlightAllOccurencesOfString:searchString];

GitX_Prefix.pch

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,15 @@
55
#ifdef __OBJC__
66
#import <Cocoa/Cocoa.h>
77
#endif
8+
9+
#ifndef DLog
10+
#ifdef DEBUG
11+
# define DLog(...) NSLog(__VA_ARGS__)
12+
#else
13+
# define DLog(...) /* */
14+
#endif
15+
#endif
16+
17+
#ifndef ALog
18+
#define ALog(...) DLog(__VA_ARGS__)
19+
#endif

MGScopeBar/MGScopeBar.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,11 @@ - (void)adjustSubviews
451451
// We're widening. See if we can expand this group and still be within availableWidth.
452452
if (((theoreticalOccupiedWidth - contractedWidth) + expandedWidth) > availableWidth) {
453453
// We'd be too wide if we expanded this group. Terminate iteration without updating _firstCollapsedGroup.
454-
//NSLog(@"We'd be too wide if we expanded right now");
454+
//DLog(@"We'd be too wide if we expanded right now");
455455
break;
456456
} // else, continue trying to expand groups.
457457
theoreticalOccupiedWidth = ((theoreticalOccupiedWidth - contractedWidth) + expandedWidth);
458-
//NSLog(@"We can continue expanding");
458+
//DLog(@"We can continue expanding");
459459
}
460460

461461
// Update _firstCollapsedGroup appropriately.
@@ -474,7 +474,7 @@ - (void)adjustSubviews
474474
// Work out how many groups we need to actually change.
475475
NSRange changedRange = NSMakeRange(0, [_groups count]);
476476
BOOL adjusting = YES;
477-
//NSLog(@"Old firstCollapsedGroup: %d, new: %d", oldFirstCollapsedGroup, _firstCollapsedGroup);
477+
//DLog(@"Old firstCollapsedGroup: %d, new: %d", oldFirstCollapsedGroup, _firstCollapsedGroup);
478478
if (_firstCollapsedGroup != oldFirstCollapsedGroup) {
479479
if (narrower) {
480480
// Narrower. _firstCollapsedGroup will be less (earlier) than oldFirstCollapsedGroup.
@@ -492,7 +492,7 @@ - (void)adjustSubviews
492492

493493
// If a change is required, ensure that each group is expanded or contracted as appropriate.
494494
if (adjusting || shouldAdjustPopups) {
495-
//NSLog(@"Got %@ - modifying groups %@", ((narrower) ? @"narrower" : @"wider"), NSStringFromRange(changedRange));
495+
//DLog(@"Got %@ - modifying groups %@", ((narrower) ? @"narrower" : @"wider"), NSStringFromRange(changedRange));
496496
NSInteger nextXCoord = NSNotFound;
497497
if (adjusting) {
498498
int i;

Model/PBGitSubmodule.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ - (id) initWithRawSubmoduleStatusString:(NSString *) submoduleStatusString {
3636
unichar status = [submoduleStatusString characterAtIndex:0];
3737
submoduleState = [PBGitSubmodule submoduleStateFromCharacter:status];
3838
if (submoduleState == PBGitSubmoduleStateFailed) {
39-
NSLog(@"Submodule status failed:\n %@", submoduleStatusString);
39+
DLog(@"Submodule status failed:\n %@", submoduleStatusString);
4040
return nil;
4141
}
4242
NSScanner *scanner = [NSScanner scannerWithString:[submoduleStatusString substringFromIndex:1]];

PBCloneRepsitoryToSheet.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ - (void) cloneToSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)code context
7171

7272
if (code == NSOKButton) {
7373
NSString *clonePath = [(NSOpenPanel *)sheet filename];
74-
NSLog(@"clone path = %@", clonePath);
74+
DLog(@"clone path = %@", clonePath);
7575
[self.repository cloneRepositoryToPath:clonePath bare:self.isBare];
7676
}
7777
}

PBCommitList.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ - (void) copySHA:(id)sender
6363
// a little bit depending on how much the bottom half of the split view is dragged down.
6464
- (NSRect)adjustScroll:(NSRect)proposedVisibleRect {
6565

66-
//NSLog(@"[%@ %s]: proposedVisibleRect: %@", [self class], _cmd, NSStringFromRect(proposedVisibleRect));
66+
//DLog(@"[%@ %s]: proposedVisibleRect: %@", [self class], _cmd, NSStringFromRect(proposedVisibleRect));
6767
NSRect newRect = proposedVisibleRect;
6868

6969
// !!! Andre Berg 20100330: only modify if -scrollSelectionToTopOfViewFrom: has set useAdjustScroll to YES
@@ -74,18 +74,18 @@ - (NSRect)adjustScroll:(NSRect)proposedVisibleRect {
7474
NSInteger adj = rh - ny;
7575
// check the targeted row and see if we need to add or subtract the difference (if there is one)...
7676
NSRect sr = [self rectOfRow:[self selectedRow]];
77-
// NSLog(@"[%@ %s]: selectedRow %d, rect: %@", [self class], _cmd, [self selectedRow], NSStringFromRect(sr));
77+
// DLog(@"[%@ %s]: selectedRow %d, rect: %@", [self class], _cmd, [self selectedRow], NSStringFromRect(sr));
7878
if (sr.origin.y > proposedVisibleRect.origin.y) {
79-
// NSLog(@"[%@ %s] selectedRow.origin.y > proposedVisibleRect.origin.y. adding adj (%d)", [self class], _cmd, adj);
79+
// DLog(@"[%@ %s] selectedRow.origin.y > proposedVisibleRect.origin.y. adding adj (%d)", [self class], _cmd, adj);
8080
newRect = NSMakeRect(newRect.origin.x, newRect.origin.y + adj, newRect.size.width, newRect.size.height);
8181
} else if (sr.origin.y < proposedVisibleRect.origin.y) {
82-
// NSLog(@"[%@ %s] selectedRow.origin.y < proposedVisibleRect.origin.y. subtracting ny (%d)", [self class], _cmd, ny);
82+
// DLog(@"[%@ %s] selectedRow.origin.y < proposedVisibleRect.origin.y. subtracting ny (%d)", [self class], _cmd, ny);
8383
newRect = NSMakeRect(newRect.origin.x, newRect.origin.y - ny , newRect.size.width, newRect.size.height);
8484
} else {
85-
// NSLog(@"[%@ %s] selectedRow.origin.y == proposedVisibleRect.origin.y. leaving as is", [self class], _cmd);
85+
// DLog(@"[%@ %s] selectedRow.origin.y == proposedVisibleRect.origin.y. leaving as is", [self class], _cmd);
8686
}
8787
}
88-
//NSLog(@"[%@ %s]: newRect: %@", [self class], _cmd, NSStringFromRect(newRect));
88+
//DLog(@"[%@ %s]: newRect: %@", [self class], _cmd, NSStringFromRect(newRect));
8989
return newRect;
9090
}
9191

PBDiffWindowController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ + (void) showDiffWindowWithFiles:(NSArray *)filePaths fromCommit:(PBGitCommit *)
4747
int retValue;
4848
NSString *diff = [startCommit.repository outputInWorkdirForArguments:arguments retValue:&retValue];
4949
if (retValue) {
50-
NSLog(@"diff failed with retValue: %d for command: '%@' output: '%@'", retValue, [arguments componentsJoinedByString:@" "], diff);
50+
DLog(@"diff failed with retValue: %d for command: '%@' output: '%@'", retValue, [arguments componentsJoinedByString:@" "], diff);
5151
return;
5252
}
5353

PBEasyPipe.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import <Cocoa/Cocoa.h>
10-
10+
#import "GitX_Prefix.pch"
1111

1212
@interface PBEasyPipe : NSObject {
1313

PBEasyPipe.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#import "PBEasyPipe.h"
1010

11-
1211
@implementation PBEasyPipe
1312

1413
+ (NSFileHandle*) handleForCommand: (NSString*) cmd withArgs: (NSArray*) args
@@ -33,9 +32,9 @@ + (NSTask *) taskForCommand:(NSString *)cmd withArgs:(NSArray *)args inDir:(NSSt
3332
[task setCurrentDirectoryPath:dir];
3433

3534
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"Show Debug Messages"])
36-
NSLog(@"Starting command `%@ %@` in dir %@", cmd, [args componentsJoinedByString:@" "], dir);
35+
DLog(@"Starting command `%@ %@` in dir %@", cmd, [args componentsJoinedByString:@" "], dir);
3736
#ifdef CLI
38-
NSLog(@"Starting command `%@ %@` in dir %@", cmd, [args componentsJoinedByString:@" "], dir);
37+
DLog(@"Starting command `%@ %@` in dir %@", cmd, [args componentsJoinedByString:@" "], dir);
3938
#endif
4039

4140
NSPipe* pipe = [NSPipe pipe];
@@ -128,7 +127,7 @@ + (NSString*) outputForCommand: (NSString*) cmd withArgs: (NSArray*) args inDir
128127
data = [handle readDataToEndOfFile];
129128
}
130129
@catch (NSException * e) {
131-
NSLog(@"Got a bad file descriptor in %@!", NSStringFromSelector(_cmd));
130+
DLog(@"Got a bad file descriptor in %@!", NSStringFromSelector(_cmd));
132131
if ([NSThread currentThread] != [NSThread mainThread])
133132
[task waitUntilExit];
134133

0 commit comments

Comments
 (0)