logServer function

Future<void> logServer(
  1. String message,
  2. String errorCode,
  3. String logType
)

Implementation

Future<void> logServer(String message, String errorCode, String logType) async {
  HttpUtilities api = HttpUtilities();
  String urlSuffix = "logs";
  String requestMethod = "POST";
  Map<String, dynamic> getParams = {};
  Map<String, dynamic> body = {
    'message': '$message ${errorCode.isNotEmpty ? '[$errorCode]' : ''}',
    'log_type': logType,
    'timestamp': nowToTimestamp(),
  };
  if (httpSvcDebug) {
    logDebug(
      'logServer | urlSuffix: $urlSuffix | requestMethod: $requestMethod | body: $body | getParams: $getParams',
    );
  }
  final apiResp = await api.httpsCall(
    requestMethod,
    urlSuffix,
    {},
    body,
    getParams,
    useServerLog: false,
  );
  if (httpSvcDebug) {
    logDebug('logServer | apiResp: $apiResp');
  }
}