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

29
macro.c
View File

@@ -67,12 +67,10 @@
#include "splitter.h"
#include "ifile.h"
#include "Dbg.h"
#include "servlog.h"
#include "sicsglobal.h"
#include "stringdict.h"
#include "exeman.h"
#include "nxcopy.h"
#include "commandlog.h"
#define SICSERROR "005567SICS"
/*----------------------------------------------------------------------------
@@ -193,7 +191,14 @@ static int SicsUnknownProc(ClientData pData, Tcl_Interp * pInter,
/* finish */
if (iRet == 1) {
WriteCommandHistory(comBuffer);
Arg2Text(argc-1,&argv[1],comBuffer,sizeof(comBuffer));
/*
suppress the sct commands: there is no point in having them in
the history
if(strstr(argv[1],"sct") == NULL){
Log(DEBUG,"history","%s",comBuffer);
}
*/
return TCL_OK;
} else {
Tcl_SetVar(pInter, SICSERROR, "yes", TCL_GLOBAL_ONLY);
@@ -476,8 +481,7 @@ int MacroFileEval(SConnection * pCon, SicsInterp * pInter, void *pData,
/* handle status first */
SICSLogWrite("Evaluating in MacroFileEval", eValue);
SICSLogWrite(argv[1], eValue);
Log(INFO,"com","Evaluating %s in MacroFileEval", argv[1]);
if (pFile) {
free(pFile);
}
@@ -604,7 +608,7 @@ int InternalFileEval(SConnection * pCon, SicsInterp * pInter, void *pData,
The output code is optional and and defaults to eStatus.
---------------------------------------------------------------------------*/
#include "outcode.c"
#include "outcode.h"
int ClientPut(SConnection * pCon, SicsInterp * pInter, void *pData,
int argc, char *argv[])
@@ -702,6 +706,17 @@ int ClientPut(SConnection * pCon, SicsInterp * pInter, void *pData,
memset(pMessage, 0, (iLen + 100) * sizeof(char));
Arg2Text(iCode - 1, &argv[1], pMessage, (iLen + 100) * sizeof(char));
/*
as the outcode is optional we have to test the message in order to get
proper outcodes for the log
*/
if(strstr(pMessage,"ERROR") != NULL){
eOut = eLogError;
}
if(strstr(pMessage,"WARNING") != NULL){
eOut = eWarning;
}
SCWrite(pCon, pMessage, eOut);
if (pMessage) {
free(pMessage);
@@ -975,9 +990,7 @@ static int TclAction(SConnection * pCon, SicsInterp * pSics, void *pData,
return 0;
}
Tcl_ResetResult(pTcl);
SetWriteHistory(0);
iRet = Tcl_Eval(pTcl, pCommand);
SetWriteHistory(1);
if (iRet == TCL_OK) {
if (strlen(pTcl->result) > 0) {
SCPrintf(pCon, eValue, "%s", pTcl->result);