Revised macro log suppression
This commit is contained in:
59
conman.c
59
conman.c
@ -770,6 +770,61 @@ static int testAndWriteSocket(SConnection * pCon, char *buffer, int iOut)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int isOK(const char *buffer)
|
||||
{
|
||||
if ((buffer[0] == 'O' && buffer[1] == 'K')
|
||||
&& (buffer[2] == '\0' || buffer[2] == '\r' || buffer[2] == '\n'))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static void testAndWriteSICSLog(SConnection * self, char *buffer, int iOut)
|
||||
{
|
||||
char *tp;
|
||||
/* We don't want to log the "OK" messages */
|
||||
if (isOK(buffer))
|
||||
return;
|
||||
|
||||
if (SCinMacro(self)) {
|
||||
tp = "M";
|
||||
if (sicsdebug())
|
||||
tp = "D";
|
||||
} else
|
||||
tp = "N";
|
||||
switch (iOut) {
|
||||
case eStatus:
|
||||
case eStart:
|
||||
case eFinish:
|
||||
case eEvent:
|
||||
case eHdbValue:
|
||||
case eHdbEvent:
|
||||
case eLog:
|
||||
case eLogError:
|
||||
case eError:
|
||||
case eWarning:
|
||||
/* Log it */
|
||||
SICSLogPrintf(iOut, "%s:%s", tp, buffer);
|
||||
return;
|
||||
case eValue:
|
||||
if (sicsdebug() || !SCinMacro(self)) {
|
||||
/* Log it */
|
||||
SICSLogPrintf(iOut, "%s:%s", tp, buffer);
|
||||
return;
|
||||
} else {
|
||||
/* Suppressed */
|
||||
/* SICSLogPrintf(iOut, "%s!:%s", tp, buffer); */
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("Unrecognized ouput code %d in testAndWriteSICSLog: FIXME!!!\n", iOut);
|
||||
SICSLogPrintf(iOut, "%s:%s", tp, buffer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int SCNormalWrite(SConnection * self, char *buffer, int iOut)
|
||||
{
|
||||
@ -784,10 +839,14 @@ int SCNormalWrite(SConnection * self, char *buffer, int iOut)
|
||||
}
|
||||
|
||||
/* log it for any case */
|
||||
#if 0
|
||||
if ( (sicsdebug() || !SCinMacro(self)) && !(iOut == eInternal
|
||||
|| (buffer[0] == 'O' && buffer[1] == 'K'
|
||||
&& (buffer[2] == '\0' || buffer[2] == '\r' || buffer[2] == '\n'))))
|
||||
SICSLogWrite(buffer, iOut);
|
||||
#else
|
||||
testAndWriteSICSLog(self, buffer, iOut);
|
||||
#endif
|
||||
|
||||
testAndWriteCommandLog(self, buffer, iOut);
|
||||
|
||||
|
Reference in New Issue
Block a user