Skip to content
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

Custom logging function #281

Open
bwp91 opened this issue Jan 7, 2023 · 1 comment
Open

Custom logging function #281

bwp91 opened this issue Jan 7, 2023 · 1 comment
Labels
Enhancement New feature or request Verification

Comments

@bwp91
Copy link

bwp91 commented Jan 7, 2023

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!

@bwp91 bwp91 added Enhancement New feature or request Verification labels Jan 7, 2023
@mrbungle64
Copy link
Owner

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Verification
Projects
None yet
Development

No branches or pull requests

2 participants