Removed the suppression list again from logv2.c for fear of performance issues.

I rather implemented the suppression of TRANSACT messages in macro.c
This commit is contained in:
2016-05-18 11:58:52 +02:00
parent 1f23c19e1c
commit 294195c872
2 changed files with 14 additions and 28 deletions

29
logv2.c
View File

@ -32,8 +32,6 @@ static unsigned int globalLogLevel = INFO;
/*========= The list of sub systems for which full logging is enabled ==========*/ /*========= The list of sub systems for which full logging is enabled ==========*/
unsigned int logEnabledArray[MAXSUB ]; unsigned int logEnabledArray[MAXSUB ];
/*========== A list of entries to suppress =====================================*/
int suppressList;
/*================== Callback management =======================================*/ /*================== Callback management =======================================*/
typedef struct { typedef struct {
@ -256,15 +254,10 @@ unsigned int logFilter(unsigned int severity, const char *subsystem, const char
} }
/* /*
test if it is in the suppression list suppress empty messages
*/ */
status = LLDnodePtr2First(suppressList); if(strlen(logMessage) < 1) {
while (status == 1) { return 1;
LLDstringData(suppressList, buffer);
if(strstr(logMessage,buffer) != NULL){
return 1;
}
status = LLDnodePtr2Next(suppressList);
} }
@ -669,21 +662,6 @@ static int LogConfigAction(SConnection * pCon, SicsInterp * pSics,
SCWrite(pCon,GetCharArray(result),eValue); SCWrite(pCon,GetCharArray(result),eValue);
DeleteDynString(result); DeleteDynString(result);
} }
}else if (strcmp(argv[1],"suppress") == 0) {
if(argc > 2){
/*
The 1024 is related to the size of the buffer in logFilter
*/
if(strlen(argv[2]) >= 1024) {
SCWrite(pCon,"ERROR: string to suppress to long",eError);
return 0;
}
LLDstringAppend(suppressList,argv[2]);
SCSendOK(pCon);
} else {
SCWrite(pCon,"ERROR: need text to suppress",eError);
return 0;
}
} else { } else {
SCPrintf(pCon,eError,"ERROR: unknown keyword %s",argv[1]); SCPrintf(pCon,eError,"ERROR: unknown keyword %s",argv[1]);
return 0; return 0;
@ -702,7 +680,6 @@ void Logv2Init(void)
int i; int i;
callbackList = LLDcreate(sizeof(LogCBData)); callbackList = LLDcreate(sizeof(LogCBData));
suppressList = LLDstringCreate();
strcpy(logTemplate,"unconfiguredLogTemplate"); strcpy(logTemplate,"unconfiguredLogTemplate");
AddCmd("log", LogAction); AddCmd("log", LogAction);

13
macro.c
View File

@ -1083,6 +1083,13 @@ int TclPublish(SConnection * pCon, SicsInterp * pSics, void *pData,
Transact executes a command and sends a TRANSACTIONFINISHED string Transact executes a command and sends a TRANSACTIONFINISHED string
at the end. This is to permit clients to search for this string in at the end. This is to permit clients to search for this string in
order to find out when a command has finished. order to find out when a command has finished.
MK, May 2016
I changed this to write the TRANSACT strings only to the socket and not to the
log. Because this is clogging the log with useless stuff. If you want to
debug the protocol you still can sit on the line with sockspy. But I am unsure
of this change...
*/ */
@ -1091,6 +1098,7 @@ int TransactAction(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[]) int argc, char *argv[])
{ {
char pBuffer[1024]; char pBuffer[1024];
char pStartBuffer[1088];
char *pCommand; char *pCommand;
int iRet; int iRet;
@ -1101,11 +1109,12 @@ int TransactAction(SConnection * pCon, SicsInterp * pSics, void *pData,
} }
strtolower(argv[0]); strtolower(argv[0]);
if (strcmp(argv[0], "fulltransact") == 0) { if (strcmp(argv[0], "fulltransact") == 0) {
SCPrintf(pCon, eLog, "TRANSACTIONSTART %s", pCommand); snprintf(pStartBuffer, sizeof(pStartBuffer), "TRANSACTIONSTART %s", pCommand);
SCPureSockWrite(pCon, pStartBuffer,eLog);
} }
iRet = InterpExecute(pSics, pCon, pCommand); iRet = InterpExecute(pSics, pCon, pCommand);
if (pCommand != pBuffer) if (pCommand != pBuffer)
free(pCommand); free(pCommand);
SCWrite(pCon, "TRANSACTIONFINISHED", eLog); SCPureSockWrite(pCon, "TRANSACTIONFINISHED", eLog);
return iRet; return iRet;
} }