SentryLogEvent class
A subclass of LogEvent that encapsulates data specific to Sentry logging.
This class extends LogEvent to include functionality for logging errors with Sentry, including optional stack trace information. It is tailored to log error messages and their associated stack traces to Sentry, aiding in debugging and monitoring application health.
The class is designed to provide a structured format for error reporting, making it easier to understand the context and specifics of an error when viewed in the Sentry dashboard.
Example:
var sentryEvent = SentryLogEvent(
eventName: 'error_occurred',
eventMessage: 'Unexpected error encountered',
stackTrace: 'Stack trace here...',
);
logger.log('An error event', event: sentryEvent);
Constructors
-
SentryLogEvent({String? stackTrace, required String eventName, String? eventMessage, Map<
String, Object> ? parameters = const {}}) - Constructs a SentryLogEvent with optional stack trace and required event attributes.
Properties
- eventMessage → String?
-
An optional message associated with the event, providing additional detail about the event's context or outcome.
finalinherited
- eventName → String
-
The name of the event. This is a required field and is used to identify the type of the event.
finalinherited
- hashCode → int
-
Generates a hash code based on the event name.
no setterinherited
-
parameters
→ Map<
String, Object> ? -
A map of key-value pairs containing additional parameters that provide more context to the event.
This is useful for passing additional data that may be relevant to specific logs.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → String?
-
An optional stack trace string that provides details about the error's location and state at the time of error.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> -
Converts the SentryLogEvent to a map, including the event name, message, and stack trace.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
Checks the equality of LogEvent instances based on the event name.
inherited