#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.
00030 { 00031 rlInfo = 0, 00032 rlWarning, 00033 rlError, 00034 rlCritical, 00035 rlFatal, 00036 rlTest, 00037 rlEVENT_SIZE 00038 };
| void rlEventInit | ( | int | ac, | |
| char ** | av, | |||
| const char * | module | |||
| ) |
initialize rlEvent parameters: -eventhost=adr -eventport=num
Definition at line 36 of file rlevent.cpp.
00037 { 00038 const char *cptr; 00039 00040 rlwsa(); 00041 for(int i=0; i<ac; i++) 00042 { 00043 cptr = av[i]; 00044 if(strncmp("-eventhost=",cptr,11) == 0) toEventLogServer.setAdr(&cptr[11]); 00045 if(strncmp("-eventport=",cptr,11) == 0) toEventLogServer.setPort(atoi(&cptr[11])); 00046 } 00047 rlstrncpy(rlmodule,module,sizeof(rlmodule)-1); 00048 }
| void rlEventPrintf | ( | int | event_type, | |
| const char * | format, | |||
| ... | ||||
| ) |
output the message
Definition at line 80 of file rlevent.cpp.
00081 { 00082 if(toEventLogServer.getPort() <= 0) return; 00083 va_list ap; 00084 va_start(ap,format); 00085 rlvsnprintf(rlmessage,sizeof(rlmessage)-1,format,ap); 00086 va_end(ap); 00087 00088 if(event_type < 0 ) event_type = rlError; 00089 if(event_type >= rlEVENT_SIZE) event_type = rlError; 00090 time.getLocalTime(); 00091 #ifdef RLUNIX 00092 snprintf(rlfinal,sizeof(rlfinal)-1,"%s %s %s %s%s\n", 00093 rlevent_name[event_type], 00094 time.getTimeString(), 00095 rlmessage, 00096 rlmodule, 00097 rllocation 00098 ); 00099 #endif 00100 #ifdef __VMS 00101 sprintf(rlfinal,"%s %s %s %s%s\n", 00102 rlevent_name[event_type], 00103 time.getTimeString(), 00104 rlmessage, 00105 rlmodule, 00106 rllocation 00107 ); 00108 rlfinal[rlMAX_EVENT-1] = '\0'; 00109 #endif 00110 #ifdef RLWIN32 00111 _snprintf(rlfinal,sizeof(rlfinal)-1,"%s %s %s %s%s\n", 00112 rlevent_name[event_type], 00113 time.getTimeString(), 00114 rlmessage, 00115 rlmodule, 00116 rllocation 00117 ); 00118 #endif 00119 if(toEventLogServer.isConnected()) 00120 { 00121 toEventLogServer.printf("%s",rlfinal); 00122 } 00123 else 00124 { 00125 toEventLogServer.connect(); 00126 if(toEventLogServer.isConnected()) 00127 { 00128 toEventLogServer.printf("%s",rlfinal); 00129 } // else give up 00130 } 00131 }
| void rlSetEventLocation | ( | const char * | file, | |
| int | line | |||
| ) |
set the location where rlEvent is called
Definition at line 50 of file rlevent.cpp.
00051 { 00052 #ifdef RLWIN32 00053 const char *cptr; 00054 00055 cptr = strrchr(file,'\\'); 00056 if(cptr != NULL) cptr++; 00057 else cptr = file; 00058 #endif 00059 #ifdef __VMS 00060 const char *cptr; 00061 00062 cptr = strrchr(file,']'); 00063 if(cptr != NULL) cptr++; 00064 else cptr = file; 00065 #endif 00066 00067 #ifdef RLUNIX 00068 snprintf(rllocation,sizeof(rllocation)-1,":%s:%d",file,line); 00069 #endif 00070 00071 #ifdef __VMS 00072 sprintf(rllocation,":%s:%d",file,line); 00073 #endif 00074 00075 #ifdef RLWIN32 00076 _snprintf(rllocation,sizeof(rllocation)-1,":%s:%d",file,line); 00077 #endif 00078 }
const char rlevent_name[][4] = { "INF", "WAR", "ERR", "CRI", "FAT", "TST" } [static] |
1.6.3