示例#1
0
int main(int argc, char *argv[])
{
  rtsLogOutput(RTS_LOG_STDERR);
  rtsLogLevel(NOTE);

  daqReader *reader;

  if(argc > 1) {
    reader = new daqReader(argv[1]);
  }
  else {
    LOG(ERR,"Need a filename...");
    exit(0);
  }

  if(reader == NULL) {
    LOG(ERR, "Error constructing daqReader with %s", argv[1]);
    exit(0);
  }

  if(reader->status) {
    LOG(ERR, "Bad status constructing daqReader with %s",argv[1]);
    exit(0);
  }

  for(int i=1;;i++) {
    char *mem = reader->get(0,0);
    if(mem == NULL) {
      LOG(ERR, "Event %d not valid");
      exit(0);
    }

    if(reader->status == EVP_STAT_EOR) {
      LOG(NOTE, "End of run");
      exit(0);
    }

    if(reader->status != EVP_STAT_OK) {
      LOG(ERR, "Error on %dth event...");
      continue;
    }

    LOG(INFO,"**** Event %d (file: %d): bytes %d, token %d, FILE %s",reader->seq, reader->event_number,reader->bytes,
	reader->token,(int)reader->file_name) ;

    LOG(NOTE,"**** Event %d: bytes %d, token %d, trg_cmd %d, FILE %s",reader->event_number,reader->bytes,
	reader->token,reader->trgcmd,(int)reader->file_name) ;
    
		

    // make humanly readable time from the UNIX time...
    char *stime ;
    stime = ctime((long int *)&reader->evt_time) ;
    *(stime+strlen(stime)-1) = 0 ;
    
    LOG(NOTE,"     Trigger Word 0x%02X, time %u (%s), daqbits 0x%04X, evpgroups 0x%04X",reader->trgword,reader->evt_time,(int)stime,reader->daqbits,reader->evpgroups) ;
    

  }
}
示例#2
0
int main(int argc, char *argv[])
{
	int port ;
	const char *dest ;
	int i ;

	if(argc == 1) {
		port = 8006 ;
		dest = "172.16.0.1" ;
	}
	else {
		port = atoi(argv[1]) ;
		dest = RTS_LOG_HOST ;
	}


	
	printf("Default destination is -%s-, port %d\n",RTS_LOG_HOST,RTS_LOG_PORT) ;

	rtsLogLevel(DBG) ;
	rtsLogAddDest(dest,port) ;
	printf("Destination -%s-, port %d\n",dest,port) ;

	for(i=0;i<10000;i++) {
		LOG(DBG,"Testing log facility %u",i) ;
	}

	LOG(WARN,"This should be warning...",0,0,0,0,0) ;
	LOG(CRIT,"This is really critical...",0,0,0,0,0) ;

	return 0 ;
}