exportLogs static method

Future<File> exportLogs()

exportLogs

This will export logs to external storage under FLog directory

Implementation

static Future<File> exportLogs() async {
  var buffer = StringBuffer();

  print(Constants.PRINT_EXPORT_MSG);

  //get all logs and write to file
  final logs = await _getAllLogs();

  logs.forEach((log) {
    buffer.write(Formatter.format(log, _config));
  });

  // writing logs to file and returning file object
  final file = await _storage.writeLogsToFile(buffer.toString());
  print(buffer.toString());
  buffer.clear();
  return file;
}