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
|
* Discard any input before sending command
|
||||||
*/
|
*/
|
||||||
while (NETAvailable(sock, 0)) {
|
if (NETAvailable(sock, 0)) {
|
||||||
/* TODO: handle unsolicited input */
|
while (NETAvailable(sock, 0)) {
|
||||||
char reply[1];
|
/* TODO: handle unsolicited input */
|
||||||
iRet = NETRead(sock, reply, 1, 0);
|
char reply[128];
|
||||||
if (iRet < 0) { /* EOF */
|
iRet = NETRead(sock, reply, 128, 0);
|
||||||
iRet = AQ_Reconnect(self);
|
if (iRet < 0) { /* EOF */
|
||||||
if (iRet == 0)
|
iRet = AQ_Reconnect(self);
|
||||||
return 0;
|
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) {
|
if (i < nchars - 1) {
|
||||||
char line[132];
|
|
||||||
int excess = nchars - 1 - i;
|
int excess = nchars - 1 - i;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
snprintf(line , sizeof(line)-1, "ERROR: %d excess chars in AsyncQueue", excess);
|
SICSLogTimePrintf(eError, &tv, "ERROR: %d excess chars in AsyncQueue %s", excess, self->queue_name);
|
||||||
SICSLogWriteTime(line, eError, &tv);
|
|
||||||
SICSLogWriteHexTime(&reply[i], excess, eError, &tv);
|
SICSLogWriteHexTime(&reply[i], excess, eError, &tv);
|
||||||
/* TODO: handle unsolicited */
|
/* TODO: handle unsolicited */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char line[132];
|
|
||||||
int excess = nchars - 1 - i;
|
int excess = nchars - 1 - i;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
snprintf(line , sizeof(line)-1, "ERROR: %d unsolicited chars in AsyncQueue", excess);
|
SICSLogTimePrintf(eError, &tv, "ERROR: %d unsolicited chars in AsyncQueue %s", excess, self->queue_name);
|
||||||
SICSLogWriteTime(line, eError, &tv);
|
|
||||||
SICSLogWriteHexTime(&reply[i], excess, eError, &tv);
|
SICSLogWriteHexTime(&reply[i], excess, eError, &tv);
|
||||||
/* TODO: handle unsolicited input */
|
/* TODO: handle unsolicited input */
|
||||||
}
|
}
|
||||||
|
|||||||
11
servlog.c
11
servlog.c
@@ -414,8 +414,6 @@ snprintf(fPath, 1023, "%s/", "../log");
|
|||||||
buf[idx++] = '\0';
|
buf[idx++] = '\0';
|
||||||
SICSLogWriteFile(buf, eOut, tp);
|
SICSLogWriteFile(buf, eOut, tp);
|
||||||
idx = 0;
|
idx = 0;
|
||||||
++cp;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else if (*cp == '\r') {
|
else if (*cp == '\r') {
|
||||||
buf[idx++] = '\\';
|
buf[idx++] = '\\';
|
||||||
@@ -431,21 +429,20 @@ snprintf(fPath, 1023, "%s/", "../log");
|
|||||||
buf[idx++] = hex[(*cp >> 4) & 0xF];
|
buf[idx++] = hex[(*cp >> 4) & 0xF];
|
||||||
buf[idx++] = hex[(*cp) & 0xF];
|
buf[idx++] = hex[(*cp) & 0xF];
|
||||||
buf[idx++] = '>';
|
buf[idx++] = '>';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
buf[idx++] = *cp;
|
buf[idx++] = *cp;
|
||||||
}
|
}
|
||||||
cp++;
|
cp++;
|
||||||
if (idx > 132) {
|
if (idx > 132) {
|
||||||
if (buf[idx - 1] != '\n')
|
buf[idx++] = '\n';
|
||||||
buf[idx++] = '\n';
|
|
||||||
buf[idx++] = '\0';
|
buf[idx++] = '\0';
|
||||||
SICSLogWriteFile(buf, eOut, tp);
|
SICSLogWriteFile(buf, eOut, tp);
|
||||||
idx = 0;
|
idx = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (idx > 0) {
|
if (idx > 0) {
|
||||||
if (buf[idx - 1] != '\n')
|
buf[idx++] = '\n';
|
||||||
buf[idx++] = '\n';
|
|
||||||
buf[idx++] = '\0';
|
buf[idx++] = '\0';
|
||||||
SICSLogWriteFile(buf, eOut, tp);
|
SICSLogWriteFile(buf, eOut, tp);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user