setLogCallback function

void setLogCallback(
  1. LogHandler handler
)

Sends the log messages of every runtime in the process to a callback.

The callback replaces the one set before.

The callback runs asynchronously in the isolate and zone that registered it, after native queues the call.

See mln_log_set_callback in the C API reference.

Implementation

void setLogCallback(LogHandler handler) {
  ensureAbiVersion();
  final registrations = _NativeRegistrations(_globalCallbackRoots);
  _check(
    registrations.run(
      () => raw.mln_log_set_callback(
        registrations.add(_prepareLogHandler(handler, registrations.roots)),
        nativeDiagnostic,
      ),
    ),
  );
}