Skip to content

Custom logging function #281

@bwp91

Description

@bwp91

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:

  • if the user has debug logging enabled then I could pass the homebridge log function
  • otherwise I could pass either undefined or an empty function () => {}

Happy to discuss this more on discord if preferred!

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions