$on method

void $on(
  1. Iterable<PrismaLogLevel> levels,
  2. PrismaLogHandler handler
)

The $on() method allows you to subscribe to events.

All message use a Exception class wrapper.

Example:

prisma.$on({PrismaLogLevel.query}, (e) {
  if (e is PrismaQueryEvent) {
    print(e.query);
  }
});

Implementation

void $on(Iterable<PrismaLogLevel> levels, PrismaLogHandler handler) =>
    $engine.logEmitter.on(levels.toSet(), handler);