log method

Future<void> log({
  1. required String url,
  2. required int statusCode,
  3. required Map<String, String> header,
  4. required Map<String, dynamic> requestBody,
  5. required String responseBody,
})

Implementation

Future<void> log({
  required String url,
  required int statusCode,
  required Map<String, String> header,
  required Map<String, dynamic> requestBody,
  required String responseBody,
}) async {
  try {
    httpConsolePrint(url, statusCode, header, requestBody, responseBody);
    if (!AppLogger.instance.configuration.httpLog) return;
    final logModel = LogModel(
      id: LogType.API,
      data: HttpLogModel(
        appInfo: await AppInfo.instance(),
        url: url,
        header: header,
        requestBody: requestBody,
        responseStatus: statusCode.toString(),
        response: responseBody,
      ),
    );
    AppLogger.instance.callBackFun(logModel);
  } catch (e) {
    debugPrint('App logger error: $e');
  }
}