Closed simonhac closed 7 years ago
@anthonywebb i'm a little stuck here -- looking for advice.
homebridge
uses its own internal logging class -- homebridge/lib/logger.js.
homebridge
is built on top of hap-nodejs
which uses the very popular and more sophisticated debug module.
which is why we see HAP messages in the one format and homebridge-* messages in another.
i prefer the debug
module -- supports quick enable/disable from environment variables and has (i think) prettier output. i think it would have been much nicer if homebridge
used debug
, but i'm not going to try to turn that ship around, yet.
i'd like to have different log streams:
cgate-client
and cgate-database
major events -- (re)opening sockets, loading database, etc.it'd be pain to hack homebridge's logger to enable multiple streams.
what do you think if i use debug
for the first three streams above?
i'm happy to leave accessory and platform logging as they were -- using logger.js
-- for consistency with other homebridge plugins if we think that's useful/good manners. (but just as happy to move homebridge-cbus
fully across to debug
so we have only one way of configuring the loggers...)
keen to hear your opinion...
I'm perfectly find for enhanced logging, it should be noted in the readme though with how it works so that it isnt a mystery that only the owner can decipher. How do you intend to identify the various log streams? Color I assume?
addressed in PR #20.
added to README.md
:
homebridge-cbus
has four logging channels:
cbus:platform
: highest level startup/shutdown and fatal error reporting (enabled by default)cbus:level
: all level change events reported by C-Gatecbus:client
: all communication with C-Gatecbus:db
: significant events reported by the database syncing moduleOn startup, the status of the channels will be determined from the environment variable DEBUG. eg.:
# all C-Bus logging
> DEBUG=cbus:* homebridge
# just level change events
> DEBUG=cbus:level homebridge
# very verbose logging from all of homebridge
> DEBUG=* homebridge
N.B. If provided, the client_debug
setting (from config.json
) will override the configuration for cbus:client
from the environment.
addressed with PR #20.
i carelessly removed the debugging switch when i was working on #16.
i'd like to keep the option of richer logging but allow users a level of control over the verbosity.
for unit tests i've started to use the debug library (32.5M downloads over last month), but looks like
homebridge
uses its own internal debug library. should we stick with that?