output method
输出一条日志条目。
Implementation
@override
Future<void> output(LogEntry entry) async {
_buffer.add(entry);
final now = DateTime.now();
final lastFlush = _lastFlushTime;
final shouldFlush = _buffer.length >= batchSize ||
(lastFlush != null && now.difference(lastFlush) >= batchInterval);
if (shouldFlush) {
await flush();
} else {
// 即使后续没有新日志到来,定时器也会在 batchInterval 后触发 flush。
_armFlushTimer();
}
}