Ejemplo n.º 1
0
//-------------------------------------------------------
void ofLog::_log(ofLogLevel logLevel, string message){
	if(logLevel >= currentLogLevel){
		if(logLevel == OF_LOG_VERBOSE){
			#ifdef TARGET_ANDROID
				LOGVERBOSE(message.c_str());
			#else
				printf("OF_VERBOSE: ");
			#endif
		}
		else if(logLevel == OF_LOG_NOTICE){
			#ifdef TARGET_ANDROID
				LOGNOTICE(message.c_str());
			#else
						printf("OF_NOTICE: ");
			#endif
		}
		else if(logLevel == OF_LOG_WARNING){
			#ifdef TARGET_ANDROID
				LOGWARNING(message.c_str());
			#else
				printf("OF_WARNING: ");
			#endif
		}
		else if(logLevel == OF_LOG_ERROR){
			#ifdef TARGET_ANDROID
				LOGERROR(message.c_str());
			#else
				printf("OF_ERROR: ");
			#endif
		}
		else if(logLevel == OF_LOG_FATAL_ERROR){
			#ifdef TARGET_ANDROID
				LOGFATAL(message.c_str());
			#else
				printf("OF_FATAL_ERROR: ");
			#endif
		}
		#ifndef TARGET_ANDROID
			printf("%s\n",message.c_str());
		#endif
	}
}
Ejemplo n.º 2
0
void serialport_flush(void)
{
	unsigned char tmp[512];
    if(sPort)
    {
		LOGDEBUG("flush start"); 
		unsigned old_timeout = sTIMEOUTS.ReadTotalTimeoutConstant;
		serialport_set_timeout(1);
		ClearCommError(sPort, NULL, NULL);
		PurgeComm(sPort, PURGE_TXCLEAR|PURGE_RXCLEAR);
		unsigned long cb;
		int result;
		do {
			result = ReadFile(sPort, tmp, 512, &cb, NULL);
			LOGVERBOSE("flushed %lu bytes", cb);
		} while(cb && result == 0);
		serialport_set_timeout(old_timeout);
		LOGDEBUG("flush complete");
    }
}