-
Notifications
You must be signed in to change notification settings - Fork 568
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
Add contextual logging where applicable #124
Conversation
OK please explain how it should work now... |
The idea is to wrap logger objects with an adapter that adds the device id: It's basically what I did in pytuya before, but I've added a convenience class ( Sure, we can compress the id assuming we can do it in such a way it we don't get conflicts. Or we can assume no conflicts and hope for the best... |
I like the idea of having device id in each log, i'm used to do a tail | grep to identify the log. As i use many light bulbs, some of them are physically powered off. When log level is info or debug, they all raise exceptions that mess up the logs and make them complex to read. |
Yeah, all logs about connection errors and such are not very convenient. We need to do something about them (in another PR). In #106 I'm experimenting with only making a connection whenever broadcast messages are received. This removes the need for a re-connect loop, which in turn generate lots of noise when devices are offline. I kinda feel like I want to make that behavior default and using a connect loop (default behavior today) an option. In theory we would only need the broadcast version, but if someone has devices on a different network (broadcast domain), that will not work. So we need to have both. |
@postlund , I just tried to give a spin to this. Config flow does not work, I believe discovery is broken and I am getting this logs: Anyway, it's still not very clear to me what I should test, and also I still believe it would be convenient to compress the deviceIDs for readability, |
Yeah, Basically just look a bit at the outputs and make sure they seem to have decent logging. Also scan the code a bit in case I missed adding contextual logging anywhere. I can compress output like in your first example. Should work OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me, even if I still would prefer the device IDs to be compressed in some way, I find it useless to have such long strings.
And also there are conflicts to be fixed... the good ol' fan.py ;-)
34351b9
to
e88194e
Compare
Ah, lol, I actually did implement device id compression but never pushed it... Should be in place now together with conflict fix. |
e88194e
to
89aae9c
Compare
89aae9c
to
e325b40
Compare
I have tried adding device id to all log points now. Not sure if it's the best way, but it's a try. This PR is however very important as many issues are hard to debug without it.
Fixes #95