groveman_sentry 1.1.0 copy "groveman_sentry: ^1.1.0" to clipboard
groveman_sentry: ^1.1.0 copied to clipboard

Groveman tree that sends its logs to Sentry.io through Breadcrumbs and events capture.

Groveman Sentry #

pub License: MIT groveman_sentry codecov

Tree for the groveman.

It sends your logs to the Sentry.

This works perfectly with sentry-dart and sentry-flutter 🙌

Usage #

Add it in your pubspec.yaml:

dependencies:    
  groveman:
  groveman_sentry:
  sentry: 
  // or
  sentry_flutter: 

Import it where you want to use it e.g, in your main file.

import 'package:groveman/groveman.dart';
import 'package:groveman_sentry/groveman_sentry.dart';

Initialize Sentry and plant the SentryTree at the start of your application.

import 'package:flutter/widgets.dart';
import 'package:groveman/groveman.dart';
import 'package:groveman_sentry/groveman_sentry.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

void main() {  
  Groveman.plantTree(DebugTree());
  Groveman.captureErrorInZone(() async {
    WidgetsFlutterBinding.ensureInitialized();
    await SentryFlutter.init(
      (options) {
        options.dsn = 'https://example@sentry.io/add-your-dsn-here';
      },
    );    
    if (kReleaseMode) {
      Groveman.plantTree(SentryTree());
    }
    Groveman.captureErrorInCurrentIsolate();
    runApp(const MyApp());
  });
}

Usually, you only send your logs in production.

By default, the log levels info, warning, error, and fatal are sent to Sentry.

Groveman.error(message, error: exception);

If the LogRecord.error is not null, it will be sent using captureEvent, otherwise, is used addBreadcrumb.

LogRecord converted in SentryEvent:

  • LogRecord.level -> SentryLevel
  • LogRecord.message -> SentryMessage(message)
  • LogRecord.extra -> extra
  • LogRecord.error -> throwable
  • LogRecord.tag -> tags

groveman is sent as logger in SentryEvent.
The LogRecord.stackTrace is only sent in captureEvent.

LogRecord converted in Breadcrumb:

  • LogRecord.level -> SentryLevel
  • LogRecord.message -> message
  • LogRecord.extra -> data

To custom, pass the levels that desire to send when creating the SentryTree.

Groveman.plantTree(
    SentryTree(logLevels: [
        LogLevel.warning,
        LogLevel.info,
    ]),
  );
);

Identifier Tree #

SentryTree implements the IdentifierTree mixin, which allows you to enrich your Sentry events with user and context data via the Sentry scope.

Set user #

Groveman.setUserIdentifier(
  UserIdentifier(
    id: '1',
    email: 'user@example.com',
    username: 'username',
    name: 'User Name',
    ipAddress: '127.0.0.1',
    geo: UserGeoIdentifier(
      city: 'São Paulo',
      countryCode: 'BR',
      region: 'SP',
    ),
    data: {'key': 'value'},
  ),
);

All fields are mapped directly to the SentryUser.

Set context and tags #

Groveman.setIdentifiers(
  context: {
    'device': {'model': 'Pixel 9'},
  },
  tags: {
    'environment': 'production',
  },
);

Context is set via setContexts and tags via setTag on the Sentry scope.

See the Sentry documentation for more details:

Note: Sentry tags only support primitive values (int, num, String, bool).

Clear identifiers #

Use these methods to remove identification data from the Sentry scope.

// Removes the current user from the Sentry scope
Groveman.clearUserIdentifier();

// Removes specific context and tag keys from the Sentry scope
Groveman.clearIdentifiers(
  contextKeys: ['device'],
  tagKeys: ['environment'],
);

// Removes all user, context and tags from the Sentry scope
Groveman.clearAllIdentifiers();

📝 License #

Copyright © 2026 Kauê Martins
This project is MIT licensed

1
likes
160
points
214
downloads

Documentation

Documentation
API reference

Publisher

verified publisherkmartins.dev

Weekly Downloads

Groveman tree that sends its logs to Sentry.io through Breadcrumbs and events capture.

Homepage
Repository (GitHub)
View/report issues

Topics

#logging #sentry #report

License

MIT (license)

Dependencies

groveman, meta, sentry

More

Packages that depend on groveman_sentry