sysid / sse-starlette

BSD 3-Clause "New" or "Revised" License
505 stars 36 forks source link

Feature request: Option to disable logging / stop using uvicorn logger #19

Closed havardthom closed 2 years ago

havardthom commented 2 years ago

Hi! First of all, thanks for this library, it is working great.

I would like an option to disable the debug logging from this library because it is spamming our dev environment with ping logs :) Since you are using Uvicorn logger my current options are disabling all logs from Uvicorn which I don't want to do, or monkeypatching your methods to remove logging, which is unnecessary code.

Would be great with a parameter to disable logging or you can use your own logger (instead of uvicorn) so I can disable log propagation.

sysid commented 2 years ago

Hello havardthom, thanks for your suggestion.

Do you know, that you can set the ping interval duration? Maybe this is already good enough for your use-case.

havardthom commented 2 years ago

Yes I am aware, I'm afraid it is not good enough. We have long living SSE connections from multiple clients/users and the debug logging in this library has not proven useful for us, it has unfortunately just acted as noise on our logging server.

sysid commented 2 years ago

Ok understand. I will look into it after the summer break. Will be off for about 2 weeks. Pull requests also welcome, of course.

UrbanSwati commented 2 years ago

From what I can see the root logger wasn't used in the module, therefore, try to disable it, its mainly one line code logging.getLogger(*name_of_the_logger*).disabled = True reference: https://kmasif.com/2019-11-12-ignore-logging-from-imported-module/ hope that helps