onLogEvent method
Implementation
Future<void> onLogEvent(LogEvent event, Emitter emit) async {
try {
final serverUrl = getServerUrl();
final body = json.safeEncode(EditorMessage("log", {
"origin": "client",
"type": event.type,
"message": event.message,
"context": event.context,
"error": event.error?.toString(),
"stackTrace": event.stackTrace?.toString(),
}));
await http.post(Uri.parse(serverUrl), body: body);
} catch (e, stack) {
_log.severe("Error sending log to Editor: $e", e, stack);
}
}