Logging information from scripts

Have you ever worked on a tagging (or file naming) script in Picard and wished that you could log information at various stages of the script to help with debugging? I have, and I finally got frustrated enough to create a plugin for that… Script Logger

I’ve submitted it for consideration to include in the list of official Picard plugins but the latest version is also available for download from my repo on GitHub.

If you decide to try it out and find any bugs or have suggestions for improvement, please let me know.


Script Logger

This plugin provides a new script function $logline() to write entries to Picard’s system log. By default, the log level is set at Info, but any level can be used by providing the level as an optional second parameter to the function. The function is available to both user scripts and file naming scripts.

Usage

The function is used as $logline(text[,level]), where text is the text to write to the log. The entry will be written at log level Info by default, but this can be changed by specifying a different level as an optional second parameter. Allowable log levels are:

  • E (Error)
  • W (Warning)
  • I (Info)
  • D (Debug)

If an unknown level is entered, the function will use the default Info level.

Examples

$logline(This is a text message.) will add “This is a test message.” to the log at the Info level.

$logline(This is another text message.,) will add “This is another test message.” to the log at the Info level.

$logline(This is an error message.,E) will add “This is an error message.” to the log at the Error level.

$logline(This is another error message.,Error) will add “This is another error message.” to the log at the Error level.

7 Likes