示例#1
0
int main(int argc, char* argv[]) {

    START_EASYLOGGINGPP(argc, argv);
    parseArgs(argc, argv);

    LOG(INFO) << "Initializing alignment provider";
    DazAlnProvider* ap;
    ap = new DazAlnProvider(popts);
    TrgBuf trgBuf(20);
    CnsBuf cnsBuf(10);

    std::thread writerThread(Writer, std::ref(cnsBuf));

    std::vector<std::thread> cnsThreads;
    for (int i=0; i < popts.threads; i++) {
        std::thread ct(Consensus, i, std::ref(trgBuf), std::ref(cnsBuf));
        cnsThreads.push_back(std::move(ct));
    }

    std::thread readerThread(Reader, std::ref(trgBuf), ap);

    writerThread.join();

    std::vector<std::thread>::iterator it;
    for (it = cnsThreads.begin(); it != cnsThreads.end(); ++it)
        it->join();

    readerThread.join();

    delete ap;

    return 0;
}
示例#2
0
int main(int argc, char** argv)
{
    START_EASYLOGGINGPP(argc, argv);

    el::Helpers::installLogDispatchCallback<MyHandler>("MyHandler");

    // Your thread ID specification
    el::CustomFormatSpecifier myThreadIdSpecifier("%mythreadId", getThreadId_CustomVersion);
    el::Helpers::installCustomFormatSpecifier(myThreadIdSpecifier);

    el::Loggers::addFlag(el::LoggingFlag::MultiLoggerSupport);

    // Note your %mythreadId or built-in, both are logged
    el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format, "%datetime %level (%thread | %mythreadId) [%logger] [%func] [%loc] %msg");
    el::Loggers::reconfigureAllLoggers(el::Level::Verbose, el::ConfigurationType::Format, "%datetime %level-%vlevel (%thread | %mythreadId) [%logger] [%func] [%loc] %msg");
    el::Loggers::getLogger("network");

    pthread_t thread1, thread2, thread3, thread4;

    // Create independent threads each of which will execute function
    pthread_create( &thread1, NULL, write, (void*)"1");
    pthread_create( &thread2, NULL, write, (void*)"2");
    pthread_create( &thread3, NULL, write, (void*)"3");

    el::Logger* logger = el::Loggers::getLogger("default");
    args.thrId = "4";
    args.logger = logger;
    pthread_create( &thread4, NULL, write2, (void*)&args);

    pthread_join(thread1, NULL);
    pthread_join(thread2, NULL);
    pthread_join(thread3, NULL);
    pthread_join(thread4, NULL);

#if 0 // Change this to 1 for some serious multiple threads
    int i = 5; // Last one we created was 4 so we dont want to confuse
    const int max = i + 500;
    for (; i <= max; ++i) {
        pthread_t thread;
        std::string s = std::to_string(static_cast<long long>(i));
        if (i % 2 == 0)
            pthread_create( &thread, NULL, write, (void*)s.c_str());
        else {
            args.thrId = s.c_str();
            args.logger = logger;
            pthread_create( &thread, NULL, write2, (void*)&args);
        }
        pthread_join(thread, NULL);
    }
#endif

    exit(0);
}
示例#3
0
void InitializeEasyLogging(int argc, char* argv[])
{
    std::string app_dir = QCoreApplication::applicationDirPath().toStdString();
    std::string log_file = app_dir + "/MHUD2.log";
    std::string conf_file = app_dir + "/MHUD2.log.conf";

    START_EASYLOGGINGPP(argc, argv);
    el::Configurations logger_conf(conf_file);
    logger_conf.setGlobally(el::ConfigurationType::Filename, log_file);
    logger_conf.setGlobally(el::ConfigurationType::ToFile, "true");

    el::Loggers::setDefaultConfigurations(logger_conf, true);
}
示例#4
0
int main( int argc, char* argv[] )
{
    START_EASYLOGGINGPP(argc, argv);
	{
		std::ifstream test(TRAFFIC_TEST_CONF);
		if (test.is_open()) {
			el::Configurations conf(TRAFFIC_TEST_CONF);
			el::Loggers::reconfigureAllLoggers(conf);
		}
	}

    return Catch::Session().run( argc, argv );
}
示例#5
0
INITIALIZE_EASYLOGGINGPP

int main(int argc, char** argv) {
    START_EASYLOGGINGPP(argc, argv);
    el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
    el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);

    // You can uncomment following lines to take advantage of hierarchical logging
    // el::Loggers::addFlag(el::LoggingFlag::HierarchicalLogging);
    // el::Loggers::setLoggingLevel(el::Level::Global);

    LOG(INFO);
    LOG(DEBUG);
    LOG(WARNING);
    LOG(ERROR);
    LOG(TRACE);
    VLOG(1);
    LOG(FATAL);

    DLOG(INFO);
    DLOG(DEBUG);
    DLOG(WARNING);
    DLOG(ERROR);
    DLOG(TRACE);
    DVLOG(1);
    DLOG(FATAL);

    LOG(INFO) << "Turning off colored output";
    el::Loggers::removeFlag(el::LoggingFlag::ColoredTerminalOutput);
    
    LOG_IF(true, INFO);
    LOG_IF(true, DEBUG);
    LOG_IF(true, WARNING);
    LOG_IF(true, ERROR);
    LOG_IF(true, TRACE);
    VLOG_IF(true, 1);
    LOG_IF(true, FATAL);

    LOG_EVERY_N(1, INFO);
    LOG_EVERY_N(1, DEBUG);
    LOG_EVERY_N(1, WARNING);
    LOG_EVERY_N(1, ERROR);
    LOG_EVERY_N(1, TRACE);
    VLOG_EVERY_N(1, 1);
    LOG_EVERY_N(1, FATAL);

    CHECK(1 == 1);
    CCHECK(1 == 1, "default");
    return 0;
}
INITIALIZE_EASYLOGGINGPP

int main(int argc, char ** argv)
{
	START_EASYLOGGINGPP(argc, argv);
//    std::cout << "INIZIO" << std::endl;

//    FLAGS_colorlogtostderr=1;
//    FLAGS_logtostderr=1;

    google::ParseCommandLineFlags(&argc, &argv, true);

    spc::ISerializable::Ptr ser =  spc::io::deserializeFromFile(FLAGS_selection);

    spc::SelectionOfPointsBase::Ptr sel = spcDynamicPointerCast<spc::SelectionOfPointsBase>(ser);


    LOG(INFO) << "selection loaded";

    spc::PointCloudBase::Ptr cloud = spc::io::loadPointCloud(FLAGS_cloud);

    LOG(INFO) << "cloud loaded";


    spc::SelectionExtractor<Eigen::Vector3f, size_t> extractor;

    extractor.setSelection(sel);
    extractor.setInputSet(cloud);
    extractor.compute();


//    LOG(INFO) << "create cloud";
//    spc::PointCloudPCL cloud;
//    LOG(INFO) << "done";


//    cloud.resize(10);
//    LOG(INFO) << cloud.asEigenMatrix();

//    spc::PointCloudBase::Ptr out = cloud->extractIDS<spc::PointCloudPCL>(extractor.getInsideIds());

//    pcl::io::savePCDFile("out.pcd", *out->getAsPclXyz());



//    DLOG(INFO) << "percentage " << extractor.getPercentageInside();

    return 0;
}
示例#7
0
文件: tests.cpp 项目: PetRover/rTests
int main(int argc, char *argv[])
{
    START_EASYLOGGINGPP(argc, argv);
    LOG(INFO) << "Starting the rover tests";
#ifdef RUNTEST_TEST_GPIO
    RVR::testGpio(10);
#endif

#ifdef RUNTEST_TEST_DC_MOTOR
    RVR::PowerRail *motorRail = RVR::PowerManager::getRail(RVR::RAIL12V0);
    const RVR::DRV8842Motor driveAMotor = RVR::DRV8842Motor(0, 86, 88, 89, 87, 10, 81, 32, 45, 61, 77, motorRail, 2500, 125);
    RVR::testDcMotor(driveAMotor);
#endif

#ifdef RUNTEST_TEST_WIFI_SEND_COMMAND
    RVR::testWifiSendCommand(ipAddressLocal, ipAddressRemote);
#endif

#ifdef RUNTEST_TEST_WIFI_SEND_COMMAND_NO_MESSAGE
    RVR::testWifiSendCommandNoMessage(ipAddressLocal, ipAddressRemote);
#endif

#ifdef RUNTEST_TEST_WIFI_SEND_STATUS
    RVR::testWifiSendStatus(ipAddressLocal, ipAddressRemote);
#endif

#ifdef RUNTEST_TEST_WIFI_SEND_TEXT
    RVR::testWifiSendText(ipAddressLocal, ipAddressRemote);
#endif

#ifdef RUNTEST_TEST_WIFI_RECEIVE_COMMAND
    RVR::testWifiReceiveCommand(ipAddressLocal, ipAddressRemote);
#endif

#ifdef RUNTEST_TEST_WIFI_RECEIVE_STATUS
    RVR::testWifiReceiveStatus(ipAddressLocal, ipAddressRemote);
#endif

#ifdef RUNTEST_TEST_WIFI_RECEIVE_TEXT
    RVR::testWifiReceiveText(ipAddressLocal, ipAddressRemote);
#endif

#ifdef RUNTEST_TEST_CAMERA_SAVE_FILE
    RVR::testCameraSaveFile(3);
#endif

    return 0;
}
示例#8
0
void InitializeEasyLogging(int argc, char* argv[])
{
    START_EASYLOGGINGPP(argc, argv);

    // EasyLogging++ does not support unicode file paths, we workaround this by changing the working directory
    std::wstring app_dir = QCoreApplication::applicationDirPath().toStdWString();
    SetCurrentDirectory(app_dir.c_str());

    // Initialize the file logging module
    std::string log_file = "MHUD2.log";
    std::string conf_file = "MHUD2.log.conf";
    el::Configurations logger_conf(conf_file);
    logger_conf.setGlobally(el::ConfigurationType::Filename, log_file);
    logger_conf.setGlobally(el::ConfigurationType::ToFile, "true");
    el::Loggers::setDefaultConfigurations(logger_conf, true);
}
示例#9
0
int main(int argv, char* argc[]) {
    START_EASYLOGGINGPP(argv, argc);
    configureLogging();

    char* configPath = (char *) "./config.json";
    LOG(INFO) << "Loading configuration from " << configPath;
    ConfigurationLoader* configLoader = new ConfigurationLoader();
    Configuration* config = configLoader->loadFromFile(configPath);
    VLOG(9) << "Configuration values:" << std::endl << config->toString();

    kernel = new Kernel(config);
    signal(SIGINT, signalHandler);
    kernel->boot();

    return 0;
}
示例#10
0
INITIALIZE_EASYLOGGINGPP


int main(int argc, const char * argv[])
{
  START_EASYLOGGINGPP(argc, argv);

  el::Configurations defaultConf;
  defaultConf.setToDefault();
  // Values are always std::string
  defaultConf.setGlobally(el::ConfigurationType::Format, "%datetime %level %fbase:%line %msg");
  // default logger uses default configurations
  el::Loggers::reconfigureLogger("default", defaultConf);

  el::Configurations performanceConf;
  performanceConf.setToDefault();
  performanceConf.set(el::Level::Info, el::ConfigurationType::Format, "%msg");
  performanceConf.set(el::Level::Info,el::ConfigurationType::Filename,"../performance.log"); /// TODO make output file include version number of this upcoming release
  //performanceConf.set(el::Level::Info,el::ConfigurationType::MillisecondsWidth,"6");
  el::Loggers::reconfigureLogger("performance", performanceConf);
  el::Loggers::addFlag(el::LoggingFlag::FixedTimeFormat); // ensures performance numbers are always quoted as seconds, never formatted

  LOG(INFO) << "In tests main";

  /// TODO delete performance.csv before running tests

  //CppUnit::TestResult controller;

  //CppUnit::TestResultCollector collector;
  //controller.addListener(&collector);

  //CppUnit::BriefTestProgressListener progress;
  //controller.addListener(&progress);

  CppUnit::TextUi::TestRunner runner;
  runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
  bool wasSuccessful = runner.run( "", false );
  return wasSuccessful;
}
int main(int argc, char* argv[])
{
	START_EASYLOGGINGPP(argc, argv);

	el::Configurations conf("config/launcher_logging.cfg");
	el::Loggers::reconfigureAllLoggers(conf);

	startLog();

	if (!al_init()) {
		LOG(FATAL) << "failed to initialize allegro!";
		return -1;
	}

	DWORD exitCode = startup("bin/Box2D SFML Engine.exe");

	LOG(INFO) << "Game exited with code: " << exitCode;

	if (exitCode == 0)
	{
		LOG(INFO) << "Game exited succesfully!";
	}
	else if (exitCode == -1)
	{
		LOG(WARNING) << "Game failed to start!";
		LOG(WARNING) << "Check that Box2D SFML Engine.exe is in the bin folder";
	}

	endLog();

	std::cout << std::endl;
	std::cout << "Press enter to exit";
	std::cin.ignore();

	return 0;
}
示例#12
0
int main(int argc, char* argv[])
{
	START_EASYLOGGINGPP(argc, argv);

	Py_Initialize();
	PyRun_SimpleString("print pow(2, 3)");
	Py_Finalize();

	el::Configurations conf("config/logging.cfg");
	el::Loggers::reconfigureAllLoggers(conf);

	startLog();

	LOG(INFO) << "Initialising SFML Render Window with a resolution of " << windowWidth << "x" << windowHeight;

	LOG(INFO) << "IGNORE OPENGL MISSING EXTENSION!";

	sf::RenderWindow window(sf::VideoMode(windowWidth, windowHeight), windowTitle, sf::Style::Close, settings);

	window.setVerticalSyncEnabled(false); // vsync messes with updates

	sf::View viewPort(sf::Vector2f(windowWidth / 2, windowHeight / 2), sf::Vector2f(windowWidth, windowHeight));

	// Initialise physics
	//b2Vec2 gravity(0.0f, 0.0f);
	//b2World world(gravity);

	// scripting init here!
	/*script::FalconEngine scripting;

	// load resource paths
	try
	{
		scripting.embed("resources.fal");
	}
	catch (Falcon::Error *err)
	{
		Falcon::AutoCString edesc(err->toString());
		LOG(FATAL) << edesc.c_str() << std::endl;
		err->decref();
		return 1;
	}

	try
	{
		scripting.embed("test.fal");
	}
	catch (Falcon::Error *err)
	{
		Falcon::AutoCString edesc(err->toString());
		LOG(FATAL) << edesc.c_str() << std::endl;
		err->decref();
		return 1;
	}*/
	

	texture.loadFromFile("data/abstract liquify thing.png");
	sprite.setTexture(texture);

	int testMusic = loadMusic("data/audio/music/Three_Days_Grace_-_The_High_Road_(mp3.pm).ogg");
	int channel2 = loadMusic("data/audio/music/Kygo - Firestone (feat. Conrad).ogg");
	int channel3 = loadMusic("data/audio/music/Seether - Broken (Featuring Amy Lee).ogg");
	int channel4 = loadMusic("data/audio/music/New Found Glory - This Disaster.ogg");
	int channel5 = loadMusic("data/audio/music/Story of the Year - Until the Day I Die.ogg");

	Player player(sf::Vector2f(windowWidth / 2, windowHeight / 2));
	
	FriendlyTrader test(sf::Vector2f(64, 128));

	sf::Clock clock;
	sf::Clock seconds;

	while (window.isOpen())
	{
		sf::Time elapsed = clock.getElapsedTime();

		bool fadeCompleted;

		if (elapsed.asMicroseconds() >= updateRate.asMicroseconds())
		{
			clock.restart();
			update(&window, &player, &viewPort);
			if (!getFadeCompleted())
			{
				fadeCompleted = true;
				//windowFade = fadeOut(&window);
			}
			test.Update();
		}
		elapsed = seconds.getElapsedTime();
		if (elapsed.asSeconds() >= 1)
		{
			UPS = tick;
			FPS = frame;

//#ifdef _DEBUG
			char windowTitle[128] = "SFML and Box2D";
			char buffer[8];
			strcat_s(windowTitle, " | ");
			_itoa_s(UPS, buffer, 10);
			strcat_s(windowTitle, "UPS: ");
			strcat_s(windowTitle, buffer);
			strcat_s(windowTitle, ", FPS: ");
			_itoa_s(FPS, buffer, 10);
			strcat_s(windowTitle, buffer);
			window.setTitle(windowTitle);
//#endif
			
			//std::cout << "UPS: " << UPS << ", FPS: " << FPS << std::endl;
			tick = 0;
			frame = 0;
			seconds.restart();
		}

		render(&window, viewPort);
	}

	LOG(INFO) << "Unloading SFML";
	
	sf::sleep(sf::seconds(0.5));
	//LogWhiteSpace();
	endLog();

	std::cout << std::endl;

	return 0;
}
示例#13
0
MyLib::MyLib(int argc, char** argv) {
    START_EASYLOGGINGPP(argc, argv);
    LOG(INFO) << "---MyLib Constructor(int, char**) ---";
}
示例#14
0
int main(int argc, char* argv[]) {
  START_EASYLOGGINGPP(argc, argv);
  microunit::UnitTester::Run();
  return 0;
}
示例#15
0
Logger::Logger(int argc, char** argv) {
	START_EASYLOGGINGPP(argc,argv);
	LOG(INFO) << "Logger ctor(argc,argv)";
}
示例#16
0
void wex::log::init(int argc, char** argv)
{
  // Load elp configuration from file.
  const path elp(config().dir(), "conf.elp");

  if (elp.file_exists())
  {
    el::Loggers::reconfigureAllLoggers(el::Configurations(elp.data().string()));
  }

  // We need to convert argc and argv, as elp expects = sign between values.
  // The logging-flags are handled by syncped.
  bool error = false;
  std::vector<const char*> v;
  const std::vector <std::pair<
    std::string, std::string>> supported {
      {"-m", "-vmodule"},
      {"-D", "--default-log-file"},
      {"-L", "--loggingflags"},
      {"--logfile", "--default-log-file"},
      {"--logflags", "--loggingflags"},
      {"--x", "--v"}, // for testing with verbosity
      {"--v", "--v"}};

  for (int i = 0; i < argc; i++)
  {
    bool found = false;

    for (const auto& s : supported)
    {
      if (strcmp(argv[i], s.first.c_str()) == 0)
      {
        found = true;

        if (i + 1 < argc)
        {
	        const std::string option(argv[i + 1]);
  	      v.push_back(std::string(s.second + "=" + option).c_str());
        }
        else
        {
          error = true;
        }
      }
    }

    if (!found)
    {
      v.push_back(argv[i]);
    }
  }

  START_EASYLOGGINGPP(v.size(), (const char**)&v[0]);

  verbose(1) << "verbosity:" << (int)el::Loggers::verboseLevel()
    << "config:" << elp.data().string();
  
  if (error)
  {
    log("option value missing");
  }
}