BatchLogOutput class

批量输出器 将日志批量收集后统一输出,提高性能。

包装一个 delegate 输出器,缓冲达到 batchSize 或距上次 flush 超过 batchInterval 时统一 flush。即使后续无新日志,定时器也会触发 flush, 避免缓冲日志无限期等待。

Inheritance

Constructors

BatchLogOutput({required LogOutput delegate, int batchSize = 100, Duration batchInterval = const Duration(seconds: 5)})

Properties

batchInterval → Duration
定时 flush 的最长间隔。
final
batchSize → int
单批最大条数,达到即 flush。
final
delegate → LogOutput
实际承载输出的委托输出器。
final
hashCode → int
The hash code for this object.
no setterinherited
isConsole → bool
转发 delegate 的控制台标识——否则 suppressConsole 条目会经缓冲 逃逸到包装的控制台输出器(分发层只看最外层输出器的 isConsole)。
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → Future<void>
销毁输出器(如 flush / 关闭流)。默认空实现。
override
flush() → Future<void>
initialize() → Future<void>
初始化输出器(如打开连接 / 文件)。默认空实现。
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
output(LogEntry entry) → Future<void>
输出一条日志条目。
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited