ompl::tools::ExperienceSetup::ExperienceSetup(const base::SpaceInformationPtr &si) : ompl::geometric::SimpleSetup(si) , recallEnabled_(true) , scratchEnabled_(true) { logInitialize(); };
int main(int argc, char** argv) { bool debug = false; QString logFile; // Parse command line for (int i = 1; i < argc; ++i) { QString arg(argv[i]); if (arg == "-debug") debug = true; else if (arg == "-log") logFile = argv[++i]; else if (arg == "-configDir") { if (i + 1 == argc) qFatal("Error: missing -configDir argument"); ConfigFile::setDefaultConfigDir(argv[++i]); } else { qFatal("Error: unknown command line argument: " + arg); } } // Use fd 10 for socket if (dup2(0, 10) != 10) exit(2); for (int fd = 0; fd < 10; ++fd) close(fd); QSocketDevice socket(10, QSocketDevice::Stream); // Decide on a log filename QString fileName = socket.peerAddress().toString() + ".log"; if (logFile.isEmpty()) { QFile file("/var/log/quasar/" + fileName); if (file.open(IO_WriteOnly | IO_Append)) logFile = file.name(); } if (logFile.isEmpty()) { QFile file(programDir() + "/../log/" + fileName); if (file.open(IO_WriteOnly | IO_Append)) logFile = file.name(); } if (logFile.isEmpty()) { QFile file(programDir() + "/../" + fileName); if (file.open(IO_WriteOnly | IO_Append)) logFile = file.name(); else logFile = "/tmp/" + fileName; } // Initialize logging logInitialize(logFile); logStatus("Connection started (pid %d)", getpid()); dup2(0, 1); dup2(0, 2); // Signal handling signal(SIGPIPE, SIG_IGN); signal(SIGINT, handleSignal); signal(SIGQUIT, handleSignal); signal(SIGTERM, handleSignal); QApplication app(argc, argv, false); // Command processing loop mainLoop(socket, debug); logStatus("Connection closed (pid %d)", getpid()); return 0; }
ompl::tools::ExperienceSetup::ExperienceSetup(const base::StateSpacePtr &space) : ompl::geometric::SimpleSetup(space) { logInitialize(); };
ompl::tools::ExperienceSetup::ExperienceSetup(const base::SpaceInformationPtr &si) : ompl::geometric::SimpleSetup(si) { logInitialize(); };
int main(int argc, char **argv) { int ioc_address_local = LOCAL_ADDRESS; ClRcT rc = CL_OK; rc = clExtInitialize(ioc_address_local); if (rc != CL_OK) { printf("Error: failed to Initialize SAFplus libraries\n"); exit(1); } nodeCacheWait(); // Demonstrate logging */ printf("\n\nOpen a global log stream and write several records to active PY node\n"); if ((rc=logInitialize()) == CL_OK) { printf("log Initialized\n"); logWrite(CL_LOG_SEV_NOTICE,"This is a test of an external app doing logging"); for(int i=0;i<100;i++) { ClTimerTimeOutT delay; delay.tsSec = 0; delay.tsMilliSec = 10; logWrite(CL_LOG_SEV_NOTICE,"external app log %d", i); clOsalTaskDelay(delay); } } else { printf("Unable to open log. Error 0x%x\n",rc); return rc; } // Open a subscribe event channel and start receiving events. printf("\n\nOpen an Event subscription\n"); const SaEvtCallbacksT evtCallbacks = { NULL, appEventCallback }; SaVersionT evtVersion = CL_EVENT_VERSION; rc = saEvtInitialize(&evtHandle, &evtCallbacks, &evtVersion); if (rc != SA_AIS_OK) { printf("Failed to init event mechanism [0x%x]\n",rc); return rc; } saNameSet(&evtChannelName,EVENT_CHANNEL_NAME); rc = saEvtChannelOpen(evtHandle,&evtChannelName, (SA_EVT_CHANNEL_SUBSCRIBER | SA_EVT_CHANNEL_CREATE), (SaTimeT)SA_TIME_END, &evtChannelHandle); if (rc != SA_AIS_OK) { printf("Failure opening event channel[0x%x] at %ld\n", rc, time(0L)); goto errorexit; } rc = saEvtEventSubscribe(evtChannelHandle, NULL, 1); if (rc != SA_AIS_OK) { printf("Failed to subscribe to event channel [0x%x]\n", rc); goto errorexit; } //open a global log stream and write several records printf("Open a publisher event channel\n"); // open a publisher event channel and openPublisherChannel(); printf("Start publishing events.\nThe PY component on active PY node subscribes to these events and logs them so you can verify receipt by looking in the clock.log.latest and app.lates on node active PY node .\n"); testEvtMainLoop(); printf("Unsubscribe event chanel.............................\n"); rc = saEvtEventUnsubscribe(evtChannelHandle,1); if (rc != SA_AIS_OK) printf("Channel unsubscribe result: %d\n", rc); printf("Close subscribe event chanel.............................\n"); rc = saEvtChannelClose(evtChannelHandle); if (rc != SA_AIS_OK) printf("Channel close result: %d\n", rc); printf("Close publish event channel.............................\n"); rc = saEvtChannelClose(evtChannelHandlePublic); if (rc != SA_AIS_OK) printf("Channel close result: %d\n", rc); // never inited: printf("Finalize publish event handle.............................\n"); // saEvtFinalize(gTestInfo.evtInitHandle); printf("Finalize xubscribe event handle.............................\n"); saEvtFinalize(evtHandle); openPublisherChannel(); testEvtMainLoop(); printf("Close publish event channel.............................\n"); rc = saEvtChannelClose(evtChannelHandlePublic); if (rc != SA_AIS_OK) printf("Channel close result: %d\n", rc); // never inited printf("Finalize publish event handle.............................\n"); // saEvtFinalize(gTestInfo.evtInitHandle); return 0; errorexit: printf ("Initialization error [0x%x]\n",rc); }