Made all sub systems for logging lower case

Log filtering is now based on an array of severitys per subsystem
Added a LogIS call which takes an integer for the subsystem
Added a LogTS call which allows to specify a user supplied time stamp
This commit is contained in:
2016-03-08 11:36:29 +01:00
parent 40382b2b8c
commit 5a388ab741
6 changed files with 347 additions and 152 deletions
+32 -32
View File
@@ -207,7 +207,7 @@ static void AQ_Notify(pAsyncQueue self, int event)
{
pAsyncUnit unit;
if (self->state != eAsyncConnected)
Log(DEBUG,"ASQUIO", "Function:%s:%s", self->queue_name,
Log(DEBUG,"asquio", "Function:%s:%s", self->queue_name,
__func__);
for (unit = self->units; unit; unit = unit->next)
if (unit->notify_func != NULL)
@@ -222,7 +222,7 @@ static int TimedReconnect(void *cntx, int mode)
self->nw_tmr = 0;
if (self->state != eAsyncConnected)
Log(DEBUG,"ASQUIO", "Function: %s:%s\n", self->queue_name,
Log(DEBUG,"asquio", "Function: %s:%s\n", self->queue_name,
__func__);
AQ_Purge(self);
@@ -240,7 +240,7 @@ static int TimedReconnect(void *cntx, int mode)
if (iRet < 0) {
snprintf(line, 132, "Failed reconnect on AsyncQueue '%s'",
self->queue_name);
Log(DEBUG,"ASQUIO","%s",line);
Log(DEBUG,"asquio","%s",line);
/* Timer for retry */
NetWatchSetMode(self->nw_ctx, 0);
/* implement an exponential backoff within limits */
@@ -251,12 +251,12 @@ static int TimedReconnect(void *cntx, int mode)
self->retryTimer = 16000;
AQ_SetTimer(self, self->retryTimer,
TimedReconnect, self);
Log(DEBUG,"ASQUIO", "In %s:%s: state %s => eAsyncWaiting",
Log(DEBUG,"asquio", "In %s:%s: state %s => eAsyncWaiting",
self->queue_name, __func__, state_name(self->state));
self->state = eAsyncWaiting;
} else {
NetWatchSetMode(self->nw_ctx, nwatch_write);
Log(DEBUG,"ASQUIO", "In %s:%s: state %s => eAsyncConnecting\n",
Log(DEBUG,"asquio", "In %s:%s: state %s => eAsyncConnecting\n",
self->queue_name, __func__, state_name(self->state));
self->state = eAsyncConnecting;
/* await reconnect result in MyCallback */
@@ -264,11 +264,11 @@ static int TimedReconnect(void *cntx, int mode)
return 1;
}
NetWatchSetMode(self->nw_ctx, nwatch_read);
Log(DEBUG,"ASQUIO", "In %s:%s: state %s => eAsyncConnected\n",
Log(DEBUG,"asquio", "In %s:%s: state %s => eAsyncConnected\n",
self->queue_name, __func__, state_name(self->state));
self->state = eAsyncConnected;
snprintf(line, 132, "Reconnect on AsyncQueue '%s'", self->queue_name);
Log(DEBUG,"ASQUIO","%s",line);
Log(DEBUG,"asquio","%s",line);
AQ_Purge(self);
AQ_Notify(self, AQU_RECONNECT);
return 1;
@@ -280,7 +280,7 @@ static int AQ_Reconnect(pAsyncQueue self)
char line[132];
if (self->state != eAsyncConnected)
Log(DEBUG,"ASQUIO", "Function: %s:%s\n", self->queue_name,
Log(DEBUG,"asquio", "Function: %s:%s\n", self->queue_name,
__func__);
/*
* Remove any old timer
@@ -290,7 +290,7 @@ static int AQ_Reconnect(pAsyncQueue self)
if (self->state == eAsyncConnected) {
self->state = eAsyncIdle;
Log(DEBUG,"ASQUIO", "Disconnect on AsyncQueue '%s'", self->queue_name);
Log(DEBUG,"asquio", "Disconnect on AsyncQueue '%s'", self->queue_name);
AQ_Notify(self, AQU_DISCONNECT);
AQ_Purge(self);
}
@@ -310,12 +310,12 @@ static int AQ_Reconnect(pAsyncQueue self)
self->retryTimer = 125; /* initial delay */
AQ_SetTimer(self, self->retryTimer,
TimedReconnect, self);
Log(DEBUG,"ASQUIO", "In %s:%s: state %s => eAsyncWaiting\n",
Log(DEBUG,"asquio", "In %s:%s: state %s => eAsyncWaiting\n",
self->queue_name, __func__, state_name(self->state));
self->state = eAsyncWaiting;
} else {
NetWatchSetMode(self->nw_ctx, nwatch_write);
Log(DEBUG,"ASQUIO", "In %s:%s: state %s => eAsyncConnecting\n",
Log(DEBUG,"asquio", "In %s:%s: state %s => eAsyncConnecting\n",
self->queue_name, __func__, state_name(self->state));
self->state = eAsyncConnecting;
/* await reconnect result in MyCallback */
@@ -323,11 +323,11 @@ static int AQ_Reconnect(pAsyncQueue self)
return iRet;
}
NetWatchSetMode(self->nw_ctx, nwatch_read);
Log(DEBUG,"ASQUIO", "In %s:%s: state %s => eAsyncConnected\n",
Log(DEBUG,"asquio", "In %s:%s: state %s => eAsyncConnected\n",
self->queue_name, __func__, state_name(self->state));
self->state = eAsyncConnected;
snprintf(line, 132, "Reconnect on AsyncQueue '%s'", self->queue_name);
Log(DEBUG,"ASQUIO",line);
Log(DEBUG,"asquio",line);
AQ_Purge(self);
AQ_Notify(self, AQU_RECONNECT);
return 1;
@@ -344,7 +344,7 @@ static int StartCommand(pAsyncQueue self)
int iRet = 0;
if (self->state != eAsyncConnected)
Log(DEBUG,"ASQUIO", "Function: %s:%s\n", self->queue_name,
Log(DEBUG,"asquio", "Function: %s:%s\n", self->queue_name,
__func__);
if (myCmd == NULL)
return OKOK;
@@ -393,7 +393,7 @@ static int StartCommand(pAsyncQueue self)
} else if (iRet > 0) {
struct timeval tv;
gettimeofday(&tv, NULL);
Log(ERROR, "ASQUIO","%d unsolicited chars in AsyncQueue %s",iRet, self->queue_name);
Log(ERROR, "asquio","%d unsolicited chars in AsyncQueue %s",iRet, self->queue_name);
}
}
}
@@ -501,7 +501,7 @@ static int CommandTimeout(void *cntx, int mode)
if (self->trace) {
struct timeval tv;
gettimeofday(&tv, NULL);
Log(DEBUG,"ASQUIO", "Timeout Trace on AsyncQueue %s", self->queue_name);
Log(DEBUG,"asquio", "Timeout Trace on AsyncQueue %s", self->queue_name);
}
if (myCmd->retries > 0) {
--myCmd->retries;
@@ -525,7 +525,7 @@ static int DelayedStart(void *cntx, int mode)
{
pAsyncQueue self = (pAsyncQueue) cntx;
if (self->state != eAsyncConnected)
Log(DEBUG,"ASQUIO", "Function: %s:%s\n", self->queue_name,
Log(DEBUG,"asquio", "Function: %s:%s\n", self->queue_name,
__func__);
self->nw_tmr = 0;
StartCommand(self);
@@ -537,7 +537,7 @@ static int MyCallback(void *context, int mode)
pAsyncQueue self = (pAsyncQueue) context;
if (self->state != eAsyncConnected)
Log(DEBUG,"ASQUIO", "Function: %s:%s\n", self->queue_name,
Log(DEBUG,"asquio", "Function: %s:%s\n", self->queue_name,
__func__);
if (mode & nwatch_read) {
int iRet;
@@ -567,7 +567,7 @@ static int MyCallback(void *context, int mode)
if (self->trace) {
struct timeval tv;
gettimeofday(&tv, NULL);
Log(INFO, "ASQUIO",
Log(INFO, "asquio",
"Received:%s:%s", self->queue_name,myCmd->tran->inp_buf);
}
PopCommand(self);
@@ -576,10 +576,10 @@ static int MyCallback(void *context, int mode)
int excess = nchars - 1 - i;
struct timeval tv;
gettimeofday(&tv, NULL);
Log(ERROR,"ASQUIO",
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);
Log(ERROR,"asquio","SENT:%s:Received:%s",myCmd->tran->out_buf, myCmd->tran->inp_buf);
break;
}
}
@@ -587,7 +587,7 @@ static int MyCallback(void *context, int mode)
int excess = nchars - 1 - i;
struct timeval tv;
gettimeofday(&tv, NULL);
Log(ERROR, "ASQUIO", "%d excess chars in AsyncQueue %s",
Log(ERROR, "asquio", "%d excess chars in AsyncQueue %s",
excess, self->queue_name);
/* TODO: handle unsolicited */
}
@@ -595,7 +595,7 @@ static int MyCallback(void *context, int mode)
int excess = nchars - 1 - i;
struct timeval tv;
gettimeofday(&tv, NULL);
Log(ERROR, "ASQUIO", "%d unsolicited chars in AsyncQueue %s",
Log(ERROR, "asquio", "%d unsolicited chars in AsyncQueue %s",
excess, self->queue_name);
/* TODO: handle unsolicited input */
}
@@ -603,10 +603,10 @@ static int MyCallback(void *context, int mode)
}
if (mode & nwatch_write) {
char line[132];
Log(DEBUG,"ASQUIO", "Writeable socket callback on AsyncQueue %s",
Log(DEBUG,"asquio", "Writeable socket callback on AsyncQueue %s",
self->queue_name);
NetWatchSetMode(self->nw_ctx, nwatch_read);
Log(DEBUG,"ASQUIO", "In %s:%s: state %s => eAsyncConnected\n",
Log(DEBUG,"asquio", "In %s:%s: state %s => eAsyncConnected\n",
self->queue_name, __func__, state_name(self->state));
self->state = eAsyncConnected;
}
@@ -620,7 +620,7 @@ int AsyncUnitEnqueueHead(pAsyncUnit unit, pAsyncTxn context)
assert(unit && unit->queue && unit->queue->protocol);
myCmd = (pAQ_Cmd) malloc(sizeof(AQ_Cmd));
if (myCmd == NULL) {
Log(ERROR,"ASQUIO","Out of memory in AsyncUnitEnqueHead", eError);
Log(ERROR,"asquio","Out of memory in AsyncUnitEnqueHead", eError);
return 0;
}
memset(myCmd, 0, sizeof(AQ_Cmd));
@@ -639,7 +639,7 @@ int AsyncUnitEnqueueTxn(pAsyncUnit unit, pAsyncTxn pTxn)
assert(unit && unit->queue && unit->queue->protocol);
myCmd = (pAQ_Cmd) malloc(sizeof(AQ_Cmd));
if (myCmd == NULL) {
Log(ERROR,"ASQUIO","%s","Out of memory in AsyncUnitEnqueueTxn");
Log(ERROR,"asquio","%s","Out of memory in AsyncUnitEnqueueTxn");
return 0;
}
memset(myCmd, 0, sizeof(AQ_Cmd));
@@ -661,7 +661,7 @@ pAsyncTxn AsyncUnitPrepareTxn(pAsyncUnit unit,
assert(unit);
myTxn = (pAsyncTxn) malloc(sizeof(AsyncTxn));
if (myTxn == NULL) {
Log(ERROR,"ASQUIO","%s","Out of memory in AsyncUnitPrepareTxn", eError);
Log(ERROR,"asquio","%s","Out of memory in AsyncUnitPrepareTxn", eError);
return NULL;
}
memset(myTxn, 0, sizeof(AsyncTxn));
@@ -696,7 +696,7 @@ pAsyncTxn AsyncUnitPrepareTxn(pAsyncUnit unit,
} else {
myTxn->out_buf = (char *) malloc(cmd_len + 5);
if (myTxn->out_buf == NULL) {
Log(ERROR,"ASQUIO","%s","Out of memory in AsyncUnitPrepareTxn");
Log(ERROR,"asquio","%s","Out of memory in AsyncUnitPrepareTxn");
free(myTxn);
return NULL;
}
@@ -715,7 +715,7 @@ pAsyncTxn AsyncUnitPrepareTxn(pAsyncUnit unit,
else {
myTxn->inp_buf = malloc(rsp_len + 1);
if (myTxn->inp_buf == NULL) {
Log(ERROR,"ASQUIO","%s","Out of memory in AsyncUnitPrepareTxn", eError);
Log(ERROR,"asquio","%s","Out of memory in AsyncUnitPrepareTxn", eError);
free(myTxn->out_buf);
free(myTxn);
return NULL;
@@ -813,7 +813,7 @@ int AsyncUnitWrite(pAsyncUnit unit, void *buffer, int buflen)
if (unit->queue->trace) {
struct timeval tv;
gettimeofday(&tv, NULL);
Log(DEBUG,"ASQUIO"
Log(DEBUG,"asquio"
"Output Trace on AsyncQueue %s:%s", unit->queue->queue_name, buffer);
}
sock = AsyncUnitGetSocket(unit);
@@ -1380,7 +1380,7 @@ int AsyncUnitCreateHost(const char *host, const char *port,
unit = (pAsyncUnit) malloc(sizeof(AsyncUnit));
if (unit == NULL) {
Log(ERROR,"ASQUIO","%s","Out of memory in AsyncUnitCreateHost", eError);
Log(ERROR,"asquio","%s","Out of memory in AsyncUnitCreateHost", eError);
*handle = NULL;
return 0;
}