This is the first working version of the new logging system. Some work

in fine tuning still needs to be done. But is reasonably OK now.
This commit is contained in:
2016-02-11 13:40:31 +01:00
parent b1cda3f579
commit 66466c1c0f
56 changed files with 420 additions and 1845 deletions

View File

@ -72,14 +72,12 @@
#include "fortify.h"
#include "sics.h"
#include "splitter.h"
#include "servlog.h"
#include "macro.h"
#include "interface.h"
#include "motor.h"
#include "obdes.h"
#include "lld.h"
#include "dynstring.h"
#include "commandlog.h"
/* M.Z. */
#include "definealias.h"
@ -101,7 +99,7 @@ SicsInterp *InitInterp(void)
pInter = (SicsInterp *) malloc(sizeof(SicsInterp));
if (!pInter) {
SICSLogWrite("Error allocating memory for Interpreter", eInternal);
Log(FATAL,"sys","Error allocating memory for Interpreter");
return NULL;
}
memset(pInter, 0, sizeof(SicsInterp));
@ -140,7 +138,7 @@ int AddCommandWithFlag(SicsInterp * pInterp, char *pName, ObjectFunc pFunc,
pNew = (CommandList *) malloc(sizeof(CommandList));
if (!pNew) {
snprintf(pBueffel,sizeof(pBueffel)-1, "Out of memory creating command - %s -", pName);
SICSLogWrite(pBueffel, eInternal);
Log(ERROR,"sys","%s",pBueffel);
return 0;
}
memset(pNew, 0, sizeof(CommandList));
@ -296,7 +294,7 @@ int InterpExecute(SicsInterp * self, SConnection * pCon, char *pText)
assert(self);
assert(pCon);
/* write info to Log */
/* write info to Log
if (pCon->sockHandle >= 0) {
snprintf(pBueffel,1023, "Executing -> %s <- from socket %d", pText,
pCon->sockHandle);
@ -306,6 +304,11 @@ int InterpExecute(SicsInterp * self, SConnection * pCon, char *pText)
SICSLogWrite(pBueffel, eCommand);
}
TODO: disabled for now. This is a duplication of what is logged in SCInvoke.
Mark Koennecke, February 2016
*/
if(strstr(pText,tclescape) == pText){
return TclExecFunc(pCon,self,NULL,pText);
}
@ -361,7 +364,7 @@ int InterpExecute(SicsInterp * self, SConnection * pCon, char *pText)
* log in history if succesfull
*/
if(iRet == 1){
WriteCommandHistory(pText);
Log(DEBUG,"history","%s",pText);
}