mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 17:12:03 +00:00
Improve debug logging.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27650 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0ead926e50
commit
56e7d48468
2 changed files with 37 additions and 19 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2009-01-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSHTTPURLHandle.m:
|
||||||
|
Improve debug logging by including the address of the actual
|
||||||
|
handle concerned so that you can see which handle is doing what
|
||||||
|
when there are multiple handles in use.
|
||||||
|
|
||||||
2009-01-21 Richard Frith-Macdonald <rfm@gnu.org>
|
2009-01-21 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSUserDefaults.m: ([setObject:forKey:]) copy the object
|
* Source/NSUserDefaults.m: ([setObject:forKey:]) copy the object
|
||||||
|
|
|
@ -242,7 +242,7 @@ static void debugRead(GSHTTPURLHandle *handle, NSData *data)
|
||||||
#endif
|
#endif
|
||||||
if (d >= 0)
|
if (d >= 0)
|
||||||
{
|
{
|
||||||
s = [NSString stringWithFormat: @"\nRead for %x at %@ %u bytes - '",
|
s = [NSString stringWithFormat: @"\nRead for %p at %@ %u bytes - '",
|
||||||
handle, [NSDate date], [data length]];
|
handle, [NSDate date], [data length]];
|
||||||
write(d, [s cString], [s cStringLength]);
|
write(d, [s cString], [s cStringLength]);
|
||||||
write(d, [data bytes], [data length]);
|
write(d, [data bytes], [data length]);
|
||||||
|
@ -266,7 +266,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
#endif
|
#endif
|
||||||
if (d >= 0)
|
if (d >= 0)
|
||||||
{
|
{
|
||||||
s = [NSString stringWithFormat: @"\nWrite for %x at %@ %u bytes - '",
|
s = [NSString stringWithFormat: @"\nWrite for %p at %@ %u bytes - '",
|
||||||
handle, [NSDate date], [data length]];
|
handle, [NSDate date], [data length]];
|
||||||
write(d, [s cString], [s cStringLength]);
|
write(d, [s cString], [s cStringLength]);
|
||||||
write(d, [data bytes], [data length]);
|
write(d, [data bytes], [data length]);
|
||||||
|
@ -376,7 +376,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
[urlOrder removeObjectAtIndex: 0];
|
[urlOrder removeObjectAtIndex: 0];
|
||||||
}
|
}
|
||||||
[urlLock unlock];
|
[urlLock unlock];
|
||||||
//NSLog(@"Cache handle %@ for '%@'", self, page);
|
//NSLog(@"Cache handle %p for '%@'", self, page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
@ -405,7 +405,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
NSMapEnumerator enumerator;
|
NSMapEnumerator enumerator;
|
||||||
|
|
||||||
IF_NO_GC([self retain];)
|
IF_NO_GC([self retain];)
|
||||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
if (debug)
|
||||||
|
NSLog(@"%@ %p %s", NSStringFromSelector(_cmd), self, keepalive?"K":"");
|
||||||
|
|
||||||
s = [basic mutableCopy];
|
s = [basic mutableCopy];
|
||||||
if ([[u query] length] > 0)
|
if ([[u query] length] > 0)
|
||||||
|
@ -551,7 +552,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
|
|
||||||
IF_NO_GC([self retain];)
|
IF_NO_GC([self retain];)
|
||||||
|
|
||||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
if (debug)
|
||||||
|
NSLog(@"%@ %p %s", NSStringFromSelector(_cmd), self, keepalive?"K":"");
|
||||||
d = [dict objectForKey: NSFileHandleNotificationDataItem];
|
d = [dict objectForKey: NSFileHandleNotificationDataItem];
|
||||||
if (debug == YES) debugRead(self, d);
|
if (debug == YES) debugRead(self, d);
|
||||||
readCount = [d length];
|
readCount = [d length];
|
||||||
|
@ -565,8 +567,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
*/
|
*/
|
||||||
if (debug == YES && [d length] != 0)
|
if (debug == YES && [d length] != 0)
|
||||||
{
|
{
|
||||||
NSLog(@"%@ %s Unexpected data (%*.*s) from remote!",
|
NSLog(@"%@ %p %s Unexpected data (%*.*s) from remote!",
|
||||||
NSStringFromSelector(_cmd), keepalive?"K":"",
|
NSStringFromSelector(_cmd), self, keepalive?"K":"",
|
||||||
[d length], [d length], [d bytes]);
|
[d length], [d length], [d bytes]);
|
||||||
}
|
}
|
||||||
[nc removeObserver: self name: nil object: sock];
|
[nc removeObserver: self name: nil object: sock];
|
||||||
|
@ -802,7 +804,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
GSMimeParser *p = [GSMimeParser new];
|
GSMimeParser *p = [GSMimeParser new];
|
||||||
|
|
||||||
IF_NO_GC([self retain];)
|
IF_NO_GC([self retain];)
|
||||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
if (debug)
|
||||||
|
NSLog(@"%@ %p %s", NSStringFromSelector(_cmd), self, keepalive?"K":"");
|
||||||
d = [dict objectForKey: NSFileHandleNotificationDataItem];
|
d = [dict objectForKey: NSFileHandleNotificationDataItem];
|
||||||
if (debug == YES) debugRead(self, d);
|
if (debug == YES) debugRead(self, d);
|
||||||
|
|
||||||
|
@ -876,7 +879,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
NSString *path;
|
NSString *path;
|
||||||
|
|
||||||
IF_NO_GC([self retain];)
|
IF_NO_GC([self retain];)
|
||||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
if (debug)
|
||||||
|
NSLog(@"%@ %p %s", NSStringFromSelector(_cmd), self, keepalive?"K":"");
|
||||||
|
|
||||||
path = [[u path] stringByTrimmingSpaces];
|
path = [[u path] stringByTrimmingSpaces];
|
||||||
if ([path length] == 0)
|
if ([path length] == 0)
|
||||||
|
@ -1047,7 +1051,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
NSString *e;
|
NSString *e;
|
||||||
|
|
||||||
IF_NO_GC([self retain];)
|
IF_NO_GC([self retain];)
|
||||||
if (debug) NSLog(@"%@ %s", NSStringFromSelector(_cmd), keepalive?"K":"");
|
if (debug)
|
||||||
|
NSLog(@"%@ %p %s", NSStringFromSelector(_cmd), self, keepalive?"K":"");
|
||||||
e = [userInfo objectForKey: GSFileHandleNotificationError];
|
e = [userInfo objectForKey: GSFileHandleNotificationError];
|
||||||
if (e != nil)
|
if (e != nil)
|
||||||
{
|
{
|
||||||
|
@ -1065,11 +1070,13 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
DESTROY(sock);
|
DESTROY(sock);
|
||||||
connectionState = idle;
|
connectionState = idle;
|
||||||
if (debug)
|
if (debug)
|
||||||
NSLog(@"%@ restart on new connection", NSStringFromSelector(_cmd));
|
NSLog(@"%@ %p restart on new connection",
|
||||||
|
NSStringFromSelector(_cmd), self);
|
||||||
[self _tryLoadInBackground: u];
|
[self _tryLoadInBackground: u];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NSLog(@"Failed to write command to socket - %@", e);
|
NSLog(@"Failed to write command to socket - %@ %p %s",
|
||||||
|
e, self, keepalive?"K":"");
|
||||||
/*
|
/*
|
||||||
* Tell superclass that the load failed - let it do housekeeping.
|
* Tell superclass that the load failed - let it do housekeeping.
|
||||||
*/
|
*/
|
||||||
|
@ -1259,7 +1266,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
NSLog(@"%@ check for reusable socket", NSStringFromSelector(_cmd));
|
NSLog(@"%@ %p check for reusable socket",
|
||||||
|
NSStringFromSelector(_cmd), self);
|
||||||
}
|
}
|
||||||
[nc addObserver: self
|
[nc addObserver: self
|
||||||
selector: @selector(bgdRead:)
|
selector: @selector(bgdRead:)
|
||||||
|
@ -1280,7 +1288,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
NSLog(@"%@ check for reusable socket", NSStringFromSelector(_cmd));
|
NSLog(@"%@ %p check for reusable socket",
|
||||||
|
NSStringFromSelector(_cmd), self);
|
||||||
}
|
}
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
|
@ -1306,11 +1315,13 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
{
|
{
|
||||||
if (sock == nil)
|
if (sock == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"%@ socket closed by remote", NSStringFromSelector(_cmd));
|
NSLog(@"%@ %p socket closed by remote",
|
||||||
|
NSStringFromSelector(_cmd), self);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSLog(@"%@ socket is still open", NSStringFromSelector(_cmd));
|
NSLog(@"%@ %p socket is still open",
|
||||||
|
NSStringFromSelector(_cmd), self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1419,8 +1430,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
connectionState = connecting;
|
connectionState = connecting;
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
NSLog(@"%@ start connect to %@:%@",
|
NSLog(@"%@ %p start connect to %@:%@",
|
||||||
NSStringFromSelector(_cmd), host, port);
|
NSStringFromSelector(_cmd), self, host, port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1509,7 +1520,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
|| [propertyKey isKindOfClass: [NSString class]] == NO)
|
|| [propertyKey isKindOfClass: [NSString class]] == NO)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"%@ with invalid key", NSStringFromSelector(_cmd)];
|
format: @"%@ %p with invalid key", NSStringFromSelector(_cmd), self];
|
||||||
}
|
}
|
||||||
if ([propertyKey hasPrefix: @"GSHTTPProperty"]
|
if ([propertyKey hasPrefix: @"GSHTTPProperty"]
|
||||||
|| [propertyKey hasPrefix: @"NSHTTPProperty"])
|
|| [propertyKey hasPrefix: @"NSHTTPProperty"])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue