Luligu / matterbridge

Matterbridge plugin manager for Matter
https://github.com/Luligu/matterbridge/blob/main/README.md
Apache License 2.0
125 stars 13 forks source link

Set log level of AnsiLogger to "INFO" when "-debug" is not set #50

Closed t0bst4r closed 1 month ago

t0bst4r commented 1 month ago

At the moment the "-debug" flag seems to have the following effects:

Anyway every log written to this.log.debug gets printed, even when -debug is not set.

It would be nice if:

  1. the absence of the debug flag configures ansi logger to NOT print debug logs
  2. OR EVEN BETTER a general -log [debug|info|warn|error] option could be added which configures BOTH loggers properly

Thank you!

Luligu commented 1 month ago

Hi, could you please post to the discussion I created for your project so we have all the stuff in the same place?

1) Anyway every log written to this.log.debug gets printed, even when -debug is not set. Can you show me with a screenshot what do you mean? Cause is not clear for me where you see a debug printed when -debug is not enabled.

2) In the first link provided you are inside startExtension: that is an undocumented and no more maintained method that I left there in case I decide to continue that project (z2m extension). It is not supposed to be used. If you use it in your code please tell me that I have to verify that the code there is still up to date with Matterbridge.

3) OR EVEN BETTER a general -log [debug|info|warn|error] option could be added which configures BOTH loggers properly Is a good idea I will do it. Actually that is already managed that way in the frontend but the command line has been left behind...

image
t0bst4r commented 1 month ago

I thought, if its really a bug, it's rather an issue than a discussion - if not, feel free to close the issue, and i'll post it to the discussion again.


I think I found the one, printing debug logs, which i was re-using by extending the MatterbridgeDevice and using this.log:

https://github.com/Luligu/matterbridge/blob/main/src/matterbridgeDevice.ts#L203

Luligu commented 1 month ago

Hi, yes indeed, it's a bug. I was refactoring the console.log to AnsiLogger and it remained there unfinished. In the dev was correct so I didn't notice. Thanks.

I also added the parameter -matterlogger [debug | info | notice | warn | error | fatal] to set the matter.js Logger separately from the Matterbridge log. If you set fatal you turn off all matter.js messages. Thanks.

Tell me about the startExtension... if I need to check it please. For now I just deprecated it.

I will publish before evening:

Also this is done: https://github.com/Luligu/matterbridge/issues/51

[1.3.0] - 2024-06-16

This release is all about Matter 1.3

If you are wondering whether the controllers already support Matter 1.3, the answer is unfortunately no.

Only Home Automation supports:

and (probably only like BooleanState cluster)

Changed

Added

Buy me a coffee