DVLogShipper.toBackend constructor
DVLogShipper.toBackend({})
Posts to the application's own backend at endpoint, read at send time
so the runtime's base URL is the one in force.
Implementation
factory DVLogShipper.toBackend({
required Uri Function() endpoint,
required String installId,
required String release,
required String platform,
DVLogLevel level = DVLogLevel.warn,
int batch = 50,
http.Client? client,
Duration timeout = const Duration(seconds: 15),
}) =>
DVLogShipper(
post: (String body) async {
final http.Client sending = client ?? http.Client();
try {
final http.Response response = await sending
.post(endpoint(),
headers: const <String, String>{
'content-type': 'application/json; charset=utf-8',
},
body: body)
.timeout(timeout);
return response.statusCode;
} finally {
if (client == null) sending.close();
}
},
installId: installId,
release: release,
platform: platform,
level: level,
batch: batch,
);