Added sicsdebug flag to control verbosity of log files.

If sicsdebug == 0 log output from commands executed in macros is
suppressed.
This commit is contained in:
Ferdi Franceschini
2013-04-20 18:55:38 +10:00
parent cdafe4d650
commit a22d403c87
2 changed files with 23 additions and 1 deletions

View File

@ -73,6 +73,7 @@
#include "statusfile.h"
#include "sicshipadaba.h"
#include "protocol.h"
#include "sicsvar.h"
/*
#define UUDEB 1
define UUDEB , for buffer writing for checking encoding */
@ -107,6 +108,24 @@ struct SCStore {
long macroStack;
commandContext cc;
};
/*
* This will return the value of a SICS int variable called "sicsdebug"
* If sicsdebug is not defined it will return 1
* TODO Maybe define debugging levels.
*
* return 0=debug off, 1=debug on or sicsdebug not defined.
*/
int sicsdebug() {
pSicsVariable debug;
debug = FindVariable(pServ->pSics, "sicsdebug");
if (debug) {
return debug->iVal;
} else {
return 1;
}
}
/*===========================================================================*/
static char *ConName(long ident)
{
@ -765,7 +784,7 @@ int SCNormalWrite(SConnection * self, char *buffer, int iOut)
}
/* log it for any case */
if (!(iOut == eInternal
if ( (sicsdebug() || !SCinMacro(self)) && !(iOut == eInternal
|| (buffer[0] == 'O' && buffer[1] == 'K'
&& (buffer[2] == '\0' || buffer[2] == '\r' || buffer[2] == '\n'))))
SICSLogWrite(buffer, iOut);

View File

@ -3,6 +3,9 @@
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
#set sicsroot /usr/local/sics
VarMake sicsdebug Int Mugger
sicsdebug 0
VarMake opal_simulation Text internal
opal_simulation true