-
-
Notifications
You must be signed in to change notification settings - Fork 257
Logging integration behaviour when message is Object
is inconsistent with the Logging package
#1581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this is the root cause: Breadcrumb.toJson returns invalid Dart JSON map, containing the instance of the class passed to the logger. I think this map should only contain the well known JSON types that are used in Dart. i.e. Map<String, dynamic>, with the dynamic representing int, double, List or Map. Any other type can get turned into a String. Altough this doesn't make a lot of sense, as the string version of the object is already available in the message field. |
Hi, Related sentry-dart/dart/lib/src/protocol/breadcrumb.dart Lines 179 to 190 in d783424
|
That is a bug when calling the Native bridge and syncing data, thanks for raising this. Instead of fixing this only for crumbs, I'd rather do something similar to sentry-dart/dart/lib/src/utils.dart Lines 27 to 36 in d783424
Map , so the bridge is always called with a valid Map .
The code that fallback to |
Ideally, https://github.com/flutter/flutter/blob/ad0aa8de75120f532463e493d5671cb72354250b/packages/flutter/lib/src/services/message_codecs.dart#L464 would fallback to |
@ueman shared a code snippet:
This will make it serializable but it has the cost to do a serialization roundtrip. |
Platform
Dart
Obfuscation
Enabled
Debug Info
Enabled
Doctor
Version
7.9.0
Steps to Reproduce
Logger('test').info(DemoObject());
Expected Result
Sentry creates a breadcrumb from the log that matches the output of the app's logger.
Actual Result
Sentry drops the breadcrumb with an exception.
It seems like the caller of
StandardMessageCodec.writeValue
should calltoString()
before passing the Object?Are you willing to submit a PR?
None
The text was updated successfully, but these errors were encountered: