minor dartdoc clean-up; 2.0.2 version bump (#18)

This commit is contained in:
Yegor
2018-05-15 10:42:00 -07:00
committed by GitHub
parent 78ef3f7b33
commit 5715d15cd6
4 changed files with 35 additions and 20 deletions

View File

@ -1,5 +1,9 @@
# package:sentry changelog # package:sentry changelog
## 2.0.2
- Add support for user context in Sentry events.
## 2.0.1 ## 2.0.1
- Invert stack frames to be compatible with Sentry's default culprit detection. - Invert stack frames to be compatible with Sentry's default culprit detection.

View File

@ -143,12 +143,16 @@ class SentryClient {
/// Attached to the event payload. /// Attached to the event payload.
final String projectId; final String projectId;
/// The user data that will get sent with every logged event /// Information about the current user.
/// ///
/// Note that a [Event.userContext] that is set on a logged [Event] /// This information is sent with every logged event. If the value
/// will override the [User] context set here. /// of this field is updated, all subsequent events will carry the
/// new information.
/// ///
/// see: https://docs.sentry.io/learn/context/#capturing-the-user /// [Event.userContext] overrides the [User] context set here.
///
/// See also:
/// * https://docs.sentry.io/learn/context/#capturing-the-user
User userContext; User userContext;
@visibleForTesting @visibleForTesting
@ -178,7 +182,7 @@ class SentryClient {
if (environmentAttributes != null) if (environmentAttributes != null)
mergeAttributes(environmentAttributes.toJson(), into: data); mergeAttributes(environmentAttributes.toJson(), into: data);
// merge the user context // Merge the user context.
if (userContext != null) { if (userContext != null) {
mergeAttributes({'user': userContext.toJson()}, into: data); mergeAttributes({'user': userContext.toJson()}, into: data);
} }
@ -343,7 +347,7 @@ class Event {
/// they must be JSON-serializable. /// they must be JSON-serializable.
final Map<String, dynamic> extra; final Map<String, dynamic> extra;
/// User information that is sent with the logged [Event] /// Information about the current user.
/// ///
/// The value in this field overrides the user context /// The value in this field overrides the user context
/// set in [SentryClient.userContext] for this logged event. /// set in [SentryClient.userContext] for this logged event.
@ -420,14 +424,20 @@ class Event {
} }
} }
/// An interface which describes the authenticated User for a request. /// Describes the current user associated with the application, such as the
/// You should provide at least either an id (a unique identifier for an /// currently signed in user.
/// authenticated user) or ip_address (their IP address). ///
/// The user can be specified globally in the [SentryClient.userContext] field,
/// or per event in the [Event.userContext] field.
///
/// You should provide at least either an [id] (a unique identifier for an
/// authenticated user) or [ipAddress] (their IP address).
/// ///
/// Conforms to the User Interface contract for Sentry /// Conforms to the User Interface contract for Sentry
/// https://docs.sentry.io/clientdev/interfaces/user/ /// https://docs.sentry.io/clientdev/interfaces/user/.
///
/// The outgoing JSON representation is:
/// ///
/// The outgoing json representation is:
/// ``` /// ```
/// "user": { /// "user": {
/// "id": "unique_id", /// "id": "unique_id",
@ -438,10 +448,10 @@ class Event {
/// } /// }
/// ``` /// ```
class User { class User {
/// The unique ID of the user. /// A unique identifier of the user.
final String id; final String id;
/// The username of the user /// The username of the user.
final String username; final String username;
/// The email address of the user. /// The email address of the user.
@ -450,16 +460,17 @@ class User {
/// The IP of the user. /// The IP of the user.
final String ipAddress; final String ipAddress;
/// Any other user context information that may be helpful /// Any other user context information that may be helpful.
/// All other keys are stored as extra information but not ///
/// specifically processed by sentry. /// These keys are stored as extra information but not specifically processed
/// by Sentry.
final Map<String, dynamic> extras; final Map<String, dynamic> extras;
/// At a minimum you must set an [id] or an [ipAddress] /// At a minimum you must set an [id] or an [ipAddress].
const User({this.id, this.username, this.email, this.ipAddress, this.extras}) const User({this.id, this.username, this.email, this.ipAddress, this.extras})
: assert(id != null || ipAddress != null); : assert(id != null || ipAddress != null);
/// produces a [Map] that can be serialized to JSON /// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return { return {
"id": id, "id": id,

View File

@ -9,7 +9,7 @@
library version; library version;
/// The SDK version reported to Sentry.io in the submitted events. /// The SDK version reported to Sentry.io in the submitted events.
const String sdkVersion = '2.0.1'; const String sdkVersion = '2.0.2';
/// The SDK name reported to Sentry.io in the submitted events. /// The SDK name reported to Sentry.io in the submitted events.
const String sdkName = 'dart'; const String sdkName = 'dart';

View File

@ -1,5 +1,5 @@
name: sentry name: sentry
version: 2.0.1 version: 2.0.2
description: A pure Dart Sentry.io client. description: A pure Dart Sentry.io client.
author: Flutter Authors <flutter-dev@googlegroups.com> author: Flutter Authors <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/sentry homepage: https://github.com/flutter/sentry