Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: use slog handler #17

Merged
merged 2 commits into from
Mar 16, 2024
Merged

Conversation

injeniero
Copy link
Contributor

Using the handler directly allows to correctly set the Record.PC

This PR also fixes #15

Using the handler directly allows to correctly set the Record.PC
Copy link

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

This fixes the issue raised but also eliminates the benefit of a structure logger as everything is now just a Sprintf.

Is there a way where we can have Info and Infof etc?

@injeniero
Copy link
Contributor Author

We can do that, but this is targeting GORM lib, and they use their interface as if it was a Sprintf call. It would be on them to extend their Interface and add new methods.

Why would you like to add methods that are not part of the interface?

Copy link

codecov bot commented Mar 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8f2dbf0) to head (83f719f).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #17   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          129       143   +14     
=========================================
+ Hits           129       143   +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stevenh
Copy link

stevenh commented Mar 9, 2024

We can do that, but this is targeting GORM lib, and they use their interface as if it was a Sprintf call. It would be on them to extend their Interface and add new methods.

Why would you like to add methods that are not part of the interface?

Would be nice to support a more structured approach, but that would require internal changes to gorm, so I think this is the best that can be done without a breaking change there.

@injeniero
Copy link
Contributor Author

@stevenh coverage improved :-)

@injeniero
Copy link
Contributor Author

@orandin tagging you to get this rolling. Please let me know if you want something else changed. Thanks!!

@orandin orandin merged commit 5c0b52f into orandin:master Mar 16, 2024
3 checks passed
@orandin
Copy link
Owner

orandin commented Mar 16, 2024

@injeniero thank you for your great contribution and @stevenh for your review 🥳

@injeniero injeniero deleted the feat/use-slog-handler branch March 22, 2024 15:57
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatible with expected Writer interface
3 participants