Skip to content

Conversation

@ueman
Copy link
Collaborator

@ueman ueman commented Nov 9, 2021

📜 Description

This is an integration which adds support for the logging package. It's the official dart logging solution.
I've added it as a seperate package in order to not bloat the Sentry Dart package.

💡 Motivation and Context

Closes #555

💚 How did you test it?

New tests and CI

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

Update docs.sentry.io

@codecov-commenter
Copy link

codecov-commenter commented Nov 9, 2021

Codecov Report

Merging #631 (c905ab2) into main (c2941ed) will increase coverage by 0.09%.
The diff coverage is 96.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #631      +/-   ##
==========================================
+ Coverage   90.28%   90.38%   +0.09%     
==========================================
  Files          93       95       +2     
  Lines        3038     3088      +50     
==========================================
+ Hits         2743     2791      +48     
- Misses        295      297       +2     
Impacted Files Coverage Δ
logging/lib/src/logging_integration.dart 92.59% <92.59%> (ø)
logging/lib/src/extension.dart 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2941ed...c905ab2. Read the comment docs.

@marandaneto
Copy link
Contributor

@ueman thanks a lot for doing this, will take a look at it next week :)

@ueman
Copy link
Collaborator Author

ueman commented Nov 16, 2021

@marandenato Did you have time yet?

@marandaneto
Copy link
Contributor

@marandenato Did you have time yet?

not yet, sorry about that, we usually have the meeting about new features on Wed. but we've split up and it got postponed due to schedule conflicts, will have a look latest the end of the week

@marandaneto
Copy link
Contributor

sentry_logging/test/extension_test.dart is an empty file.

thanks a lot for doing this @ueman , that's great.
I left a few comments and improvements :)

@ueman ueman marked this pull request as ready for review November 25, 2021 17:14
@marandaneto
Copy link
Contributor

missing changelog, and almost there :)

@ueman
Copy link
Collaborator Author

ueman commented Nov 26, 2021

It has a changelog, just not in the Changelog of the Dart/Flutter SDK. Danger probably has to be changed to account for the new logging package.

@marandaneto
Copy link
Contributor

@ueman lets rename the sentry_logging folder to logging only.
we need to create a symlink of CHANGELOG.md to the root CHANGELOG.md, because of pub release that requires a changelog, also because of Danger.
otherwise, good to go :)

@ueman
Copy link
Collaborator Author

ueman commented Nov 26, 2021

Okay, will do

Copy link
Contributor

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for doing this @ueman
let's see if @denrase or @brustolin has any insight, otherwise good to go.

Copy link
Contributor

@brustolin brustolin left a comment

Choose a reason for hiding this comment

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

LGTM!! 🎉

Copy link
Collaborator

@denrase denrase left a comment

Choose a reason for hiding this comment

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

Nice! We could add tests for the case where the logged level is equal to the min level and by this define the behaviour of it. Also maybe consider using mockito instead of the mock class if that makes sense at all here.


final fakeDsn = 'https://[email protected]/1234567';

class MockHub implements Hub {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we already use mockito, would it also be feasible to use it here instead of adding our own mock implementation?

Copy link
Contributor

Choose a reason for hiding this comment

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

I recall us running away from mockito because of a few issues (eg null safety back then), right now we probably have a mix of mockito + fakes, right? ideally, we'd stick to one of them going forward, I'd rather go with the fakes to avoid problems as in the past.

Copy link
Collaborator

@denrase denrase Nov 30, 2021

Choose a reason for hiding this comment

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

Yeah i just ran into issues with mockito and and nullability, this can be resolved using fallback generators. Used this in #643, but is is not ideal.

@marandaneto marandaneto merged commit 6b305d6 into getsentry:main Dec 2, 2021
@ueman ueman deleted the feat/logging branch December 9, 2021 17:43
@override
FutureOr<void> call(Hub hub, SentryOptions options) {
_hub = hub;
_setSdkVersion(options);
Copy link
Contributor

Choose a reason for hiding this comment

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

@ueman @marandaneto Should the SDK version be set here? This reports sentry.dart.logging .

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does it also report sentry.dart.logging for exceptions captured by sentry_flutter or sentry?
In general, every exception captured by sentry_logging should have sentry.dart.logging as its origin.

Copy link
Contributor

Choose a reason for hiding this comment

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

From what I understand, this is called only once when the integration is registered and overrides the original SDK.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

logging integration

6 participants