SessionLogger constructor

SessionLogger({
  1. int maxLogSize = 500,
  2. void onLog(
    1. SessionLogEntry entry
    )?,
  3. void onLogBatch(
    1. List<SessionLogEntry> entries,
    2. LogFlushReason reason
    )?,
  4. Duration? logInterval,
})

Implementation

SessionLogger({
  this.maxLogSize = 500,
  this.onLog,
  this.onLogBatch,
  this.logInterval,
}) {
  if (onLogBatch != null && logInterval != null) {
    final effectiveInterval = logInterval! > Duration.zero ? logInterval! : Duration.zero;
    _timer = Timer.periodic(effectiveInterval, (_) => flush(reason: LogFlushReason.interval));
  }
}