Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/includes/getting-started-primer/dart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Sentry's Dart SDK enables automatic reporting of errors, messages, and exception
- [User Feedback](/platforms/dart/enriching-events/user-feedback/) provides the ability to collect user information when an event occurs.
- [Performance Monitoring](/product/performance/) creates transactions for:
- [HTTP requests](/platforms/dart/configuration/integrations/http-integration/#performance-monitoring-for-http-requests)
- [Logging Integration](/platforms/dart/configuration/integrations/logging)
6 changes: 6 additions & 0 deletions src/includes/getting-started-primer/flutter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ Features:
- via the Native SDKs [Automatic Breadcrumbs for Android](/platforms/android/enriching-events/breadcrumbs/#automatic-breadcrumbs) and [Automatic Breadcrumbs for iOS](/platforms/apple/configuration/integrations/default/#sentryautobreadcrumbtrackingintegration)
- as well as `http` with the [Dart SDK](/platforms/dart/)
- [Release Health](/product/releases/health/) tracks crash free users and sessions
- [Attachments](/platforms/flutter/enriching-events/attachments/) enrich your event by storing additional files, such as config or log files.
- [User Feedback](/platforms/flutter/enriching-events/user-feedback/) provides the ability to collect user information when an event occurs.
- [Performance Monitoring](/product/performance/) creates transactions for:
- [HTTP requests](/platforms/flutter/performance/instrumentation/automatic-instrumentation/#httpclient-library-instrumentation)
- [Routing Instumentation](/platforms/flutter/performance/instrumentation/automatic-instrumentation/#routing-instumentation)
- [Logging Integration](/platforms/dart/configuration/integrations/logging)
- Limited support for Flutter Web, Windows, and Linux
- Under the hood the SDK relies on the [Dart SDK](/platforms/dart/); the minimum required version is `2.12.0` and Flutter SDK version is `1.17.0`.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ SentryAndroid.init(this, options -> {

## Verify

This snippet includes a HTTP Request and captures an intentional message, so you can test that everything is working as soon as you set it up:
This snippet captures an intentional error, so you can test that everything is working as soon as you set it up:

```kotlin
import androidx.appcompat.app.AppCompatActivity
Expand Down
69 changes: 69 additions & 0 deletions src/platforms/dart/configuration/integrations/logging.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Logging Integration
caseStyle: canonical
supportLevel: production
sidebar_order: 3
description: "Learn more about the Sentry Logging integration for the Dart SDK."
---

The `sentry_logging` library provides [Logging](https://pub.dev/packages/logging) support for Sentry using the [onRecord property](https://pub.dev/documentation/logging/latest/logging/Logger/onRecord.html). It is able to collect breadcrumbs and capture events. Once this integration is configured, you can use Logging’s public API exclusively or in combination to the Sentry's SDK API to capture and enrich events.

The source can be found [on GitHub](https://github.com/getsentry/sentry-dart/tree/main/logging/).

## Install

To add the Logging integration, add the `sentry_logging` dependency.

```yml {filename:pubspec.yaml}
dependencies:
sentry: ^6.3.0
sentry_logging: ^6.3.0
logging: ^1.0.2
Comment on lines +19 to +21
Copy link
Member

@bruno-garcia bruno-garcia Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the package on release registry?

Suggested change
sentry: ^6.3.0
sentry_logging: ^6.3.0
logging: ^1.0.2
sentry: ^{{ packages.version('sentry.dart') }}
sentry_logging: ^{{ packages.version('sentry.dart.logging') }}
logging: ^1.0.2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, that's why it's not using packages.version otherwise versions won't be aligned, I will fix that once I add it to the release registry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

```

## Configure

Configuration should happen as early as possible in your application's lifecycle.

```dart
import 'package:sentry_logging/sentry_logging.dart';
import 'package:sentry/sentry.dart';

Future<void> main() async {
await Sentry.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
options.addIntegration(LoggingIntegration());
},
appRunner: initApp, // Init your App.
);
}
```

## Verify

This snippet captures an intentional error, so you can test that everything is working as soon as you set it up:

```dart
import 'package:logging/logging.dart';

void main() async {
final log = Logger('MyAwesomeLogger');

log.info('a breadcrumb!');

try {
throw Exception();
} catch (error, stackTrace) {
log.severe('an error!', error, stackTrace);
}
}
```

<Note>

Learn more about manually capturing an error or message, in our <PlatformLink to="/usage/">Usage documentation</PlatformLink>.

</Note>

To view and resolve the recorded message, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.