mrbungle64 / ecovacs-deebot.js

A Node.js library for running Ecovacs Deebot and yeedi vacuum cleaner robots
GNU General Public License v3.0
118 stars 37 forks source link

Custom logging function #281

Open bwp91 opened 1 year ago

bwp91 commented 1 year ago

The feature request

My usage of this app is with my homebridge plugin homebridge-deebot.

It is standard practice with homebridge plugins to use the homebridge logging function to prefix entries with a timestamp and the plugin instance name. For example:

Screenshot 2023-01-07 at 04 29 24

If any dependency uses console.log then the entry is added to the homebridge log but without the timestamp and plugin name - which can sometimes confuse users as to which plugin is causing the entries - normally only an issue when something is going wrong.

My ideal scenario would be the ability to pass a logging function to this repo in the EcovacsAPI class, for example

constructor(deviceId, country, continent = '', authDomain = '', logFunc = undefined) {

so I can pass the homebridge logger function to the class and it be used in replacement of your repo's default logging function.

My use case would really be:

Happy to discuss this more on discord if preferred!

Thanks!

mrbungle64 commented 1 year ago

Hi @bwp91

can you please give me an example of what debug information of the library currently appears in the log of your plugin when started in debug mode 🙂 Or are you planing to run the plugin in the development environment (NODE_ENV=dev)?

(I already started a conversation on Discord yesterday. We can continue there if you like)