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
+37 -22
View File
@@ -5,26 +5,41 @@
Mark Koennecke, November 1996
----------------------------------------------------------------------------*/
#ifndef POUTCODE
#define POUTCODE
#include "Scommon.h"
#include "outcode.h"
#include <strings.h>
static char *pCode[] = {
"internal",
"command",
"hwerror",
"inerror",
"status",
"value",
"start",
"finish",
"event",
"warning",
"error",
"hdbvalue",
"hdbevent",
"log",
"logerror",
NULL
};
static int iNoCodes = 15;
#endif
const char* OutCodeToTxt(OutCode eOut)
{
switch (eOut) {
case eInternal: return "Int"; /* internal */
case eCommand: return "Cmd"; /* reserved, not used */
case eHWError: return "ErH"; /* reserved, used only for SICSLog */
case eInError: return "ErI"; /* reserved, used as a mark in the handling of output codes */
case eStatus: return "Sta"; /* reserved, deprecated */
case eValue: return "Val"; /* value reponse: copied into Tcl */
case eStart: return "Beg"; /* start message */
case eFinish: return "End"; /* finish message */
case eEvent: return "Evt"; /* some callback messages */
case eWarning: return "Wrn"; /* warnings */
case eError: return "Err"; /* error: copied into Tcl */
case eHdbValue: return "HVa"; /* hipadaba value chnage */
case eHdbEvent: return "HEv"; /* Hipadaba event */
case eLog: return "Log"; /* log message: is always written to client */
case eLogError: return "ErL"; /* error message to log: is always written to client */
}
return "???";
}
int OutCodeFromText(const char *text, OutCode *outcode)
{
int i;
for (i = 0; i < iNoCodes; ++i) {
if (strcasecmp(text, pCode[i]) == 0) {
if (outcode)
*outcode = i;
return i;
}
}
return -1;
}