bootInit method

void bootInit({
  1. Map<String, dynamic>? bootDetails,
})

Call once at the very start of main(). Reads the prior trail, mirrors it to Log with a banner, increments the boot counter, then writes a fresh BOOT_START event with bootDetails.

Swallows its own errors and reports them through Log.err so a broken audit trail can never break startup.

Implementation

void bootInit({Map<String, dynamic>? bootDetails}) {
  try {
    _bootNumber = _readBootCounter() + 1;
    _writeBootCounter(_bootNumber);

    Log.info('boot #$_bootNumber — prior entries: ${_cache.length}');
    for (final entry in _cache) {
      Log.info(_formatEntry(entry));
    }

    log('BOOT_START', bootDetails);
  } catch (e) {
    Log.err('BootAudit.bootInit failed: $e');
  }
}