Skip to content

Logging

bryce edited this page Oct 10, 2024 · 3 revisions

Log Locations

Companion has a few different locations for viewing logs:

  • Admin GUI
    • Available in the web GUI, under the "Log" Panel
  • Log Files
    • The file location varies based on the operating system, but can be located by clicking the Companion shortcut or menubar icon > "Show config folder" and then navigating to the log folder
  • Module Log
    • Accessible for each module on the "Connections" panel > 3 dot menu > View logs view-logs

Writing Log Messages

You can write messages to the Companion log by calling this.log('info', 'Your message'), where the first parameter is the level associated with the log, and the second parameter is the log message.

It is required that the message is a string. If the message is not a string it will be converted to one, which can result in an unhelpful output if it contains an object or other non-string value.

Log Levels

There are multiple log levels that can be passed:

Level Use Case Visibility
'error' Fatal or blocking errors that impact the functionality or stability of the module Admin GUI, Log File, Module Log
'warning' Minor issues or a misconfiguration that does not impact the overall functionality of the module Admin GUI, Log File, Module Log
'info' General information that could be helpful, such as emitting the software version of the connected device upon connection Admin GUI, Log File, Module Log
'debug' Provide extra information to aid in debugging Module Log

Development Logging

You can also use console.log and similar functions. These are currently treated as an extra 'verbose' method. They are available in the Module Log, similar to debug messages. You should try to avoid using these outside of a development environment.

Clone this wiki locally