Demonstrates how to write information to the application log
Sometimes it is useful for a plugin to be able to log messages and errors to the application log (which appears in the tools window as well as the support log file).
Native plugins are given the log function when they are initialised, if they export a VRPRegisterLogProc called VRPRegisterLog. This function receives a VRPLogProc which should be stored for the lifetime of the plugin.
Native plugins using the vrtree-linker library and its VRPLUGIN_API_STDIMPL macro may check the validity of s_logFunc, which has automatically been connected to the log function provided to the registration function.
Lua plugins do not need to perform any registration and may call print to write to the application log.
With the exception of Lua plugins (which are limited to print), plugins may log messages of varying severity.
VRPLogProc takes two parameters, a type and a message. All log messages are written to the log file regardless of their type. Only some types are displayed in the application itself.
The type corresponds to the following
The lowest priority log message, for informational purposes. Does not appear in the in-app log display unless the Verbose Log setting is enabled.
A warning to the user that an operation had issues but they may continue their work. Always appears in the in-app log display.
An error message indicating a serious problem. Always appears in the in-app log display.
Debug messages, usually for developers, containing advanced diagnostic information. Does not appear in the in-app log display unless the Verbose Log setting is enabled.
PLUGIN_ENTRY_POINT int VRTREE_APIENTRY VRPInit()
s_logFunc(LOG_INFO, "Initialising My Plugin");
local function init()
print("Initialising " .. name())
Implement an Observer
Present a Modal Dialog