bitfocus / companion

Bitfocus Companion enables the reasonably priced Elgato Stream Deck and other controllers to be a professional shotbox surface for an increasing amount of different presentation switchers, video playback software and broadcast equipment.
http://bitfocus.io/companion
Other
1.56k stars 499 forks source link

Writing custom messages to the Companion log #2420

Open LeonardChrist opened 1 year ago

LeonardChrist commented 1 year ago

Is this a feature relevant to companion itself, and not a module?

Is there an existing issue for this?

Describe the feature

When programming a complicated setup, especially with triggers coming from outside (like HTTP requests or TCP commands), I'd like to have the ability to write custom log messages to the Companion log. I see a lot of technical things are logged, f.ex. I see a HTTP request being logged, but not what bank is requested. It would be awesome to have the ability to write custom messages under a fourth category in the log called 'User'. Here I can log events happening and values of variables at the time of those triggers.

Usecases

We have some house automation tech in our office built upon vvvv. We have a lot of issues with random events being triggered here and the programming being quite complicated. I thought about redoing this whole setup with a RPi and Companion to make it a lot simpler and easier for other people in the office to maintain.

istnv commented 1 year ago

The incoming HTTP log is too generic and not very helpful. At a minimum, the page and bank numbers should be logged. Otherwise you are guessing which of the 3198 buttons is pressed.

travmason commented 1 year ago

If someone can point me in the direction of the logging code I'll see what I can do (as it's an issue with some things I'm trying to debug at the moment)

Julusian commented 1 year ago

@travmason This would need a new internal action to be added. In 3.0 that can be done around https://github.com/bitfocus/companion/blob/beta/lib/Internal/System.js#L108-L179 To log something, it should be possible to call this.logger.info('Your message here')

ploveman commented 4 months ago

@Julusian I had pondered a desire to write to the log from an action. For making it an internal button action, it seemed to make sense to maybe add to the Controls.js where other internal buttons are (or seem to be from my read of the code). Is that an appropriate place to add? My thought was maybe to take a logging level and a text input (with variables). I know this is an older request, so not sure if others would find this helpful or not.