Reduce verbosity of log files when using JSON protocol.

This commit is contained in:
Ferdi Franceschini
2013-04-10 19:49:19 +10:00
parent c466d85bba
commit 1d7681e326

View File

@ -489,9 +489,12 @@ int SCWriteSycamore(SConnection * pCon, char *pBuffer, int iOut)
return 0;
}
snprintf(pBueffel,sizeof(pBueffel)-1, "Next line intended for socket: %d", pCon->sockHandle);
SICSLogWrite(pBueffel, eInternal);
SICSLogWrite(pBuffer, iOut);
iRet=snprintf(pBueffel,sizeof(pBueffel)-1, "[%d]:%s", pCon->sockHandle, pBuffer);
SICSLogWrite(pBueffel, iOut);
if (iRet >= MAXMSG) {
snprintf(pBueffel,sizeof(pBueffel)-1, "TRUNCATED MESSAGE: message len=%d, MAXMSG=%d",strlen(pBuffer), MAXMSG);
SICSLogWrite(pBueffel, eError);
}
/* write to commandlog if user or manager privilege */
if (SCGetRights(pCon) <= usUser) {
@ -683,10 +686,13 @@ int SCWriteJSON_String(SConnection * pCon, char *pBuffer, int iOut)
if (strlen(pBuffer) == 0)
return 1;
if (pCon->iMacro != 1) {
snprintf(pBueffel,sizeof(pBueffel)-1, "Next line intended for socket: %d", pCon->sockHandle);
SICSLogWrite(pBueffel, eInternal);
SICSLogWrite(pBuffer, iOut);
if (!SCinMacro(pCon)) {
iRet=snprintf(pBueffel,sizeof(pBueffel)-1, "[%d]:%s", pCon->sockHandle, pBuffer);
SICSLogWrite(pBueffel, iOut);
if (iRet >= MAXMSG) {
snprintf(pBueffel,sizeof(pBueffel)-1, "TRUNCATED MESSAGE: message len=%d, MAXMSG=%d",strlen(pBuffer), MAXMSG);
SICSLogWrite(pBueffel, eError);
}
}
/* write to commandlog if user or manager privilege */