logMapping static method

void logMapping(
  1. Type originalType,
  2. Type skeletonType,
  3. String reason, {
  4. Map<String, dynamic>? metadata,
})

Logs a widget-to-skeleton mapping.

Implementation

static void logMapping(
  Type originalType,
  Type skeletonType,
  String reason, {
  Map<String, dynamic>? metadata,
}) {
  if (!_enabled) return;

  final entry = SkeletonDebugEntry(
    timestamp: DateTime.now(),
    originalType: originalType,
    skeletonType: skeletonType,
    reason: reason,
    metadata: metadata,
  );

  _log.add(entry);

  // Evict old entries
  if (_log.length > _maxLogSize) {
    _log.removeRange(0, _log.length - _maxLogSize);
  }

  if (_verbose) {
    debugPrint('[SkeletonDebug] $originalType → $skeletonType ($reason)');
    if (metadata != null && metadata.isNotEmpty) {
      debugPrint('  Metadata: $metadata');
    }
  }
}