groveman_sentry 1.0.4 copy "groveman_sentry: ^1.0.4" to clipboard
groveman_sentry: ^1.0.4 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,
    ]),
  );
);

📝 License #

Copyright © 2022 Kauê Martins
This project is MIT licensed

1
likes
160
points
140
downloads

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

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

groveman, meta, sentry

More

Packages that depend on groveman_sentry