Permalink
Browse files

Replaced all NSLogs with DLogs.

  • Loading branch information...
1 parent f7f8a37 commit 926fdc92659014be467f31630b06a6f0238f8687 @aaronpk aaronpk committed Sep 5, 2011
@@ -207,7 +207,7 @@ - (void)buildPostBody
[super buildPostBody];
#if DEBUG_FORM_DATA_REQUEST
- NSLog(@"%@",[self debugBodyString]);
+ DLog(@"%@",[self debugBodyString]);
[self setDebugBodyString:nil];
#endif
}

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1405,7 +1405,7 @@ - (BOOL)acceptOnInterface:(NSString *)interface port:(UInt16)port error:(NSError
err = CFSocketSetAddress(theSocket4, (CFDataRef)address4);
if (err != kCFSocketSuccess) goto Failed;
- //NSLog(@"theSocket4: %hu", [self localPortFromCFSocket4:theSocket4]);
+ //DLog(@"theSocket4: %hu", [self localPortFromCFSocket4:theSocket4]);
}
if(port == 0 && theSocket4 && theSocket6)
@@ -1427,7 +1427,7 @@ - (BOOL)acceptOnInterface:(NSString *)interface port:(UInt16)port error:(NSError
err = CFSocketSetAddress(theSocket6, (CFDataRef)address6);
if (err != kCFSocketSuccess) goto Failed;
- //NSLog(@"theSocket6: %hu", [self localPortFromCFSocket6:theSocket6]);
+ //DLog(@"theSocket6: %hu", [self localPortFromCFSocket6:theSocket6]);
}
theFlags |= kDidStartDelegate;
@@ -1901,7 +1901,7 @@ - (BOOL)createStreamsFromNative:(CFSocketNativeHandle)native error:(NSError **)e
{
NSError *err = [self getStreamError];
- NSLog(@"AsyncSocket %p couldn't create streams from accepted socket: %@", self, err);
+ DLog(@"AsyncSocket %p couldn't create streams from accepted socket: %@", self, err);
if (errPtr) *errPtr = err;
return NO;
@@ -2114,7 +2114,7 @@ - (BOOL)setSocketFromStreamsAndReturnError:(NSError **)errPtr
CFDataRef peeraddr = CFSocketCopyPeerAddress(theSocket);
if(peeraddr == NULL)
{
- NSLog(@"AsyncSocket couldn't determine IP version of socket");
+ DLog(@"AsyncSocket couldn't determine IP version of socket");
CFRelease(theSocket);
@@ -4207,7 +4207,7 @@ - (void)doCFSocketCallback:(CFSocketCallBackType)type
[self doAcceptFromSocket:sock withNewNativeSocket:*((CFSocketNativeHandle *)pData)];
break;
default:
- NSLog(@"AsyncSocket %p received unexpected CFSocketCallBackType %i", self, (int)type);
+ DLog(@"AsyncSocket %p received unexpected CFSocketCallBackType %i", self, (int)type);
break;
}
}
@@ -4240,7 +4240,7 @@ - (void)doCFReadStreamCallback:(CFStreamEventType)type forStream:(CFReadStreamRe
[self closeWithError: [self errorFromCFStreamError:err]];
break;
default:
- NSLog(@"AsyncSocket %p received unexpected CFReadStream callback, CFStreamEventType %i", self, (int)type);
+ DLog(@"AsyncSocket %p received unexpected CFReadStream callback, CFStreamEventType %i", self, (int)type);
}
}
@@ -4272,7 +4272,7 @@ - (void)doCFWriteStreamCallback:(CFStreamEventType)type forStream:(CFWriteStream
[self closeWithError: [self errorFromCFStreamError:err]];
break;
default:
- NSLog(@"AsyncSocket %p received unexpected CFWriteStream callback, CFStreamEventType %i", self, (int)type);
+ DLog(@"AsyncSocket %p received unexpected CFWriteStream callback, CFStreamEventType %i", self, (int)type);
}
}
View
@@ -1777,7 +1777,7 @@ - (BOOL)canAcceptBytes:(CFSocketRef)sockRef
if(theNativeSocket == 0)
{
- NSLog(@"Error - Could not get CFSocketNativeHandle from CFSocketRef");
+ DLog(@"Error - Could not get CFSocketNativeHandle from CFSocketRef");
return NO;
}
@@ -2003,7 +2003,7 @@ - (BOOL)hasBytesAvailable:(CFSocketRef)sockRef
if(theNativeSocket == 0)
{
- NSLog(@"Error - Could not get CFSocketNativeHandle from CFSocketRef");
+ DLog(@"Error - Could not get CFSocketNativeHandle from CFSocketRef");
return NO;
}
@@ -119,7 +119,7 @@ - (void)authenticationDidSucceed:(NSNotificationCenter *)notification {
}
- (void)tableView:(UITableView *)t didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- NSLog(@"Selected game %d", indexPath.row);
+ DLog(@"Selected game %d", indexPath.row);
[t deselectRowAtIndexPath:indexPath animated:NO];
self.selectedIndex = indexPath;
@@ -39,11 +39,11 @@ - (void)normalConnect
NSString *host = LQ_READ_SOCKET_HOST;
UInt16 port = LQ_READ_SOCKET_PORT;
- NSLog(@"[Read] Connecting to %@:%i", host, port);
+ DLog(@"[Read] Connecting to %@:%i", host, port);
if (![asyncSocket connectToHost:host onPort:port withTimeout:1 error:&error])
{
- NSLog(@"[Read] Error connecting: %@", error);
+ DLog(@"[Read] Error connecting: %@", error);
}
else
{
@@ -52,7 +52,7 @@ - (void)normalConnect
ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]), ntohl(tokenBytes[3])];
NSData *data = [hexDeviceID dataUsingEncoding:NSASCIIStringEncoding];
- NSLog(@"[Read] Writing device id: %@", data);
+ DLog(@"[Read] Writing device id: %@", data);
[asyncSocket writeData:data withTimeout:TIMEOUT_SEC tag:TAG_DEVICE_ID_SENT];
}
}
@@ -66,19 +66,19 @@ - (void)reconnect
// After the client finishes writing the UUID, start listening for new data
- (void)onSocket:(AsyncSocket *)sock didWriteDataWithTag:(long)tag
{
- NSLog(@"[Read] Did write data with tag %d", tag);
+ DLog(@"[Read] Did write data with tag %d", tag);
[asyncSocket readDataToData:[AsyncSocket CRLFData] withTimeout:-1 tag:TAG_MESSAGE_RECEIVED];
}
- (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
{
- NSLog(@"[Read] Did read data with tag %d: %@", tag, data);
+ DLog(@"[Read] Did read data with tag %d: %@", tag, data);
NSError **err;
NSDictionary *dict;
dict = [[CJSONDeserializer deserializer] deserialize:data error:err];
- NSLog(@"[Read] Message: %@", dict);
+ DLog(@"[Read] Message: %@", dict);
if([dict objectForKey:@"aps"] == nil) {
// Custom push data, pass off to the web view
@@ -122,7 +122,7 @@ - (void)disconnect
- (void) socket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port
{
- NSLog(@"[Read] Connected on local host:%@ port:%hu", [sock localHost], [sock localPort]);
+ DLog(@"[Read] Connected on local host:%@ port:%hu", [sock localHost], [sock localPort]);
}
@@ -74,12 +74,12 @@ - (void) normalConnect
NSString *host = LQ_WRITE_SOCKET_HOST;
UInt16 port = LQ_WRITE_SOCKET_PORT;
- NSLog(@"[Write] Connecting to %@:%i", host, port);
+ DLog(@"[Write] Connecting to %@:%i", host, port);
// Change to use UDP
if (![asyncSocket connectToHost:LQ_WRITE_SOCKET_HOST onPort:LQ_WRITE_SOCKET_PORT error:&error])
{
- NSLog(@"[Write] Error connecting: %@", error);
+ DLog(@"[Write] Error connecting: %@", error);
}
}
@@ -108,10 +108,10 @@ - (void)startMonitoringLocation {
/*
[locationManager startMonitoringSignificantLocationChanges];
if (significantUpdatesOnly) {
- NSLog(@"Significant updates on.");
+ DLog(@"Significant updates on.");
[locationManager stopUpdatingLocation];
} else {
- NSLog(@"Starting location updates");
+ DLog(@"Starting location updates");
[locationManager startUpdatingLocation];
}
*/
@@ -131,7 +131,7 @@ - (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
-// NSLog(@"Updated to location %@ from %@", newLocation, oldLocation);
+// DLog(@"Updated to location %@ from %@", newLocation, oldLocation);
// horizontalAccuracy is negative when the location is invalid, so completely ignore it in this case
if(newLocation.horizontalAccuracy < 0){
@@ -153,39 +153,39 @@ - (void)locationManager:(CLLocationManager *)manager
// object:self];
NSData *data = [self dataFromLocation:newLocation];
- NSLog(@"[Write] Sending location data: %@", data);
+ DLog(@"[Write] Sending location data: %@", data);
[asyncSocket sendData:data toHost:LQ_WRITE_SOCKET_HOST port:LQ_WRITE_SOCKET_PORT withTimeout:10.0 tag:TAG_DEVICE_ID_SENT];
//Look for ack back
[asyncSocket receiveWithTimeout:30.0 tag:TAG_DEVICE_ID_SENT];
} else {
#if LQ_LOCMAN_DEBUG
- NSLog(@"[Write] Location update (to %@; from %@) rejected", newLocation, oldLocation);
+ DLog(@"[Write] Location update (to %@; from %@) rejected", newLocation, oldLocation);
#endif
}
}
- (void)onUdpSocket:(AsyncUdpSocket *)sock didSendDataWithTag:(long)tag;
{
- NSLog(@"[Write] did send");
+ DLog(@"[Write] did send");
}
- (void)onUdpSocket:(AsyncUdpSocket *)sock didNotSendDataWithTag:(long)tag dueToError:(NSError *)error;
{
- NSLog(@"[Write] did not get ack back");
+ DLog(@"[Write] did not get ack back");
}
- (BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port;
{
//TODO: determine if this is a valid packet
- NSLog(@"[Write] Recieved packet back from server: %@", data);
+ DLog(@"[Write] Recieved packet back from server: %@", data);
if (data.length == sizeof(uint32_t)) {
uint32_t time = OSSwapBigToHostInt32(*(uint32_t *)data.bytes);
- NSLog(@"[Write] Accepted packet with timestamp: %u", time);
+ DLog(@"[Write] Accepted packet with timestamp: %u", time);
return YES;
} else {
- NSLog(@"[Write] packet invalid size: %d", data.length);
+ DLog(@"[Write] packet invalid size: %d", data.length);
return NO;
}
}
@@ -220,11 +220,11 @@ - (NSData *)dataFromLocation:(CLLocation *)location {
memset(update.f.uuid, 0x0, sizeof(update.f.uuid));
-// NSLog(@"Size of packet: %lu", sizeof(LQUpdatePacket));
-// NSLog(@"Offset of command: %lu", offsetof(LQUpdatePacket, f.command));
-// NSLog(@"Offset of date: %lu", offsetof(LQUpdatePacket, f.date));
+// DLog(@"Size of packet: %lu", sizeof(LQUpdatePacket));
+// DLog(@"Offset of command: %lu", offsetof(LQUpdatePacket, f.command));
+// DLog(@"Offset of date: %lu", offsetof(LQUpdatePacket, f.date));
- NSLog(@"[Write] Sending timestamp: %d", update.f.date);
+ DLog(@"[Write] Sending timestamp: %d", update.f.date);
//Swap endianness of each 16 bit int
update.f.date = OSSwapHostToBigInt32(update.f.date);
View
@@ -195,7 +195,7 @@ - (void)createShareToken {
#pragma mark public methods
- (BOOL)isLoggedIn {
- NSLog(@"Is logged in? %@", self.accessToken);
+ DLog(@"Is logged in? %@", self.accessToken);
return self.accessToken != nil;
}
@@ -238,22 +238,22 @@ - (void)createNewAccountWithEmail:(NSString *)email initials:(NSString *)initial
- (void)joinGame:(NSString *)layer_id withToken:(NSString *)group_token {
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:MapAttackJoinURLFormat, layer_id]];
- NSLog(@"Joining game... %@", url);
+ DLog(@"Joining game... %@", url);
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:self.userInitials forKey:@"initials"];
[request setPostValue:self.emailAddress forKey:@"email"];
[request setPostValue:self.accessToken forKey:@"access_token"];
[request setCompletionBlock:^{
// NSDictionary *responseDict = [self dictionaryFromResponse:[request responseString]];
- NSLog(@"Response from mapattack.org %@", [request responseString]);
+ DLog(@"Response from mapattack.org %@", [request responseString]);
}];
[request startAsynchronous];
}
- (void)sendPushToken:(NSString *)token withCallback:(LQHTTPRequestCallback)callback {
// TODO: Send this device token to the Geoloqi API
NSURL *url = [self urlWithPath:@"account/set_apn_token"];
- NSLog(@"Sending push token %@ to %@", token, url);
+ DLog(@"Sending push token %@ to %@", token, url);
__block ASIFormDataRequest *request = (ASIFormDataRequest *)[self userRequestWithURL:url class:@"ASIFormDataRequest"];
[self addDeviceInfoToRequest:request];
[request setPostValue:token forKey:@"token"];
@@ -87,27 +87,27 @@ - (void)application:(UIApplication *)application didRegisterForRemoteNotificatio
stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
- NSLog(@"Device Token: %@", deviceToken);
+ DLog(@"Device Token: %@", deviceToken);
[[LQClient single] sendPushToken:deviceToken withCallback:^(NSError *error, NSDictionary *response){
- NSLog(@"Sent device token: %@", response);
+ DLog(@"Sent device token: %@", response);
}];
if ([application enabledRemoteNotificationTypes] == UIRemoteNotificationTypeNone) {
- NSLog(@"Notifications are disabled for this application. Not registering.");
+ DLog(@"Notifications are disabled for this application. Not registering.");
return;
}
}
#pragma mark Received push notification
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
- NSLog(@"Received Push! %@", userInfo);
+ DLog(@"Received Push! %@", userInfo);
// Push was received while the app was in the foreground
if(application.applicationState == UIApplicationStateActive) {
NSDictionary *data = [userInfo valueForKeyPath:@"mapattack"];
if(data) {
- NSLog(@"Got some location data! Yeah!!");
+ DLog(@"Got some location data! Yeah!!");
// The data in the push notification is already an NSDictionary, we need to serialize it to JSON
// format to pass to the web view.
@@ -126,7 +126,7 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(N
-(void)loadGameWithURL:(NSString *)url {
[tabBarController setSelectedIndex:1];
- NSLog(@"MapAttackAppDelegate loadGameWithURL:%@", url);
+ DLog(@"MapAttackAppDelegate loadGameWithURL:%@", url);
[self.mapController loadURL:url];
}
@@ -207,10 +207,10 @@ + (NSData *)UUID {
CFRelease(theUUID);
[[NSUserDefaults standardUserDefaults] setObject:dataUUID forKey:LQUUIDKey];
[[NSUserDefaults standardUserDefaults] synchronize];
- NSLog(@"Generating new UUID: %@", dataUUID);
+ DLog(@"Generating new UUID: %@", dataUUID);
return dataUUID;
} else {
- NSLog(@"Returning existing UUID: %@", [[NSUserDefaults standardUserDefaults] dataForKey:LQUUIDKey]);
+ DLog(@"Returning existing UUID: %@", [[NSUserDefaults standardUserDefaults] dataForKey:LQUUIDKey]);
return [[NSUserDefaults standardUserDefaults] dataForKey:LQUUIDKey];
}
}
@@ -39,7 +39,7 @@ - (void)loadURL:(NSString *)url {
if(![[LQClient single] isLoggedIn]) {
[lqAppDelegate.tabBarController presentModalViewController:[[AuthView alloc] init] animated:YES];
} else {
- NSLog(@"Loading URL in game view %@", url);
+ DLog(@"Loading URL in game view %@", url);
[webView loadRequest:[NSMutableURLRequest requestWithURL:[NSURL URLWithString:[url stringByAppendingFormat:@"?access_token=%@", [[LQClient single] accessToken]]]]];
}
}
@@ -59,17 +59,17 @@ - (void)viewDidLoad {
}
- (void)mapAttackDataBroadcastReceived:(NSNotification *)notification {
- NSLog(@"got data broadcast");
+ DLog(@"got data broadcast");
// [[CJSONSerializer serializer] serializeDictionary:[notification userInfo]];
- NSLog(@"%@", [NSString stringWithFormat:@"if(typeof LQHandlePushData != \"undefined\") { "
+ DLog(@"%@", [NSString stringWithFormat:@"if(typeof LQHandlePushData != \"undefined\") { "
"LQHandlePushData(%@); }", [[notification userInfo] objectForKey:@"json"]]);
[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"if(typeof LQHandlePushData != \"undefined\") { "
"LQHandlePushData(%@); }", [[notification userInfo] objectForKey:@"json"]]];
-// NSLog(@"%@", [NSString stringWithFormat:@"if(typeof LQHandlePushData != \"undefined\") { "
+// DLog(@"%@", [NSString stringWithFormat:@"if(typeof LQHandlePushData != \"undefined\") { "
// "LQHandlePushData(%@); }", [[CJSONSerializer serializer] serializeDictionary:[notification userInfo]]]);
// [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"if(typeof LQHandlePushData != \"undefined\") { "
// "LQHandlePushData(%@); }", [[CJSONSerializer serializer] serializeDictionary:[notification userInfo]]]];
@@ -208,7 +208,7 @@
// We need to safely unlock before throwing any of these exceptions.
// @try {} @finally {} significantly slows things down so it's not used.
-#define RKLCHardAbortAssert(c) do { int _c=(c); if(RKL_EXPECTED(!_c, 0L)) { NSLog(@"%@:%ld: Invalid parameter not satisfying: %s\n", [NSString stringWithUTF8String:__FILE__], (long)__LINE__, #c); abort(); } } while(0)
+#define RKLCHardAbortAssert(c) do { int _c=(c); if(RKL_EXPECTED(!_c, 0L)) { DLog(@"%@:%ld: Invalid parameter not satisfying: %s\n", [NSString stringWithUTF8String:__FILE__], (long)__LINE__, #c); abort(); } } while(0)
#define RKLCAssertDictionary(d, ...) rkl_makeAssertDictionary(__PRETTY_FUNCTION__, __FILE__, __LINE__, (d), ##__VA_ARGS__)
#define RKLCDelayedHardAssert(c, e, g) do { id *_e=(e); int _c=(c); if(RKL_EXPECTED(_e == NULL, 0L) || RKL_EXPECTED(*_e != NULL, 0L)) { goto g; } if(RKL_EXPECTED(!_c, 0L)) { *_e = RKLCAssertDictionary(@"Invalid parameter not satisfying: %s", #c); goto g; } } while(0)
@@ -1046,11 +1046,11 @@ static void rkl_cleanup_cacheSpinLockStatus(volatile NSUInteger *rkl_cacheSpinLo
if(RKL_EXPECTED((rkl_cacheSpinLockStatus & RKLUnlockedCacheSpinLock) == 0UL, 0L) && RKL_EXPECTED((rkl_cacheSpinLockStatus & RKLLockedCacheSpinLock) != 0UL, 1L)) {
if(rkl_cacheSpinLock != (OSSpinLock)0) {
- if(didPrintForcedUnlockWarning == 0UL) { didPrintForcedUnlockWarning = 1UL; NSLog(@"[RegexKitLite] Unusual condition detected: Recorded that rkl_cacheSpinLock was locked, but for some reason it was not unlocked. Forcibly unlocking rkl_cacheSpinLock. Set a breakpoint at rkl_debugCacheSpinLock to debug. This warning is only printed once."); }
+ if(didPrintForcedUnlockWarning == 0UL) { didPrintForcedUnlockWarning = 1UL; DLog(@"[RegexKitLite] Unusual condition detected: Recorded that rkl_cacheSpinLock was locked, but for some reason it was not unlocked. Forcibly unlocking rkl_cacheSpinLock. Set a breakpoint at rkl_debugCacheSpinLock to debug. This warning is only printed once."); }
rkl_debugCacheSpinLock(); // Since this is an unusual condition, offer an attempt to catch it before we unlock.
OSSpinLockUnlock(&rkl_cacheSpinLock);
} else {
- if(didPrintNotLockedWarning == 0UL) { didPrintNotLockedWarning = 1UL; NSLog(@"[RegexKitLite] Unusual condition detected: Recorded that rkl_cacheSpinLock was locked, but for some reason it was not unlocked, yet rkl_cacheSpinLock is currently not locked? Set a breakpoint at rkl_debugCacheSpinLock to debug. This warning is only printed once."); }
+ if(didPrintNotLockedWarning == 0UL) { didPrintNotLockedWarning = 1UL; DLog(@"[RegexKitLite] Unusual condition detected: Recorded that rkl_cacheSpinLock was locked, but for some reason it was not unlocked, yet rkl_cacheSpinLock is currently not locked? Set a breakpoint at rkl_debugCacheSpinLock to debug. This warning is only printed once."); }
rkl_debugCacheSpinLock();
}
}
Oops, something went wrong.

0 comments on commit 926fdc9

Please sign in to comment.