/*************************************************************************/ /* */ /* COPYRIGHT (c), 2002, Porta Systems Ltd. */ /* All rights reserved. Any unauthorised reproduction is strictly */ /* prohibited. */ /* */ #include #include #include #include using namespace std; #include class Logger { public: enum EventType { DebugEvent = 0x01, StatusEvent = 0x02, InfoEvent = 0x04, WarnEvent = 0x08, ErrorEvent = 0x10, SystemEvent = 0x20, FatalEvent = 0x40 }; // logging static void logEvent(EventType eventType, const char* eventId, const char* format, ...); static void logEvent(EventType eventType, const char* eventId, const char* format, va_list& args); // To allow indirect calling via another function }; void Logger::logEvent(EventType eventType, const char* eventId, const char* format, ...) { // format event message char eventMsg[4196]; va_list args; va_start(args, format); vsprintf(eventMsg, format, args); va_end(args); } void Logger::logEvent(EventType eventType, const char* eventId, const char* format, va_list& args) { // format event message char eventMsg[4196]; vsprintf(eventMsg, format, args); } class ServiceAppLight { public: // logging static void logEvent(Logger::EventType eventType, const char* eventId, const char* format, ...); }; void ServiceAppLight::logEvent(Logger::EventType eventType, const char* eventId, const char* format, ...) { va_list args; va_start(args, format); Logger::logEvent(eventType, eventId, format, args); va_end(args); } class MsgMoverService : public ServiceAppLight { public: MsgMoverService(); int runService(int argc, char** argv); }; MsgMoverService::MsgMoverService(): ServiceAppLight() { } int MsgMoverService::runService(int argc, char** argv) { char *Temp ; Temp = "Test String" ; Logger::logEvent(Logger::DebugEvent, "TEST", "Test Call %s", Temp); } int main(int argc, char** argv) { MsgMoverService msgMoverService; msgMoverService.runService(argc, argv); }