void FileHandler::publish(const sp<LogBuffer::LogRecord>& record) { if (record->getPriority() < getPriority()) { return; } sp<String> logMessage = record->toString(); int32_t logMessageSize = logMessage->length() + CRLF->length(); AutoLock autoLock(mLock); if (mDataVolumeLimit > 0) { if (mDataVolume + logMessageSize > mDataVolumeLimit) { return; } } if (mLimit > 0 && (mWriter->size() + logMessageSize) >= mLimit) { findNextGeneration(); } mWriter->write(logMessage); mWriter->newLine(); mFlushSize += logMessageSize; mDataVolume += logMessageSize; if (mFlushSize >= mBufferSize) { flush(); mFlushSize = 0; } }
void FileHandler::publish(const sp<LogBuffer::LogRecord>& record) { mWriter->write(record->toString()); mWriter->newLine(); mWriter->flush(); if (mLimit > 0 && mWriter->getSize() >= mLimit) { findNextGeneration(); } }