encode / uvicorn

An ASGI web server, for Python. 🦄
https://www.uvicorn.org/
BSD 3-Clause "New" or "Revised" License
8.57k stars 745 forks source link

Fixed default to use stdout instead of stderr #2246

Closed iksinskiyt closed 9 months ago

iksinskiyt commented 9 months ago

Summary

Hey, I wanted to change that for the longest time. It makes literally no sense to print every single line of output as stderr instead of stdout, and I belive that this change will improve every single programmer's mental health as well as the visibility inside of terminal. :> For example in pyCharm stderr is defaultly rendered as red, so it actually conflicts with the config that has errors and critical errors in red*. Thanks for your time! ❤

Checklist

zanieb commented 9 months ago

I believe it is proper behavior for log information from a program to go to standard error by default — this is basically the purpose of standard error. I understand that this may be frustrating in e.g. PyCharm where it's rendered differently but perhaps you should consider reconfiguring the logger in your application or redirecting the stream if that's the concern?

Just my 2-cents, thank you for taking the time to contribute to the project!

iksinskiyt commented 9 months ago

I believe it is proper behavior for log information from a program to go to standard error by default — this is basically the purpose of standard error. I understand that this may be frustrating in e.g. PyCharm where it's rendered differently but perhaps you should consider reconfiguring the logger in your application or redirecting the stream if that's the concern?

Just my 2-cents, thank you for taking the time to contribute to the project!

I understand your approach, I want y'all to know that this commit came out spontaneously as me and my team were working on a project. Back to the topic I belive that using stderr for debug info is not necessary as uvicorn does not have a debug/console layer and a application layer - so it doesn't benefit from the natural separation of those output streams(I might be totally wrong here). Researching this issue further I've found out that it's rather hard to change your terminal's behaviour and prople have been struggling with similar issues. What I'm trying to say is - there is no easy solution, since everydevelopment environment is different, there might be IDEs that doesn't allow the user to temper with how stdout and stderr are handled and doesn't allow replacing it's built in terminal with thr system one (Yes I'm yapping at pyCharm). To sum up things - it was more of a meme commit than anything, but I'm grateful that I could ahare my concerns regarding this topic. For anyone reading this - have a great day 🥰

Kludex commented 9 months ago

Please create a discussion with resources to prove your point.