minor tweaks to logging improvements
r3759 | dcl | 2012-10-05 17:00:32 +1000 (Fri, 05 Oct 2012) | 1 line
This commit is contained in:
32
asyncqueue.c
32
asyncqueue.c
@@ -186,14 +186,22 @@ static int StartCommand(pAsyncQueue self)
|
||||
/*
|
||||
* Discard any input before sending command
|
||||
*/
|
||||
while (NETAvailable(sock, 0)) {
|
||||
/* TODO: handle unsolicited input */
|
||||
char reply[1];
|
||||
iRet = NETRead(sock, reply, 1, 0);
|
||||
if (iRet < 0) { /* EOF */
|
||||
iRet = AQ_Reconnect(self);
|
||||
if (iRet == 0)
|
||||
return 0;
|
||||
if (NETAvailable(sock, 0)) {
|
||||
while (NETAvailable(sock, 0)) {
|
||||
/* TODO: handle unsolicited input */
|
||||
char reply[128];
|
||||
iRet = NETRead(sock, reply, 128, 0);
|
||||
if (iRet < 0) { /* EOF */
|
||||
iRet = AQ_Reconnect(self);
|
||||
if (iRet == 0)
|
||||
return 0;
|
||||
}
|
||||
else if (iRet > 0) {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
SICSLogTimePrintf(eError, &tv, "ERROR: %d unsolicited chars in AsyncQueue %s", iRet, self->queue_name);
|
||||
SICSLogWriteHexTime(reply, iRet, eError, &tv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,23 +361,19 @@ static int MyCallback(void* context, int mode)
|
||||
}
|
||||
}
|
||||
if (i < nchars - 1) {
|
||||
char line[132];
|
||||
int excess = nchars - 1 - i;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
snprintf(line , sizeof(line)-1, "ERROR: %d excess chars in AsyncQueue", excess);
|
||||
SICSLogWriteTime(line, eError, &tv);
|
||||
SICSLogTimePrintf(eError, &tv, "ERROR: %d excess chars in AsyncQueue %s", excess, self->queue_name);
|
||||
SICSLogWriteHexTime(&reply[i], excess, eError, &tv);
|
||||
/* TODO: handle unsolicited */
|
||||
}
|
||||
}
|
||||
else {
|
||||
char line[132];
|
||||
int excess = nchars - 1 - i;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
snprintf(line , sizeof(line)-1, "ERROR: %d unsolicited chars in AsyncQueue", excess);
|
||||
SICSLogWriteTime(line, eError, &tv);
|
||||
SICSLogTimePrintf(eError, &tv, "ERROR: %d unsolicited chars in AsyncQueue %s", excess, self->queue_name);
|
||||
SICSLogWriteHexTime(&reply[i], excess, eError, &tv);
|
||||
/* TODO: handle unsolicited input */
|
||||
}
|
||||
|
||||
11
servlog.c
11
servlog.c
@@ -414,8 +414,6 @@ snprintf(fPath, 1023, "%s/", "../log");
|
||||
buf[idx++] = '\0';
|
||||
SICSLogWriteFile(buf, eOut, tp);
|
||||
idx = 0;
|
||||
++cp;
|
||||
continue;
|
||||
}
|
||||
else if (*cp == '\r') {
|
||||
buf[idx++] = '\\';
|
||||
@@ -431,21 +429,20 @@ snprintf(fPath, 1023, "%s/", "../log");
|
||||
buf[idx++] = hex[(*cp >> 4) & 0xF];
|
||||
buf[idx++] = hex[(*cp) & 0xF];
|
||||
buf[idx++] = '>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
buf[idx++] = *cp;
|
||||
}
|
||||
cp++;
|
||||
if (idx > 132) {
|
||||
if (buf[idx - 1] != '\n')
|
||||
buf[idx++] = '\n';
|
||||
buf[idx++] = '\n';
|
||||
buf[idx++] = '\0';
|
||||
SICSLogWriteFile(buf, eOut, tp);
|
||||
idx = 0;
|
||||
}
|
||||
}
|
||||
if (idx > 0) {
|
||||
if (buf[idx - 1] != '\n')
|
||||
buf[idx++] = '\n';
|
||||
buf[idx++] = '\n';
|
||||
buf[idx++] = '\0';
|
||||
SICSLogWriteFile(buf, eOut, tp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user