Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions packages/logging/lib/src/logging_integration.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';

import 'package:meta/meta.dart';
import 'package:logging/logging.dart';
import 'package:sentry/sentry.dart';

Expand Down Expand Up @@ -49,6 +50,9 @@ class LoggingIntegration implements Integration<SentryOptions> {
late Hub _hub;
late SentryOptions _options;

@internal
static const origin = 'auto.log.logging';
Copy link
Contributor Author

@buenaflor buenaflor Aug 7, 2025

Choose a reason for hiding this comment

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

e.g Java will add auto.log.logback for their logback integration with logs

also open to replacing logging with something else but since it's the name of the package it's fine I think


@override
void call(Hub hub, SentryOptions options) {
_hub = hub;
Expand Down Expand Up @@ -98,6 +102,7 @@ class LoggingIntegration implements Integration<SentryOptions> {
'loggerName': SentryLogAttribute.string(record.loggerName),
'sequenceNumber': SentryLogAttribute.int(record.sequenceNumber),
'time': SentryLogAttribute.int(record.time.millisecondsSinceEpoch),
'sentry.origin': SentryLogAttribute.string(origin),
};

// Map log levels based on value ranges
Expand Down
1 change: 1 addition & 0 deletions packages/logging/test/logging_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ void main() {
expect(basicAttributes['loggerName']?.value, 'TestLogger');
expect(basicAttributes['sequenceNumber']?.value, isA<int>());
expect(basicAttributes['time']?.value, isA<int>());
expect(basicAttributes['sentry.origin']?.value, LoggingIntegration.origin);
expect(basicAttributes.containsKey('error'), false);
expect(basicAttributes.containsKey('stackTrace'), false);

Expand Down
Loading