logRequest static method
void
logRequest({})
Implementation
static void logRequest({
required String method,
required String url,
Map<String, String>? headers,
dynamic body,
String? requestId,
}) {
if (!_enabled) return;
final id = requestId != null ? ' $_gray[$requestId]$_reset' : '';
_line(_cyan);
_print('$_cyan│$_reset $_bold${_cyan}🚀 REQUEST$id$_reset $_gray${_ts()}$_reset');
_print('$_cyan│$_reset ${_mc(method)}$_bold$method$_reset $_white$url$_reset');
if (headers != null && headers.isNotEmpty) {
_print('$_cyan│$_reset $_yellow⊳ Headers$_reset');
headers.forEach((k, v) {
final val = k.toLowerCase() == 'authorization' ? '***masked***' : v;
_print('$_cyan│$_reset $_gray$k: $val$_reset');
});
}
if (_printPayload && body != null) {
_print('$_cyan│$_reset $_yellow⊳ Body$_reset');
_formatJson(body).split('\n').forEach((l) =>
_print('$_cyan│$_reset $_white$l$_reset'));
}
_line(_cyan);
}