void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { // create a log writer for error messages if this is the // first MATLAB function call initLogger(); // flag specifying the class int iclass = getInt(prhs[0]); // Hand off to the appropriate routine, based on the // value of the first parameter switch (iclass) { case NO_CLASS: ctfunctions(nlhs, plhs, nrhs, prhs); break; case XML_CLASS: xmlmethods(nlhs, plhs, nrhs, prhs); break; case THERMO_CLASS: thermomethods(nlhs, plhs, nrhs, prhs); break; case PHASE_CLASS: phasemethods(nlhs, plhs, nrhs, prhs); break; case MIXTURE_CLASS: mixturemethods(nlhs, plhs, nrhs, prhs); break; case KINETICS_CLASS: kineticsmethods(nlhs, plhs, nrhs, prhs); break; case TRANSPORT_CLASS: transportmethods(nlhs, plhs, nrhs, prhs); break; case REACTOR_CLASS: reactormethods(nlhs, plhs, nrhs, prhs); break; case REACTORNET_CLASS: reactornetmethods(nlhs, plhs, nrhs, prhs); break; case WALL_CLASS: wallmethods(nlhs, plhs, nrhs, prhs); break; case FLOWDEVICE_CLASS: flowdevicemethods(nlhs, plhs, nrhs, prhs); break; case ONEDIM_CLASS: onedimmethods(nlhs, plhs, nrhs, prhs); break; case SURF_CLASS: surfmethods(nlhs, plhs, nrhs, prhs); break; case FUNC_CLASS: funcmethods(nlhs, plhs, nrhs, prhs); break; default: mexPrintf("iclass = %d",iclass); //mexErrMsgTxt("unknown class"); } }
void Griefly::start_game() { MainForm main_form; main_form.show(); if (logs == 1) { initLogger("report_game.log", ldebug); } }
TEST_F(LoggerTests, test_logger_scheduled_query) { RegistryFactory::get().setActive("logger", "test"); initLogger("scheduled_query"); QueryLogItem item; item.name = "test_query"; item.identifier = "unknown_test_host"; item.time = 0; item.calendar_time = "no_time"; item.epoch = 0L; item.results.added.push_back({{"test_column", "test_value"}}); logQueryLogItem(item); EXPECT_EQ(1U, LoggerTests::log_lines.size()); item.results.removed.push_back({{"test_column", "test_new_value\n"}}); logQueryLogItem(item); ASSERT_EQ(3U, LoggerTests::log_lines.size()); // Make sure the JSON output does not have a newline. std::string expected = "{\"name\":\"test_query\",\"hostIdentifier\":\"unknown_test_host\"," "\"calendarTime\":\"no_time\",\"unixTime\":\"0\",\"epoch\":\"0\"," "\"columns\":{\"test_column\":\"test_value\"},\"action\":\"added\"}"; EXPECT_EQ(LoggerTests::log_lines.back(), expected); }
int initialize(void) { void *handle = PSIDplugin_getHandle("psaccount"); /* init the logger */ initLogger(NULL); /* set debug mask */ // maskLogger(PSPMI_LOG_RECV | PSPMI_LOG_VERBOSE); /* initialize all modules */ initSpawn(); initForwarder(); initClient(); /* get psaccount function handles */ if (!handle) { psAccountSwitchAccounting = NULL; mlog("%s: getting psaccount handle failed\n", __func__); } else { psAccountSwitchAccounting = dlsym(handle, "psAccountSwitchAccounting"); if (!psAccountSwitchAccounting) { mlog("%s: loading function psAccountSwitchAccounting() failed\n", __func__); } } mlog("(%i) successfully started\n", version); return 0; }
void Griefly::start_map_editor() { MapEditorForm editor_form; editor_form.show(); if (logs == 1){ initLogger("report_editor.log", ldebug); } }
SceneObject::SceneObject(const std::string name, const std::string modelPath, const int numFrames, const std::string boundingBoxSetPath) : offset(0,0,0), rotation(0,0,0), boundingBoxSet(boundingBoxSetPath) { initLogger(); this->name = name; animating = false; framesWaited = 0; frameDelay = 1; currentFrame = 0; this->numFrames = numFrames; if (numFrames > 1) { LOGINFO("Loading " + name + " animated model (this may take a while):"); for (int idx = 0; idx < numFrames; ++idx) { std::stringstream lss; lss << "Frame " << idx + 1 << " of " << numFrames << "..."; LOGINFO(lss.str()); std::stringstream ss; ss << std::setfill('0') << std::setw(6) << idx + 1; std::string frameNum = ss.str(); Model model1(modelPath + "_" + frameNum + ".obj"); model.push_back(model1); } } else { Model model1(modelPath); model.push_back(model1); } }
BatDown::BatDown(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { initLogger(); m_dbMgr.open(("ytk.db")); init(); readSettings(); }
TEST_F(LoggerTests, test_logger_scheduled_query) { RegistryFactory::get().setActive("logger", "test"); initLogger("scheduled_query"); QueryLogItem item; item.name = "test_query"; item.identifier = "unknown_test_host"; item.time = 0; item.calendar_time = "no_time"; item.epoch = 0L; item.counter = 0L; item.results.added.push_back({{"test_column", "test_value"}}); logQueryLogItem(item); EXPECT_EQ(1U, LoggerTests::log_lines.size()); // The entire removed/added is one event when result events is false. FLAGS_logger_event_type = false; item.results.removed.push_back({{"test_column", "test_new_value\n"}}); logQueryLogItem(item); EXPECT_EQ(2U, LoggerTests::log_lines.size()); FLAGS_logger_event_type = true; // Now the two removed will be individual events. logQueryLogItem(item); ASSERT_EQ(4U, LoggerTests::log_lines.size()); // Make sure the JSON output does not have a newline. std::string expected = "{\"name\":\"test_query\",\"hostIdentifier\":\"unknown_test_host\"," "\"calendarTime\":\"no_time\",\"unixTime\":0,\"epoch\":0," "\"counter\":0,\"columns\":{\"test_column\":\"test_value\"}," "\"action\":\"added\"}"; EXPECT_EQ(LoggerTests::log_lines.back(), expected); }
bool ServerForm::initForm() { initCounter(m_ui.labRecv, m_ui.labSend); initLogger(m_ui.chkLog, m_ui.btnClear, m_ui.treeOutput, m_ui.txtOutput); initLister(m_ui.btnConnAll, m_ui.btnConnDel, m_ui.lstConn); bindBuffer(1, m_ui.edtBuf1, m_ui.btnSend1, 0); bindBuffer(2, m_ui.edtBuf2, m_ui.btnSend2, 0); bindBuffer(3, m_ui.edtBuf3, m_ui.btnSend3, 0); connect(m_ui.btnTcp, SIGNAL(clicked(bool)), this, SLOT(trigger(bool))); connect(m_ui.btnUdp, SIGNAL(clicked(bool)), this, SLOT(trigger(bool))); connect(&m_tcp, SIGNAL(connOpen(const QString&)), this, SLOT(listerAdd(const QString&))); connect(&m_tcp, SIGNAL(connClose(const QString&)), this, SLOT(listerRemove(const QString&))); connect(&m_tcp, SIGNAL(message(const QString&)), this, SIGNAL(output(const QString&))); connect(&m_tcp, SIGNAL(dumpbin(const QString&,const char*,quint32)), this, SIGNAL(output(const QString&,const char*,quint32))); connect(&m_tcp, SIGNAL(countRecv(qint32)), this, SLOT(countRecv(qint32))); connect(&m_tcp, SIGNAL(countSend(qint32)), this, SLOT(countSend(qint32))); connect(&m_udp, SIGNAL(connOpen(const QString&)), this, SLOT(listerAdd(const QString&))); connect(&m_udp, SIGNAL(connClose(const QString&)), this, SLOT(listerRemove(const QString&))); connect(&m_udp, SIGNAL(message(const QString&)), this, SIGNAL(output(const QString&))); connect(&m_udp, SIGNAL(dumpbin(const QString&,const char*,quint32)), this, SIGNAL(output(const QString&,const char*,quint32))); connect(&m_udp, SIGNAL(countRecv(qint32)), this, SLOT(countRecv(qint32))); connect(&m_udp, SIGNAL(countSend(qint32)), this, SLOT(countSend(qint32))); return true; }
TEST_F(LoggerTests, test_multiple_loggers) { auto& rf = RegistryFactory::get(); auto second = std::make_shared<SecondTestLoggerPlugin>(); rf.registry("logger")->add("second_test", second); EXPECT_TRUE(rf.setActive("logger", "test,second_test").ok()); auto test_plugin = rf.registry("logger")->plugin("test"); auto test_logger = std::dynamic_pointer_cast<TestLoggerPlugin>(test_plugin); test_logger->shouldLogStatus = false; // With two active loggers, the string should be added twice. logString("this is a test", "added"); EXPECT_EQ(2U, LoggerTests::log_lines.size()); LOG(WARNING) << "Logger test is generating a warning status (4)"; // Refer to the above notes about status logs not emitting until the logger // it initialized. We do a 0-test to check for dead locks around attempting // to forward Glog-based sinks recursively into our sinks. EXPECT_EQ(0U, LoggerTests::statuses_logged); // Now try to initialize multiple loggers (1) forwards, (2) does not. initLogger("logger_test"); LOG(WARNING) << "Logger test is generating a warning status (5)"; // Now that the "test" logger is initialized, the status log will be // forwarded. EXPECT_EQ(1U, LoggerTests::statuses_logged); // Multiple logger plugins have a 'primary' concept. auto flag_default = FLAGS_logger_secondary_status_only; FLAGS_logger_secondary_status_only = true; logString("this is another test", "added"); // Only one log line will be appended since 'second_test' is secondary. EXPECT_EQ(3U, LoggerTests::log_lines.size()); // Only one status line will be forwarded. LOG(WARNING) << "Logger test is generating another warning (6)"; EXPECT_EQ(2U, LoggerTests::statuses_logged); FLAGS_logger_secondary_status_only = flag_default; logString("this is a third test", "added"); EXPECT_EQ(5U, LoggerTests::log_lines.size()); // Reconfigure the second logger to forward status logs. test_logger->shouldLogStatus = true; initLogger("logger_test"); LOG(WARNING) << "Logger test is generating another warning (7)"; EXPECT_EQ(4U, LoggerTests::statuses_logged); }
BoundingBoxSet::BoundingBoxSet(const std::string fileLocation) { initLogger(); vertices.clear(); facesVertexIndexes.clear(); numBoxes = 0; if (fileLocation != "") this->loadFromFile(fileLocation); }
Image::Image(const string &fileLocation) { initLogger(); width = 0; height = 0; imageData = NULL; this->loadFromFile(fileLocation); }
Globals::Globals(Config *config) : config_(config), loader_(new Loader()), handlerSet_(new HandlerSet()), componentSet_(new ComponentSet()), logger_(NULL) { loader_->init(config); componentSet_->init(this); handlerSet_->init(config, componentSet_.get()); initLogger(); initPools(); startThreadPools(); }
int main(int argc, char* argv[]) { parseArgs(argc, argv); initLogger(argv); UtlString urlString = "https://" + UtlString(xmlrpcServer); Url url(urlString); url.setHostPort(HttpPort); // Delay for 5 minutes // printf("Wating for start of memcheck ...\n"); // OsTask::delay(600000); // printf("Starting memcheck ...\n"); // Test run // while (1) for (int i = 0; i < 10; i++) { XmlRpcRequest* request = new XmlRpcRequest(url, "addExtension"); UtlString groupName("*****@*****.**"); request->addParam(&groupName); UtlString extension("*****@*****.**"); request->addParam(&extension); printf("Sending %d ...", i); XmlRpcResponse response; if (!request->execute(response)) { UtlString reason; int code; response.getFault(&code,reason); printf(" failed\n %d %s\n", code, reason.data() ); } else { printf(" ok\n"); } delete request; request = NULL; // OsTask::delay(2000); } // printf("Done with memcheck ...\n"); // while (1) // { // OsTask::delay(60000); // } return(1); }
int main(int argc, char *argv[]) { OsConfigDb configDb; UtlString configDbFile = TEST_FILENAME; parseArgs(argc, argv); if (MemCheckDelay) { // Delay 45 seconds to allow memcheck start printf("Wating %d seconds for start of memcheck ...", MemCheckDelay); OsTask::delay(MemCheckDelay * 1000); printf("starting\n"); } initLogger(argv); // Reset database content an rewrite the file configDb.set("TestItem1", "Value1"); configDb.set("TestItem2", "Value2"); configDb.set("TestItem3", "Value3"); configDb.set("TestItem3", "Value4"); configDb.storeToFile(configDbFile); ConfigRPC_Callback* confCallbacks; ConfigRPC* configRPC; XmlRpcDispatch* rpc; // start a simple XmlRpc test server rpc = new XmlRpcDispatch(HTTP_PORT, false); confCallbacks = new test_Callback(); configRPC = new ConfigRPC( TEST_DATASET, TEST_VERSION, configDbFile, confCallbacks); // enter the connector RPC methods in the XmlRpcDispatch table ConfigRPC::registerMethods(*rpc); printf("Server will be up for %d seconds on port %d\n", Duration/1000, HttpPort); OsTask::delay(Duration); if (MemCheckDelay) { // Delay 45 seconds to allow memcheck start printf("Wating %d seconds for stop of memcheck ...", MemCheckDelay); OsTask::delay(MemCheckDelay * 1000); printf("starting\n"); } exit(0); }
TEST_F(LoggerTests, test_recursion) { // Stop the internal Glog facilities. google::ShutdownGoogleLogging(); auto& rf = RegistryFactory::get(); auto plugin = std::make_shared<RecursiveLoggerPlugin>(); rf.registry("logger")->add("recurse", plugin); EXPECT_TRUE(rf.exists("logger", "recurse")); EXPECT_TRUE(rf.setActive("logger", "recurse").ok()); FLAGS_logtostderr = true; initStatusLogger("logger_test"); initLogger("logger_test"); LOG(WARNING) << "Log to the recursive logger"; EXPECT_EQ(1U, plugin->statuses); FLAGS_logger_status_sync = false; LOG(WARNING) << "recurse"; if (isPlatform(PlatformType::TYPE_WINDOWS)) { for (size_t i = 0; i < 100; i++) { std::this_thread::sleep_for(std::chrono::microseconds(10)); if (plugin->statuses == 3U) { break; } } } EXPECT_EQ(3U, plugin->statuses); // Try again with the tool type as a daemon. auto tool_type = kToolType; kToolType = ToolType::DAEMON; LOG(WARNING) << "recurse"; // The daemon calls the status relay within the scheduler. EXPECT_EQ(3U, plugin->statuses); // All of recursive log lines will sink during the next call. relayStatusLogs(true); EXPECT_EQ(4U, plugin->statuses); relayStatusLogs(true); EXPECT_EQ(5U, plugin->statuses); kToolType = tool_type; EXPECT_EQ(0U, queuedStatuses()); EXPECT_EQ(0U, queuedSenders()); // Make sure the test file does not create a filesystem log. // This will happen if the logtostderr is not set. EXPECT_FALSE(pathExists("logger_test.INFO")); FLAGS_logtostderr = false; }
TEST_F(LoggerTests, test_logger_variations) { // Init the logger for a second time, this should only be done for testing. // This time we'll trigger the init method to fail and prevent additional // status messages from trigger logStatus. initLogger("RETURN_FAILURE"); // This will be printed to stdout. LOG(WARNING) << "Logger test is generating a warning status (3)"; // Since the initLogger call triggered a failed init, meaning the logger // does NOT handle Glog logs, there will be no statuses logged. EXPECT_EQ(LoggerTests::statuses_logged, 0); }
int main(int argc, char *argv[]) { /* * Description: * *This program tries to find the TIM gateway from Quby makeing use of Upnp. *After this it will fetch the information from all sensors and publish it *on the dbus * *UPNP code: https://garage.maemo.org/frs/download.php/8365/libbrisa_0.1.1.tar.gz */ QCoreApplication app(argc, argv); Arguments arg; usage(arg); if (arg.contains("h")) { arg.help(); exit(0); } initLogger(QsLogging::InfoLevel); if (arg.contains("d")) logger.setLoggingLevel((QsLogging::Level)arg.value("d").toInt()); if (arg.contains("dbus")) VBusItems::setDBusAddress(arg.value("dbus")); else VBusItems::setConnectionType(QDBusConnection::SystemBus); QDBusConnection dbus = VBusItems::getConnection("settings"); if (!dbus.isConnected()) { QLOG_ERROR() << "DBus connection failed."; exit(EXIT_FAILURE); } // Wait for local settings to become available on the DBus QLOG_INFO() << "Wait for local settings on DBus... "; BusItemCons settings("com.victronenergy.settings", "/Settings", dbus); QVariant reply = settings.getValue(); while (reply.isValid() == false) { reply = settings.getValue(); usleep(500000); QLOG_INFO() << "Wait..."; } QLOG_INFO() << "Local settings found!"; Qwacs qwacs(&app, arg.value("g")); return app.exec(); }
int main( int argc, char *argv[] ) { // init random number generator // ::srand( time(0) ); QApplication app(argc, argv); // Load singular instance of configuration manager // - to ensure access to stored configuration values we need // to set application name and organization name first... QCoreApplication::setApplicationName(PROGNAME); QCoreApplication::setOrganizationName(PROGNAME); QCoreApplication::setOrganizationDomain(PROGORGADOMAIN); ConfigManager & conf = ConfigManager::getInstance(); initLogger( conf ); initConfiguration( conf ); // Set text codec of translations to UTF-8 QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); const QString & localeConf = conf.getStringValue("main.language"); QString locale; if ( localeConf.isNull() || localeConf.isEmpty() || localeConf.compare("auto", Qt::CaseInsensitive ) == 0 ) { // if there is no configuration or configuration value is 'auto': lookup system locale locale = QLocale::system().name(); // this gives a string in form: "language_country" -> we need only "language"! // Note: Qt is missing a useful method to get the language code without country code! (probably I didn't see...) int underscoreIdx = locale.indexOf('_'); if ( underscoreIdx > 0 ) locale = locale.left( underscoreIdx ); } else locale = localeConf; QTranslator translator; if ( translator.load( QString("USBhubConnect_") + locale, QString("i18n") ) ) app.installTranslator(&translator); else printf("Cannot load translation files for locale: %s\n", locale.toUtf8().data() ); // Load main window - and core application mainFrame mf; mf.show(); // quit window event QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) ); QObject::connect( qApp, SIGNAL(aboutToQuit()), &mf, SLOT(cleanUpAllStuff()) ); // Start event processing and wait for exit int res = app.exec(); return res; }
IMPEXP OSStatus MAIN( OSType message, PluginMessageInfo* messageInfo, void* /*refCon*/ ) { switch ( message ) { case kPluginInitMessage: initLogger(); #if TARGET_OS_MAC if ( !isClientInstalled() ) { uninstall(); return noErr; } #endif launchClient(); //launches client, on mac setupIPodSystem(); //sets up iPod scrobbling #if TARGET_OS_WIN32 LOG( 3, "Initialising ScrobSubmitter" ); gSubmitter.Init( "itw", ScrobSubCallback, 0 ); #endif return RegisterVisualPlugin( messageInfo ); case kPluginPrepareToQuitMessage: LOG( 3, "EVENT: kPluginPrepareToQuitMessage" ); cleanup(); return noErr; case kPluginCleanupMessage: LOG( 3, "EVENT: kPluginCleanupMessage" ); #if TARGET_OS_WIN32 LOG( 3, "Terminating ScrobSubmitter" ); gSubmitter.Term(); #endif return noErr; default: return unimpErr; } }
void Initializer::start() { // Load registry/extension modules before extensions. osquery::loadModules(); // Pre-extension manager initialization options checking. if (FLAGS_config_check && !Watcher::hasManagedExtensions()) { FLAGS_disable_extensions = true; } // Bind to an extensions socket and wait for registry additions. osquery::startExtensionManager(); // Then set the config plugin, which uses a single/active plugin. initActivePlugin("config", FLAGS_config_plugin); // Run the setup for all lazy registries (tables, SQL). Registry::setUp(); if (FLAGS_config_check) { // The initiator requested an initialization and config check. auto s = Config::checkConfig(); if (!s.ok()) { std::cerr << "Error reading config: " << s.toString() << "\n"; } // A configuration check exits the application. ::exit(s.getCode()); } // Load the osquery config using the default/active config plugin. Config::load(); // Check the backing store by allocating and exiting on error. if (!DBHandle::checkDB()) { LOG(ERROR) << binary_ << " initialize failed: Could not create DB handle"; if (isWorker()) { ::exit(EXIT_CATASTROPHIC); } else { ::exit(EXIT_FAILURE); } } // Initialize the status and result plugin logger. initActivePlugin("logger", FLAGS_logger_plugin); initLogger(binary_); // Start event threads. osquery::attachEvents(); EventFactory::delay(); }
TEST_F(LoggerTests, test_logger_init) { auto& rf = RegistryFactory::get(); // Expect the logger to have been registered from the first test. EXPECT_TRUE(rf.exists("logger", "test")); EXPECT_TRUE(rf.setActive("logger", "test").ok()); initStatusLogger("logger_test"); // This will be printed to stdout. LOG(WARNING) << "Logger test is generating a warning status (1)"; initLogger("logger_test"); // The warning message will have been buffered and sent to the active logger // which is test. EXPECT_EQ(1U, LoggerTests::status_messages.size()); EXPECT_EQ(1U, LoggerTests::statuses_logged); }
int initialize(void) { /* init the logger (log to syslog) */ initLogger(NULL); /* we need to have root privileges */ if (getuid() != 0) { mlog("%s: psmunge requires root privileges\n", __func__); return 1; } if (!initMunge()) return 1; mlog("(%i) successfully started\n", version); return 0; }
TEST_F(LoggerTests, test_logger_variations) { // Retrieve the test logger plugin. auto plugin = RegistryFactory::get().plugin("logger", "test"); auto logger = std::dynamic_pointer_cast<TestLoggerPlugin>(plugin); // Change the behavior. logger->shouldLogStatus = false; // Call the logger initialization again, then reset the behavior. initLogger("duplicate_logger"); logger->shouldLogStatus = true; // This will be printed to stdout. LOG(WARNING) << "Logger test is generating a warning status (3)"; // Since the initLogger call triggered a failed init, meaning the logger // does NOT handle Glog logs, there will be no statuses logged. EXPECT_EQ(0U, LoggerTests::statuses_logged); }
bool TransferForm::initForm() { initCounter(m_ui.labRecv, m_ui.labSend); initLogger(m_ui.chkLog, m_ui.btnClear, m_ui.treeOutput, m_ui.txtOutput); initLister(m_ui.btnConnAll, m_ui.btnConnDel, m_ui.lstConn); bindBuffer(1, m_ui.edtBuf1, m_ui.btnSend1, m_ui.cmbDir1); bindBuffer(2, m_ui.edtBuf2, m_ui.btnSend2, m_ui.cmbDir2); bindBuffer(3, m_ui.edtBuf3, m_ui.btnSend3, m_ui.cmbDir3); bindSelect(m_ui.cmbDir1, -1, Qt::Key_F5); bindSelect(m_ui.cmbDir2, -1, Qt::Key_F6); bindSelect(m_ui.cmbDir3, -1, Qt::Key_F7); connect(m_ui.btnTrigger, SIGNAL(clicked(bool)), this, SLOT(trigger(bool))); return true; }
int main() { //初始化日志系统 initLogger(); //加载配置 CServer::getInstance()->getConf()->loadConf(); //启动topo管理模块 if (!CServer::getInstance()->getTopoMgr()->init()) { LOG_ERROR("topo module init failure"); return 0; } //启动服务 startServer(); return 0; }
int main(int argc, char** argv) { OSS::OSS_init(); ServiceOptions::daemonize(argc, argv); ServiceOptions service(argc, argv, "sipXsbc", "1.0.0", "(c) eZuce, Inc. All rights reserved."); service.addDaemonOptions(); // // Initialize the logger // service.addOptionString('L', "log-file", ": Specify the application log file.", ServiceOptions::CommandLineOption); service.addOptionInt('l', "log-level", ": Specify the application log priority level." "Valid level is between 0-7. " "0 (EMERG) 1 (ALERT) 2 (CRIT) 3 (ERR) 4 (WARNING) 5 (NOTICE) 6 (INFO) 7 (DEBUG)" , ServiceOptions::CommandLineOption); service.addOptionFlag("log-no-compress", ": Specify if logs will be compressed after rotation."); service.addOptionInt("log-purge-count", ": Specify the number of archive to maintain."); service.parseOptions(); initLogger(service); OSS::SIP::B2BUA::SBController sbc; // // Initialize the datastore // initDataStore(sbc); // // Initialize java scripts // initHandler(sbc, service); // // Initialize the transports // initListeners(sbc, service); sbc.run(); OSS::app_wait_for_termination_request(); OSS::OSS_deinit(); }
TEST_F(LoggerTests, test_logger_init) { // Expect the logger to have been registered from the first test. EXPECT_TRUE(Registry::exists("logger", "test")); EXPECT_TRUE(Registry::setActive("logger", "test").ok()); initStatusLogger("logger_test"); // This will be printed to stdout. LOG(WARNING) << "Logger test is generating a warning status (1)"; initLogger("logger_test"); // The warning message will have been buffered and sent to the active logger // which is test. EXPECT_EQ(LoggerTests::status_messages.size(), 1U); // The logStatus API should NOT have been called. It will only be used if // (1) The active logger's init returns success within initLogger and // (2) for status logs generated after initLogger is called. EXPECT_EQ(LoggerTests::statuses_logged, 0); }
TEST_F(FilesystemLoggerTests, test_log_status) { if (isPlatform(PlatformType::TYPE_WINDOWS)) { // Cannot test status deterministically on windows. return; } initStatusLogger("osqueryd"); initLogger("osqueryd"); LOG(WARNING) << "Filesystem logger test is generating a warning status (1/3)"; auto status_path = fs::path(FLAGS_logger_path) / "osqueryd.INFO"; EXPECT_TRUE(osquery::pathExists(status_path)); std::string content; EXPECT_TRUE(readFile(status_path, content)); auto lines = osquery::split(content, "\n").size(); EXPECT_EQ(4U, lines); LOG(WARNING) << "Filesystem logger test is generating a warning status (2/3)"; content.clear(); readFile(status_path, content); lines = osquery::split(content, "\n").size(); EXPECT_EQ(5U, lines); auto& rf = RegistryFactory::get(); auto filesystem_test = std::make_shared<FilesystemTestLoggerPlugin>(); rf.registry("logger")->add("filesystem_test", filesystem_test); EXPECT_TRUE(rf.setActive("logger", "filesystem,filesystem_test").ok()); LOG(WARNING) << "Filesystem logger test is generating a warning status (3/3)"; content.clear(); readFile(status_path, content); lines = osquery::split(content, "\n").size(); EXPECT_EQ(6U, lines); relayStatusLogs(true); content.clear(); readFile(status_path, content); lines = osquery::split(content, "\n").size(); EXPECT_EQ(6U, lines); }
MainWindow::MainWindow(User *user, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); setStyleSheet(StyleSheet::s_StyleSheet); // Sets Null pointer for later deletion if m_Server and/or m_Client are not used m_Server = NULL; m_Client = NULL; m_User = user; initConnects(); initRole(); initLogger(); m_NotificationStacker.setParent(this); // TODO full screen button -> showFullScreen(); }