Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use async await
  • Loading branch information
ueman committed Nov 23, 2021
commit a229695f3dba2032ee092f0b45fae31fe7ed2ed1
3 changes: 2 additions & 1 deletion sentry_logging/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ linter:
- prefer_relative_imports
- unnecessary_brace_in_string_interps
- implementation_imports
- require_trailing_commas
- require_trailing_commas
- unawaited_futures
8 changes: 4 additions & 4 deletions sentry_logging/lib/src/logging_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class LoggingIntegration extends Integration<SentryOptions> {
_setSdkVersion(options);
_subscription = Logger.root.onRecord.listen(
_onLog,
onError: (Object error, StackTrace stackTrace) {
_hub.captureException(error, stackTrace: stackTrace);
onError: (Object error, StackTrace stackTrace) async {
await _hub.captureException(error, stackTrace: stackTrace);
},
);
options.sdk.addIntegration('LoggingIntegration');
Expand All @@ -59,11 +59,11 @@ class LoggingIntegration extends Integration<SentryOptions> {
return logLevel > minLevel;
}

void _onLog(LogRecord record) {
void _onLog(LogRecord record) async {
// The event must be logged first, otherwise the log would also be added
// to the breadcrumbs for itself.
if (_isLoggable(record.level, _minEventLevel)) {
_hub.captureEvent(
await _hub.captureEvent(
record.toEvent(),
stackTrace: record.stackTrace,
);
Expand Down