logRequest function
void
logRequest(
- RequestOptions options
Implementation
void logRequest(RequestOptions options) {
var string = """
\n->->->->->->->->->->Request->->->->->->->->->
[URL] ${options.uri}
[Method] ${options.method}
[ConnectTimeout] ${options.connectTimeout}
[ReceiveTimeout] ${options.receiveTimeout}
[FollowRedirects] ${options.followRedirects}
""";
if (!options.headers.isEmptyOrNull) {
string += """
[Header]
${jsonEncode(options.headers)}
""";
}
if (!options.extra.isEmptyOrNull) {
string += """
[Extra]
${jsonEncode(options.extra)}
""";
}
if (options.data != null) {
string += """
[Body]
${options.data is Map ? jsonEncode(options.data) : options.data}
""";
}
string += "->->->->->->->->->->Request->->->->->->->->->";
logInfo(string);
}