-
Notifications
You must be signed in to change notification settings - Fork 5
5.6 Live log console
Starting from v2.0.0, Koala is based on Sam Windell's fork of SublimeKSP. This new version of SublimeKSP includes a lot of extremely useful commands. Koala uses a lot of these, but the most important one is the logging system.
Let's take a look at the Template Script that comes with Koala.
SET_CONDITION(ENABLE_DEBUG)
import "Koala/Koala.ksp"
on init
activate_logger("/path_to_log_file/log.nka")
Koala.init
create_instrument(540, "", "", "Koala v2.0 - TEMPLATE SCRIPT")
end on
The activate_logger
function creates an NKA file at the specified path. This NKA file will be compiled with the most important events which are occurring in the instrument. Every available callback has its own DEBUG.
function to help you monitor this.
Every single DEBUG.
function related to callbacks includes the code to add the data to the logging console.
The log you see on Koala's console contains exactly the same data written on the NKA file.
Each line of the logger has a few common data:
hh:mm:ss:ms --- [CALLBACK] Logger text and data
The timer is based on Koala's function timer()
. CALLBACK
is replaced with the name of the callback which triggered the logger.
These buttons allow the Developer to filter out the unneeded debugging lines from all the callbacks.
For instance, if you don't want the log to display data from on controller
callback - which can pollute the logger in some cases - you can turn off its button.
The button USER allows to show/hide log messages generated by user using DEBUG.add_log
function.
This button allows you to start the logging system. Keep in mind that Kontakt might slow down a bit when dealing with lots of text lines, so if you are not using the logger please turn it off. By default, the logger is off.
The Clear
button displays an X
. When clicked, the console log is cleared.
The Minimize/Maximize
button displays either ^
(the console is minimized, so maximize it) or _
(the console is maximized, so minimize it). When maximized, all the UI controls are temporarily hidden in order to make room for the console window.
If the standard logging system is not enough, the Developer can add its custom lines by using the function DEBUG.add_log
.
This function can be added anywhere in the script.
The format of the log line will remain the same as declared before.
DEBUG.add_log(<text>)
-
text
Text to be displayed on the logger.