|
rllib
1
|
#include "rldefine.h"

Go to the source code of this file.
Defines | |
| #define | rlMAX_EVENT 256 |
| #define | rlEvent rlSetEventLocation(__FILE__,__LINE__);rlEventPrintf |
Enumerations | |
| enum | EventTypes { rlInfo = 0, rlWarning, rlError, rlCritical, rlFatal, rlTest, rlEVENT_SIZE } |
Functions | |
| void | rlEventInit (int ac, char **av, const char *module) |
| void | rlSetEventLocation (const char *file, int line) |
| void | rlEventPrintf (int event_type, const char *format,...) |
Variables | |
| static const char | rlevent_name [][4] = { "INF", "WAR", "ERR", "CRI", "FAT", "TST" } |
| #define rlEvent rlSetEventLocation(__FILE__,__LINE__);rlEventPrintf |
| #define rlMAX_EVENT 256 |
These functions allow you to send event log messages over TCP/IP to the event log server implemented by the pvserver pcontrol (available as separate download)
See also the class rlEventLogServer.
| enum EventTypes |
Definition at line 29 of file rlevent.h.
{
rlInfo = 0,
rlWarning,
rlError,
rlCritical,
rlFatal,
rlTest,
rlEVENT_SIZE
};
| void rlEventInit | ( | int | ac, |
| char ** | av, | ||
| const char * | module | ||
| ) |
initialize rlEvent parameters: -eventhost=adr -eventport=num
Definition at line 36 of file rlevent.cpp.
{
const char *cptr;
rlwsa();
for(int i=0; i<ac; i++)
{
cptr = av[i];
if(strncmp("-eventhost=",cptr,11) == 0) toEventLogServer.setAdr(&cptr[11]);
if(strncmp("-eventport=",cptr,11) == 0) toEventLogServer.setPort(atoi(&cptr[11]));
}
rlstrncpy(rlmodule,module,sizeof(rlmodule)-1);
}
| void rlEventPrintf | ( | int | event_type, |
| const char * | format, | ||
| ... | |||
| ) |
output the message
Definition at line 80 of file rlevent.cpp.
{
if(toEventLogServer.getPort() <= 0) return;
va_list ap;
va_start(ap,format);
rlvsnprintf(rlmessage,sizeof(rlmessage)-1,format,ap);
va_end(ap);
if(event_type < 0 ) event_type = rlError;
if(event_type >= rlEVENT_SIZE) event_type = rlError;
time.getLocalTime();
#ifdef RLUNIX
snprintf(rlfinal,sizeof(rlfinal)-1,"%s %s %s %s%s\n",
rlevent_name[event_type],
time.getTimeString(),
rlmessage,
rlmodule,
rllocation
);
#endif
#ifdef __VMS
sprintf(rlfinal,"%s %s %s %s%s\n",
rlevent_name[event_type],
time.getTimeString(),
rlmessage,
rlmodule,
rllocation
);
rlfinal[rlMAX_EVENT-1] = '\0';
#endif
#ifdef RLWIN32
_snprintf(rlfinal,sizeof(rlfinal)-1,"%s %s %s %s%s\n",
rlevent_name[event_type],
time.getTimeString(),
rlmessage,
rlmodule,
rllocation
);
#endif
if(toEventLogServer.isConnected())
{
toEventLogServer.printf("%s",rlfinal);
}
else
{
toEventLogServer.connect();
if(toEventLogServer.isConnected())
{
toEventLogServer.printf("%s",rlfinal);
} // else give up
}
}
| void rlSetEventLocation | ( | const char * | file, |
| int | line | ||
| ) |
set the location where rlEvent is called
Definition at line 50 of file rlevent.cpp.
{
#ifdef RLWIN32
const char *cptr;
cptr = strrchr(file,'\\');
if(cptr != NULL) cptr++;
else cptr = file;
#endif
#ifdef __VMS
const char *cptr;
cptr = strrchr(file,']');
if(cptr != NULL) cptr++;
else cptr = file;
#endif
#ifdef RLUNIX
snprintf(rllocation,sizeof(rllocation)-1,":%s:%d",file,line);
#endif
#ifdef __VMS
sprintf(rllocation,":%s:%d",file,line);
#endif
#ifdef RLWIN32
_snprintf(rllocation,sizeof(rllocation)-1,":%s:%d",file,line);
#endif
}
const char rlevent_name[][4] = { "INF", "WAR", "ERR", "CRI", "FAT", "TST" } [static] |
1.7.5.1