Added hex logging back again.
Added it back in in AsyncQueue
This commit is contained in:
27
asyncqueue.c
27
asyncqueue.c
@@ -22,7 +22,7 @@
|
||||
#include "asyncqueue.h"
|
||||
#include "nwatch.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <hexString.h>
|
||||
|
||||
typedef struct __async_command AQ_Cmd, *pAQ_Cmd;
|
||||
|
||||
@@ -394,6 +394,7 @@ static int StartCommand(pAsyncQueue self)
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
Log(ERROR, "asquio","%d unsolicited chars in AsyncQueue %s",iRet, self->queue_name);
|
||||
LogHex(&tv,ERROR,SASQIO,reply,iRet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,6 +503,7 @@ static int CommandTimeout(void *cntx, int mode)
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
Log(DEBUG,"asquio", "Timeout Trace on AsyncQueue %s", self->queue_name);
|
||||
LogHex(&tv,DEBUG,SASQIO,myCmd->tran->inp_buf,myCmd->tran->inp_idx);
|
||||
}
|
||||
if (myCmd->retries > 0) {
|
||||
--myCmd->retries;
|
||||
@@ -532,6 +534,17 @@ static int DelayedStart(void *cntx, int mode)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void LogHexPrefix(struct timeval *tv, unsigned int severity, char *prefix, char *buffer, int bufferLength)
|
||||
{
|
||||
char *hexData = NULL;
|
||||
|
||||
hexData = bytesToHexString((uint8_t *)buffer,(size_t)bufferLength);
|
||||
if(hexData != NULL){
|
||||
LogTS(tv,severity,SASQIO,"%s:%s", prefix,hexData);
|
||||
free(hexData);
|
||||
}
|
||||
}
|
||||
|
||||
static int MyCallback(void *context, int mode)
|
||||
{
|
||||
pAsyncQueue self = (pAsyncQueue) context;
|
||||
@@ -567,8 +580,8 @@ static int MyCallback(void *context, int mode)
|
||||
if (self->trace) {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
Log(INFO, "asquio",
|
||||
"Received:%s:%s", self->queue_name,myCmd->tran->inp_buf);
|
||||
Log(INFO, "asquio","Input Trace on AsyncQueue %s", self->queue_name);
|
||||
LogHex(&tv,INFO,SASQIO,myCmd->tran->inp_buf, myCmd->tran->inp_idx);
|
||||
}
|
||||
PopCommand(self);
|
||||
break;
|
||||
@@ -579,7 +592,10 @@ static int MyCallback(void *context, int mode)
|
||||
Log(ERROR,"asquio",
|
||||
"Protocol error %d in AsyncQueue %s",
|
||||
iRet, self->queue_name);
|
||||
Log(ERROR,"asquio","SENT:%s:Received:%s",myCmd->tran->out_buf, myCmd->tran->inp_buf);
|
||||
LogHexPrefix(&tv,ERROR,"Sent", myCmd->tran->out_buf,myCmd->tran->out_len);
|
||||
LogHexPrefix(&tv,ERROR,"Received", myCmd->tran->inp_buf,myCmd->tran->inp_len);
|
||||
LogHexPrefix(&tv,ERROR,"Processed", &reply[0],i);
|
||||
LogHexPrefix(&tv,ERROR,"Unprocessed", &reply[i],excess);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -813,8 +829,7 @@ int AsyncUnitWrite(pAsyncUnit unit, void *buffer, int buflen)
|
||||
if (unit->queue->trace) {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
Log(DEBUG,"asquio"
|
||||
"Output Trace on AsyncQueue %s:%s", unit->queue->queue_name, buffer);
|
||||
LogHexPrefix(&tv,DEBUG,"Output Trace on AsyncQueue", buffer, buflen);
|
||||
}
|
||||
sock = AsyncUnitGetSocket(unit);
|
||||
iRet = NETWrite(sock, buffer, buflen);
|
||||
|
||||
Reference in New Issue
Block a user