void logRequest({
  required String method,
  required String url,
  required int status,
  required Duration duration,
  DateTime? startTime,
  String? body,
  Map<String, String>? responseHeaders,
}) {
  final start = startTime ?? DateTime.now();
  final timestamp = start.toIso8601String();
  final durationMs = duration.inMilliseconds;
  final bodyPreview = body != null && body.length > 500 ? '${body.substring(0, 500)}...' : body;

  print('[$timestamp] $method $url -> $status (${durationMs}ms)');
  if (bodyPreview != null && bodyPreview.isNotEmpty) {
    print('  Body: $bodyPreview');
  }
  if (responseHeaders != null) {
    final contentType = responseHeaders['content-type'];
    if (contentType != null) {
      print('  Content-Type: $contentType');
    }
  }
  print('');
}
