printDataLogs static method

void printDataLogs(
  1. {List<String>? dataLogsType,
  2. List<String>? logLevels,
  3. int? startTimeInMillis,
  4. int? endTimeInMillis,
  5. FilterType? filterType}
)

printDataLogs

This will return array of logs grouped by dataType and print them as a string using StringBuffer()

Implementation

static void printDataLogs({
  List<String>? dataLogsType,
  List<String>? logLevels,
  int? startTimeInMillis,
  int? endTimeInMillis,
  FilterType? filterType,
}) async {
  print(Constants.PRINT_DATA_LOG_MSG);

  _getAllSortedByFilter(
          filters: Filters.generateFilters(
              dataLogsType: dataLogsType,
              logLevels: logLevels,
              startTimeInMillis: startTimeInMillis,
              endTimeInMillis: endTimeInMillis,
              filterType: filterType))
      .then((logs) {
    var buffer = StringBuffer();

    if (logs.isNotEmpty) {
      logs.forEach((log) {
        buffer.write(Formatter.format(log, _config));
      });
      print(buffer.toString());
    } else {
      print("No logs found!");
    }
    buffer.clear();
  });
}