Пример #1
0
void writeLog(const char *s, int length) {
	int forceBuffering = (dobuffering++ % 60) != 0;
	int restLength = commonInfo->maxLogBufferLength - commonInfo->logBufferLength;
	if (restLength < 512)
		forceBuffering = 0;
	if (commonInfo->inWriteLog || forceBuffering) {
		appendToLogBuffer(s, length);
		return;
	}

	commonInfo->inWriteLog++;

	if (!commonInfo->logKeepOpen) {
		openLogFile();
	}

	flushLogBuffer();

	if (sceIoWrite(commonInfo->logFd, s, length) < 0) {
		// Can't write to the log file right now, probably because the interrupts are disabled.
		// Save the log string for later output.
		appendToLogBuffer(s, length);
	} else {
		flushLogBuffer();
	}

	if (!commonInfo->logKeepOpen) {
		closeLogFile();
	}

	commonInfo->inWriteLog--;
}
Пример #2
0
void writeLog(const char *s, int length) {
	if (commonInfo->inWriteLog) {
		appendToLogBuffer(s, length);
		return;
	}

	commonInfo->inWriteLog++;

	if (!commonInfo->logKeepOpen) {
		openLogFile();
	}

	flushLogBuffer();

	if (ioWrite(commonInfo->logFd, s, length) < 0) {
		// Can't write to the log file right now, probably because the interrupts are disabled.
		// Save the log string for later output.
		appendToLogBuffer(s, length);
	} else {
		flushLogBuffer();
	}

	if (!commonInfo->logKeepOpen) {
		closeLogFile();
	}

	commonInfo->inWriteLog--;
}
Пример #3
0
static void updateChunkPtr()
{
    uart_print("updateChunkPtr\r\n");
    chunkPtr[bank_] = (chunkPtr[bank_] + 1) % CHUNKS_PER_PAGE;
    uart_print("new chunkPtr for bank "); uart_print_int(bank_); uart_print(" is "); uart_print_int(chunkPtr[bank_]); uart_print("\r\n");
    if (chunkPtr[bank_] == 0)
        flushLogBuffer();
}
Пример #4
0
void MainWindow::log(const QString &txt, int logLevel)
{
    if (logLevel & this->logLevel) {
        logBuffer << txt;
        if (logLevel != rxTxLog || logBuffer.length() >= 50) {
            flushLogBuffer();
        }
    }
}