fde96c0197
- Add Swagger UI files and updated API spec for Family Safety Tracker - Replace shelf_cors_headers with custom CORS middleware in server.dart - Add request_logger middleware with timing for auth and geo routes - Add REGISTRATION_SECRET_KEY to .env for registration validation - Remove postgres port exposure from docker-compose.yml - Update opencode.json model configuration - Add crypto dependency and update Flutter web assets
27 lines
790 B
Dart
27 lines
790 B
Dart
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('');
|
|
}
|