mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Simplify some debug logging statements.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20776 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2defc1af93
commit
b0ffe1492d
5 changed files with 49 additions and 74 deletions
|
@ -6,6 +6,10 @@
|
|||
* Source/NSLog.m:
|
||||
* Source/NSUserDefaults.m:
|
||||
Add GSLogThread to include thread id in NSLog() and debug output.
|
||||
* Source/NSMessagePort.m:
|
||||
* Source/NSSocketPort.m:
|
||||
Remove thread reporting in some debug statements as it can be
|
||||
done universally using GSLogThread.
|
||||
|
||||
2005-02-22 11:12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -460,8 +460,7 @@ static Class runLoopClass;
|
|||
NSRunLoop *l;
|
||||
|
||||
M_LOCK(myLock);
|
||||
NSDebugMLLog(@"GSTcpHandle", @"Connecting on 0x%x in thread 0x%x before %@",
|
||||
self, GSCurrentThread(), when);
|
||||
NSDebugMLLog(@"GSTcpHandle", @"Connecting on 0x%x before %@", self, when);
|
||||
if (state != GS_H_UNCON)
|
||||
{
|
||||
BOOL result;
|
||||
|
@ -678,8 +677,7 @@ static Class runLoopClass;
|
|||
type: ET_EDESC
|
||||
forMode: nil
|
||||
all: YES];
|
||||
NSDebugMLLog(@"GSTcpHandle", @"invalidated 0x%x in thread 0x%x",
|
||||
self, GSCurrentThread());
|
||||
NSDebugMLLog(@"GSTcpHandle", @"invalidated 0x%x", self);
|
||||
[[self recvPort] removeHandle: self];
|
||||
[[self sendPort] removeHandle: self];
|
||||
}
|
||||
|
@ -705,8 +703,8 @@ static Class runLoopClass;
|
|||
extra: (void*)extra
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle", @"received %s event on 0x%x in thread 0x%x",
|
||||
type == ET_RPORT ? "read" : "write", self, GSCurrentThread());
|
||||
NSDebugMLLog(@"GSTcpHandle", @"received %s event on 0x%x",
|
||||
type == ET_RPORT ? "read" : "write", self);
|
||||
/*
|
||||
* If we have been invalidated (desc < 0) then we should ignore this
|
||||
* event and remove ourself from the runloop.
|
||||
|
@ -769,8 +767,7 @@ static Class runLoopClass;
|
|||
{
|
||||
if (res == 0)
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle", @"read eof on 0x%x in thread 0x%x",
|
||||
self, GSCurrentThread());
|
||||
NSDebugMLLog(@"GSTcpHandle", @"read eof on 0x%x", self);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
|
@ -778,16 +775,14 @@ static Class runLoopClass;
|
|||
else if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"read failed - %s on 0x%x in thread 0x%x",
|
||||
GSLastErrorStr(errno), self, GSCurrentThread());
|
||||
@"read failed - %s on 0x%x", GSLastErrorStr(errno), self);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
res = 0; /* Interrupted - continue */
|
||||
}
|
||||
NSDebugMLLog(@"GSTcpHandle", @"read %d bytes on 0x%x in thread 0x%x",
|
||||
res, self, GSCurrentThread());
|
||||
NSDebugMLLog(@"GSTcpHandle", @"read %d bytes on 0x%x", res, self);
|
||||
rLength += res;
|
||||
|
||||
while (valid == YES && rLength >= rWant)
|
||||
|
@ -1044,8 +1039,7 @@ static Class runLoopClass;
|
|||
rId = 0;
|
||||
DESTROY(rItems);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"got message %@ on 0x%x in thread 0x%x",
|
||||
pm, self, GSCurrentThread());
|
||||
@"got message %@ on 0x%x", pm, self);
|
||||
RETAIN(rp);
|
||||
M_UNLOCK(myLock);
|
||||
NS_DURING
|
||||
|
@ -1091,8 +1085,7 @@ static Class runLoopClass;
|
|||
defaultAddress = RETAIN([NSString stringWithCString:
|
||||
inet_ntoa(sockAddr.sin_addr)]);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"wrote %d bytes on 0x%x in thread 0x%x",
|
||||
len, self, GSCurrentThread());
|
||||
@"wrote %d bytes on 0x%x", len, self);
|
||||
state = GS_H_CONNECTED;
|
||||
}
|
||||
else
|
||||
|
@ -1141,8 +1134,7 @@ static Class runLoopClass;
|
|||
else
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"wrote %d bytes on 0x%x in thread 0x%x",
|
||||
res, self, GSCurrentThread());
|
||||
@"wrote %d bytes on 0x%x", res, self);
|
||||
wLength += res;
|
||||
if (wLength == l)
|
||||
{
|
||||
|
@ -1169,8 +1161,7 @@ static Class runLoopClass;
|
|||
* message completed - remove from list.
|
||||
*/
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"completed 0x%x on 0x%x in thread 0x%x",
|
||||
components, self, GSCurrentThread());
|
||||
@"completed 0x%x on 0x%x", components, self);
|
||||
wData = nil;
|
||||
wItem = 0;
|
||||
[wMsgs removeObjectAtIndex: 0];
|
||||
|
@ -1199,8 +1190,8 @@ static Class runLoopClass;
|
|||
|
||||
NSAssert([components count] > 0, NSInternalInconsistencyException);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"Sending message 0x%x %@ on 0x%x(%d) in thread 0x%x before %@",
|
||||
components, components, self, desc, GSCurrentThread(), when);
|
||||
@"Sending message 0x%x %@ on 0x%x(%d) before %@",
|
||||
components, components, self, desc, when);
|
||||
M_LOCK(myLock);
|
||||
[wMsgs addObject: components];
|
||||
|
||||
|
@ -1231,8 +1222,7 @@ static Class runLoopClass;
|
|||
M_UNLOCK(myLock);
|
||||
RELEASE(self);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"Message send 0x%x on 0x%x in thread 0x%x status %d",
|
||||
components, self, GSCurrentThread(), sent);
|
||||
@"Message send 0x%x on 0x%x status %d", components, self, sent);
|
||||
return sent;
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,8 @@ NSLogv (NSString* format, va_list args)
|
|||
{
|
||||
if (GSUserDefaultsFlag(GSLogThread) == YES)
|
||||
{
|
||||
prefix = [NSString stringWithFormat: @"[%08x] ", GSCurrentThread()];
|
||||
prefix = [NSString stringWithFormat: @"[thread:%x] ",
|
||||
GSCurrentThread()];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -267,7 +268,7 @@ NSLogv (NSString* format, va_list args)
|
|||
if (GSUserDefaultsFlag(GSLogThread) == YES)
|
||||
{
|
||||
prefix = [NSString
|
||||
stringWithFormat: @"%@ %@[%d,%08x] ",
|
||||
stringWithFormat: @"%@ %@[%d,%x] ",
|
||||
[[NSCalendarDate calendarDate]
|
||||
descriptionWithCalendarFormat: @"%Y-%m-%d %H:%M:%S.%F"],
|
||||
[[NSProcessInfo processInfo] processName],
|
||||
|
|
|
@ -374,8 +374,7 @@ static Class runLoopClass;
|
|||
const unsigned char *name;
|
||||
|
||||
M_LOCK(myLock);
|
||||
NSDebugMLLog(@"NSMessagePort", @"Connecting on 0x%x in thread 0x%x before %@",
|
||||
self, GSCurrentThread(), when);
|
||||
NSDebugMLLog(@"NSMessagePort", @"Connecting on 0x%x before %@", self, when);
|
||||
if (state != GS_H_UNCON)
|
||||
{
|
||||
BOOL result;
|
||||
|
@ -529,8 +528,7 @@ static Class runLoopClass;
|
|||
type: ET_EDESC
|
||||
forMode: nil
|
||||
all: YES];
|
||||
NSDebugMLLog(@"NSMessagePort", @"invalidated 0x%x in thread 0x%x",
|
||||
self, GSCurrentThread());
|
||||
NSDebugMLLog(@"NSMessagePort", @"invalidated 0x%x", self);
|
||||
[[self recvPort] removeHandle: self];
|
||||
[[self sendPort] removeHandle: self];
|
||||
}
|
||||
|
@ -557,8 +555,8 @@ static Class runLoopClass;
|
|||
forMode: (NSString*)mode
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort_details",
|
||||
@"received %s event on 0x%x in thread 0x%x",
|
||||
type == ET_RPORT ? "read" : "write", self, GSCurrentThread());
|
||||
@"received %s event on 0x%x",
|
||||
type == ET_RPORT ? "read" : "write", self);
|
||||
/*
|
||||
* If we have been invalidated (desc < 0) then we should ignore this
|
||||
* event and remove ourself from the runloop.
|
||||
|
@ -625,8 +623,7 @@ static Class runLoopClass;
|
|||
{
|
||||
if (res == 0)
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort", @"read eof on 0x%x in thread 0x%x",
|
||||
self, GSCurrentThread());
|
||||
NSDebugMLLog(@"NSMessagePort", @"read eof on 0x%x", self);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
|
@ -634,8 +631,7 @@ static Class runLoopClass;
|
|||
else if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort",
|
||||
@"read failed - %s on 0x%x in thread 0x%x",
|
||||
GSLastErrorStr(errno), self, GSCurrentThread());
|
||||
@"read failed - %s on 0x%x", GSLastErrorStr(errno), self);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
|
@ -643,8 +639,7 @@ static Class runLoopClass;
|
|||
res = 0; /* Interrupted - continue */
|
||||
}
|
||||
NSDebugMLLog(@"NSMessagePort_details",
|
||||
@"read %d bytes on 0x%x in thread 0x%x",
|
||||
res, self, GSCurrentThread());
|
||||
@"read %d bytes on 0x%x", res, self);
|
||||
rLength += res;
|
||||
|
||||
while (valid == YES && rLength >= rWant)
|
||||
|
@ -902,8 +897,7 @@ static Class runLoopClass;
|
|||
rId = 0;
|
||||
DESTROY(rItems);
|
||||
NSDebugMLLog(@"NSMessagePort_details",
|
||||
@"got message %@ on 0x%x in thread 0x%x",
|
||||
pm, self, GSCurrentThread());
|
||||
@"got message %@ on 0x%x", pm, self);
|
||||
RETAIN(rp);
|
||||
M_UNLOCK(myLock);
|
||||
NS_DURING
|
||||
|
@ -950,8 +944,7 @@ static Class runLoopClass;
|
|||
if (len == (int)[d length])
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort_details",
|
||||
@"wrote %d bytes on 0x%x in thread 0x%x",
|
||||
len, self, GSCurrentThread());
|
||||
@"wrote %d bytes on 0x%x", len, self);
|
||||
state = GS_H_CONNECTED;
|
||||
}
|
||||
else
|
||||
|
@ -1005,8 +998,7 @@ static Class runLoopClass;
|
|||
else
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort_details",
|
||||
@"wrote %d bytes on 0x%x in thread 0x%x",
|
||||
res, self, GSCurrentThread());
|
||||
@"wrote %d bytes on 0x%x", res, self);
|
||||
wLength += res;
|
||||
if (wLength == l)
|
||||
{
|
||||
|
@ -1031,8 +1023,7 @@ static Class runLoopClass;
|
|||
* message completed - remove from list.
|
||||
*/
|
||||
NSDebugMLLog(@"NSMessagePort_details",
|
||||
@"completed 0x%x on 0x%x in thread 0x%x",
|
||||
components, self, GSCurrentThread());
|
||||
@"completed 0x%x on 0x%x", components, self);
|
||||
wData = nil;
|
||||
wItem = 0;
|
||||
[wMsgs removeObjectAtIndex: 0];
|
||||
|
@ -1052,8 +1043,8 @@ static Class runLoopClass;
|
|||
|
||||
NSAssert([components count] > 0, NSInternalInconsistencyException);
|
||||
NSDebugMLLog(@"NSMessagePort_details",
|
||||
@"Sending message 0x%x %@ on 0x%x(%d) in thread 0x%x before %@",
|
||||
components, components, self, desc, GSCurrentThread(), when);
|
||||
@"Sending message 0x%x %@ on 0x%x(%d) before %@",
|
||||
components, components, self, desc, when);
|
||||
M_LOCK(myLock);
|
||||
[wMsgs addObject: components];
|
||||
|
||||
|
@ -1095,8 +1086,7 @@ static Class runLoopClass;
|
|||
M_UNLOCK(myLock);
|
||||
RELEASE(self);
|
||||
NSDebugMLLog(@"NSMessagePort_details",
|
||||
@"Message send 0x%x on 0x%x in thread 0x%x status %d",
|
||||
components, self, GSCurrentThread(), sent);
|
||||
@"Message send 0x%x on 0x%x status %d", components, self, sent);
|
||||
return sent;
|
||||
}
|
||||
|
||||
|
|
|
@ -424,8 +424,7 @@ static Class runLoopClass;
|
|||
NSRunLoop *l;
|
||||
|
||||
M_LOCK(myLock);
|
||||
NSDebugMLLog(@"GSTcpHandle", @"Connecting on 0x%x in thread 0x%x before %@",
|
||||
self, GSCurrentThread(), when);
|
||||
NSDebugMLLog(@"GSTcpHandle", @"Connecting on 0x%x before %@", self, when);
|
||||
if (state != GS_H_UNCON)
|
||||
{
|
||||
BOOL result;
|
||||
|
@ -646,8 +645,7 @@ static Class runLoopClass;
|
|||
type: ET_EDESC
|
||||
forMode: nil
|
||||
all: YES];
|
||||
NSDebugMLLog(@"GSTcpHandle", @"invalidated 0x%x in thread 0x%x",
|
||||
self, GSCurrentThread());
|
||||
NSDebugMLLog(@"GSTcpHandle", @"invalidated 0x%x", self);
|
||||
[[self recvPort] removeHandle: self];
|
||||
[[self sendPort] removeHandle: self];
|
||||
}
|
||||
|
@ -673,8 +671,8 @@ static Class runLoopClass;
|
|||
extra: (void*)extra
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle", @"received %s event on 0x%x in thread 0x%x",
|
||||
type == ET_RPORT ? "read" : "write", self, GSCurrentThread());
|
||||
NSDebugMLLog(@"GSTcpHandle", @"received %s event on 0x%x",
|
||||
type == ET_RPORT ? "read" : "write", self);
|
||||
/*
|
||||
* If we have been invalidated (desc < 0) then we should ignore this
|
||||
* event and remove ourself from the runloop.
|
||||
|
@ -737,8 +735,7 @@ static Class runLoopClass;
|
|||
{
|
||||
if (res == 0)
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle", @"read eof on 0x%x in thread 0x%x",
|
||||
self, GSCurrentThread());
|
||||
NSDebugMLLog(@"GSTcpHandle", @"read eof on 0x%x", self);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
|
@ -746,16 +743,14 @@ static Class runLoopClass;
|
|||
else if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"read failed - %s on 0x%x in thread 0x%x",
|
||||
GSLastErrorStr(errno), self, GSCurrentThread());
|
||||
@"read failed - %s on 0x%x", GSLastErrorStr(errno), self);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
res = 0; /* Interrupted - continue */
|
||||
}
|
||||
NSDebugMLLog(@"GSTcpHandle", @"read %d bytes on 0x%x in thread 0x%x",
|
||||
res, self, GSCurrentThread());
|
||||
NSDebugMLLog(@"GSTcpHandle", @"read %d bytes on 0x%x", res, self);
|
||||
rLength += res;
|
||||
|
||||
while (valid == YES && rLength >= rWant)
|
||||
|
@ -1012,8 +1007,7 @@ static Class runLoopClass;
|
|||
rId = 0;
|
||||
DESTROY(rItems);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"got message %@ on 0x%x in thread 0x%x",
|
||||
pm, self, GSCurrentThread());
|
||||
@"got message %@ on 0x%x", pm, self);
|
||||
RETAIN(rp);
|
||||
M_UNLOCK(myLock);
|
||||
NS_DURING
|
||||
|
@ -1059,8 +1053,7 @@ static Class runLoopClass;
|
|||
defaultAddress = RETAIN([NSString stringWithCString:
|
||||
inet_ntoa(sockAddr.sin_addr)]);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"wrote %d bytes on 0x%x in thread 0x%x",
|
||||
len, self, GSCurrentThread());
|
||||
@"wrote %d bytes on 0x%x", len, self);
|
||||
state = GS_H_CONNECTED;
|
||||
}
|
||||
else
|
||||
|
@ -1110,8 +1103,7 @@ static Class runLoopClass;
|
|||
else
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"wrote %d bytes on 0x%x in thread 0x%x",
|
||||
res, self, GSCurrentThread());
|
||||
@"wrote %d bytes on 0x%x", res, self);
|
||||
wLength += res;
|
||||
if (wLength == l)
|
||||
{
|
||||
|
@ -1136,8 +1128,7 @@ static Class runLoopClass;
|
|||
* message completed - remove from list.
|
||||
*/
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"completed 0x%x on 0x%x in thread 0x%x",
|
||||
components, self, GSCurrentThread());
|
||||
@"completed 0x%x on 0x%x", components, self);
|
||||
wData = nil;
|
||||
wItem = 0;
|
||||
[wMsgs removeObjectAtIndex: 0];
|
||||
|
@ -1157,8 +1148,8 @@ static Class runLoopClass;
|
|||
|
||||
NSAssert([components count] > 0, NSInternalInconsistencyException);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"Sending message 0x%x %@ on 0x%x(%d) in thread 0x%x before %@",
|
||||
components, components, self, desc, GSCurrentThread(), when);
|
||||
@"Sending message 0x%x %@ on 0x%x(%d) before %@",
|
||||
components, components, self, desc, when);
|
||||
M_LOCK(myLock);
|
||||
[wMsgs addObject: components];
|
||||
|
||||
|
@ -1200,8 +1191,7 @@ static Class runLoopClass;
|
|||
M_UNLOCK(myLock);
|
||||
RELEASE(self);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"Message send 0x%x on 0x%x in thread 0x%x status %d",
|
||||
components, self, GSCurrentThread(), sent);
|
||||
@"Message send 0x%x on 0x%x status %d", components, self, sent);
|
||||
return sent;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue