agronholm / agronholm/sqlacodegen

Use logging instead of print for informational statements

Đang mở
#451 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Python
Star
2.4k
Fork
284
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
1

Mô tả

### 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.