Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
  /* dbgmsg()
  ** You can use '|dbgmsg()| exactly as if it was '|printf()| the difference
  ** is that the output will go on the file defined with '|utlSetOuput()| 
  ** (or '|stderr| if no file has been specified)     
  */  
  
  dbgmsg("This message will go on stderr %d\n",1);
  utlSetOutput("utlh1.dbg");
  dbgmsg("This message is on utlh1.log");
  utlSetOutput("utlh2.dbg"); /* the previous file is closed and the new one is opened*/
  dbgmsg("This message is on utlh2.log");
  utlSetOutput(NULL); 
  dbgmsg("This message will go on stderr %d",2);

  
  /* Logging is different from debugging messages in that the logging will
  ** remain in your production code and you will be able to enable it to
  ** monitor the application behavior.  
  */
    
  logSetLevel(logALL);
  logDebug("This is a log debug message. (%d)",logLevel);
  logSetLevel(logINFO);
  logDebug("This will not appear");
  logMessage("\n%s...continuing",logIndent);
  logWarn("And now a warning (%d)",5);
  logSetFile("utlh1.log","w");
  logError("An error!");
  logFatal("An unrecoverable error");
   
  return (0);
}
Ejemplo n.º 2
0
int main () {
	int
		number_failed = 0;
	SRunner
		* sr = srunner_create (makeGraphInitSuite ());

	srunner_add_suite (sr, makeGraphWorldBaseSuite ());

	logSetLevel (E_ALL ^ E_DEBUG);

	srunner_run_all (sr, CK_NORMAL);
	number_failed = srunner_ntests_failed (sr);
	srunner_free (sr);
	return (number_failed == 0)
		? EXIT_SUCCESS
		: EXIT_FAILURE;
}
Ejemplo n.º 3
0
int main () {
	int
		number_failed = 0;
	SRunner
		* sr = srunner_create (makeMapInitSuite ());

	srunner_add_suite (sr, makeMapTraversalSuite ());
	srunner_add_suite (sr, makeMapGenerationSuite ());
	//srunner_add_suite (sr,  ());

	logSetLevel (E_NONE);

	srunner_run_all (sr, CK_NORMAL);
	number_failed = srunner_ntests_failed (sr);
	srunner_free (sr);
	return (number_failed == 0)
		? EXIT_SUCCESS
		: EXIT_FAILURE;
}
Ejemplo n.º 4
0
VkBool32 VKTS_APIENTRY logInit()
{
    return logSetLevel(VKTS_LOG_INFO);
}
Ejemplo n.º 5
0
int main( int argc, char **argv )
{
    // 1. Parse command-line options
    int   opt;                          // Used to iterate through letter options on the command line
    bool  usingSideA = true;            // Flag used to determine which side (A or B) we are running pong (adjusted by command line options below)
    bool  mqPurgueAndQuit = false;      // Flag set true is we are just cleaning the MQs and exitingq (adjusted by command line options below)

    puts( FG15 "Pong version 1.0" );
    puts( "Group7: Real-Time Embedded Systems, ECEN5623 Fall 2013\n" NOC );

    while ( (opt = getopt( argc, argv, "b123f:p" )) != -1 ) // Tip, a ':' following an option means the option has an argument 'optarg'
        {                                                       // The global variable 'optarg' contains the string value passed as option argument, also you can use atoi(optarg) to convert that value to int
            switch ( opt )
            {
                // Purge MQ and exits
                case 'p':
                    mqPurgueAndQuit = true;
                    break;

                // Specifies side B of the table
                case 'b':
                    usingSideA = false;
                    break;

                // Enable custom log filtering
                case 'f':
                    logSetFilter( optarg );
                    break;

                // Set logging level:
                case '1':
                case '2':
                case '3':
                    logSetLevel( opt-0x30 ); //0=info, 1=warn, 2=err 3=none
                    break;

                // If we find an option we don't support, display usage and quit
                default:
                    usage( argv[0] );

            }/*switch*/

        }/*while*/

    //Configure the global configuration structure 'pongInstance' to be used in either side A or B
    configurePongInstance( usingSideA );

    // 3. Purging the mq? do it and quit...
    if ( mqPurgueAndQuit )
    {
        stop(); //clean up the queues
        puts("Purge done.");
        exit(0);
    }

    //Setup application environment, variable initial state
    if ( !setup() )
    {
        loge("Failed to setup program environment.");
        exit(-1);
    }

    //Start all threads an let them do the work while we just hang in here until the user enters any input and hit enter
    if ( !start() )
    {
        loge("Failed to start program threads.");
        stop(); //stop any partially started threads
        exit(-1);
    }

    log("Pong is running (Type anything and press enter to exit)\n");
    scanf ("%i", &opt); //dummy read

    //Clean up and exit
    log("Terminating program...");
    stop();

    return 0;
}