Skip to content

feat: retain debug tracing behavior of default logger #6

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

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

tauu
Copy link
Contributor

@tauu tauu commented Dec 6, 2023

This PR introduces the same debug handling, which the default gorm logger uses. That is calling db.Debug() with db being a *gorm.DB object, will enable logging of all database queries for the returned gorm.DB. This functionality is commonly used to debug specific queries in a program.\

db.Debug() sets the log level of the default logger to "info" to achieve this behavior. Retaining this functionality is implemented by setting the traceAll flag to true, when the log level is set to info via the LogMode interface function.

@orandin orandin added the enhancement New feature or request label Dec 7, 2023
@injeniero
Copy link
Contributor

@tauu It would be great if you can fix the test to get this moving.

@tauu
Copy link
Contributor Author

tauu commented Mar 6, 2024

done. :-) I modified the PR a bit to store the log level set via LogMode() instead of altering the traceAll flag.

@injeniero
Copy link
Contributor

@orandin This looks more like a bug to me than an enhancement. Without this change, the implementation is not fulfilling the interface intention.

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 (0102563).

Additional details and impacted files
@@            Coverage Diff            @@
##            master        #6   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          129       138    +9     
=========================================
+ Hits           129       138    +9     

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

@orandin orandin merged commit 91d131d into orandin:master Mar 11, 2024
3 checks passed
@orandin
Copy link
Owner

orandin commented Mar 11, 2024

@tauu Thank you for your contribution 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants