Closed ebaauw closed 4 years ago
I like the way homebridge-pihole implements this with a custom setting. Not sure how it works from a technical perspective, but might be worth checking into.
The simplest would be to have a "debuglevel" : "none" | "error" | "warn" | "info" | "debug"
in the config.json for the plugin.
Sorry @jojost1 , @mshulman a config.json setting is not what I meant by "dynamic". I want users to be able to change the log level without having to restart Homebridge.
There's no way in hell that I will support disabling error and warning messages.
I wasn’t advocating removing error and warning messages.
The levels are additive. Error is only error. Warning is error + error. Info is info + warning + error.
-ms
On May 5, 2020, at 3:23 AM, Erik Baauw notifications@github.com wrote:
Sorry @jojost1https://github.com/jojost1 , @mshulmanhttps://github.com/mshulman a config.json setting is not what I meant by "dynamic". I want users to be able to change the log level without having to restart Homebridge.
There's no way in hell that I will support disabling error and warning messages.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ebaauw/homebridge-lib/issues/26#issuecomment-623973662, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AALKNBH5ZH3XK6HXAJHR26DRP7SJFANCNFSM4MY3SVOA.
A different way to do this would be to have a side file with whatever debug configuration you need/want. In your plugin you would install a listener for a signal. When it receives that signal it loads the side file which then setup up whatever logging you need. So the user would need to create the side file in a standard location. Find the PID of the Homebridge and then use the LINUX 'kill' command to send a signal to that PID. I am not sure how this would be done with containers - but I assume you can 'ssh' into a container.
Personally I really wouldn't mind restarting homebridge to change log level, most plugins I have installed require a restart when changing it.
I don't mind at all having to restart homebridge to change the logging. That would be pretty straightforward to do.
I like mshulman's option as that is pretty normal.
Another option would be to be able to specify where the log goes and then savvy users could set it to /dev/null for normal operations and point it back to a regular file for troubleshooting.
The setting of logLevel through Identify isn't working out. On pairing, Eve (and I suppose Home) issue Identify multiple times for accessories with Lightbulb services (to select scenes, or whatever).
So I will be exposing Log Level characteristics and remove setting it through Identify.
I also find that setting per accessory is too fine grained from a usage perspective. In Homebridge RPi, I will create a single setting per Pi (for the Pi accessory and all linked GPIO accessories); for Homebridge WS, I will create a setting per Location (for the Location and the Forecasts accessory).
The identify-method works for me with only 1 Pi, but I agree a characteristic would be nicer. Thanks and good job!
It's easier to manage as a characteristic, using the Types window in Eve (from my dev environment):
I've seen multiple requests on almost all my plugins for a possibility to reduce the amount of logging. I'm not sure how best to implement this, and would appreciate your thoughts on this.
My dilemma:
homebridge -D
) or different environment variables (DEBUG=* homebridge
). This has proven to be impractical, if not impossible, for people running Homebridge as a service or in a container;As indicated above, please provide your thoughts, commenting to this issue.