call method

  1. @override
FutureOr<void> call(
  1. Hub hub,
  2. SentryOptions options
)

A Callable method for the Integration interface

Implementation

@override
FutureOr<void> call(Hub hub, SentryOptions options) {
  if (TracingDelegate.hasBeenInstalled) {
    unawaited(
      Sentry.captureException(
        'CouchbaseLiteIntegration: Cannot install SentryTracingDelegate '
        'because another delegate has already been installed.',
        stackTrace: StackTrace.current,
      ),
    );
    return null;
  }

  final tracingDelegate = _tracingDelegate = SentryTracingDelegate(
    sentryDsn: options.dsn,
    tracingEnabled: tracingEnabled ?? options.isTracingEnabled(),
    traceInternalOperations: traceInternalOperations,
    operationBreadcrumbs: operationBreadcrumbs,
    onInitialize: () {
      if (breadcrumbLogLevel != LogLevel.none) {
        Database.log.custom = _breadcrumbLogger = BreadcrumbLogger(
          level: breadcrumbLogLevel,
        );
      }
    },
  );
  unawaited(TracingDelegate.install(tracingDelegate));

  options.sdk.addIntegration('couchbaseLiteIntegration');
}