agronholm / agronholm/sqlacodegen

Use logging instead of print for informational statements

未關閉
#451 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
Python
星號
2.4k
分支
284
平均合併
2 天 1 小時
30 天內合併 PR
1

描述

### Things to check first

- [x] I have searched the existing issues and didn't find my feature already requested there

### Feature description

https://github.com/agronholm/sqlacodegen/blob/615d79c6f6fdcb776c891179eb46516b1e8fd6f5/src/sqlacodegen/cli.py#L143 defaults to using stdout but the print statements above corrupt the stdout file by printing a bunch of logging statements

https://github.com/agronholm/sqlacodegen/blob/615d79c6f6fdcb776c891179eb46516b1e8fd6f5/src/sqlacodegen/cli.py#L94-L129

Instead, there should be a way to configure Logging to redirect the `print` statements to somewhere else (or suppress them altogether!)

### Use case

1. `sqlacodegen` command which redirects stdout to a generated file (ex: from a docker exec command)
2. Do anything which causes one of the `print` statements to fire, like use pgvector.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。