8000 sqlx/sqlc enable logging · Issue #4671 · zeromicro/go-zero · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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

sqlx/sqlc enable logging #4671

Open
MYHZ79 opened this issue Feb 27, 2025 · 3 comments
Open

sqlx/sqlc enable logging #4671

MYHZ79 opened this issue Feb 27, 2025 · 3 comments

Comments

@MYHZ79
Copy link
MYHZ79 commented Feb 27, 2025

i think there should be a method called sqlx.EnableLog() so that after disabling sql logs in a scenario, developer can enable logs again.

i can send a PR if you prefer.

@kevwan
Copy link
Contributor
kevwan commented Feb 27, 2025

In what kind of scenarios, we need re-enable the sql logs if you already disabled it?

@MYHZ79
Copy link
Author
MYHZ79 commented Feb 28, 2025

Personally when I want to load my app configuration or service context, I execute some queries which makes a mess in stdout each time I want to debug and I want to remove it :). also want to have sql statement logs after app initialization.

Although this is not the solution (because of concurrency issues), but I think considering a way to manage logs for specific db model queries would be useful too.

@kevwan
Copy link
Contributor
kevwan commented Mar 1, 2025

In your develop environment, you disable it, and not necessary to re-enable it.

In your production environment, you just enable or disable it without further changes during running.

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

No branches or pull requests

2 participants
0