Changes to logging

Add 'L' to 'M', 'N', 'D' log flags (for consistency)
Replace colon (':') in logfilenames with minus ('-')
Suppress spurious blank lines in logfile from line terminators
Add filename to open/close messages for chaining convenience
This commit is contained in:
Douglas Clowes
2014-07-03 15:28:05 +10:00
parent 45a1102b59
commit 0fb4519876
3 changed files with 62 additions and 32 deletions

View File

@ -789,17 +789,17 @@ static int isOK(const char *buffer)
/*--------------------------------------------------------------------------*/
static void testAndWriteSICSLog(SConnection * self, char *buffer, int iOut)
{
char *tp;
char tp;
/* We don't want to log the "OK" messages */
if (isOK(buffer))
return;
if (SCinMacro(self)) {
tp = "M";
tp = 'M';
if (sicsdebug())
tp = "D";
tp = 'D';
} else
tp = "N";
tp = 'N';
switch (iOut) {
case eStatus:
case eStart:
@ -812,22 +812,25 @@ static void testAndWriteSICSLog(SConnection * self, char *buffer, int iOut)
case eError:
case eWarning:
/* Log it */
SICSLogPrintf(iOut, "%s:%s", tp, buffer);
SICSLogWriteCode(buffer, iOut, tp);
return;
case eValue:
if (sicsdebug() || !SCinMacro(self)) {
/* Log it */
SICSLogPrintf(iOut, "%s:%s", tp, buffer);
SICSLogWriteCode(buffer, iOut, tp);
return;
} else {
/* Suppressed */
/* SICSLogPrintf(iOut, "%s!:%s", tp, buffer); */
#if 0
tp = tolower(tp);
SICSLogWriteCode(buffer, iOut, tp);
#endif
return;
}
break;
default:
printf("Unrecognized ouput code %d in testAndWriteSICSLog: FIXME!!!\n", iOut);
SICSLogPrintf(iOut, "%s:%s", tp, buffer);
SICSLogWriteCode(buffer, iOut, tp);
return;
}
}