Global JavaScript scope

This document describes functions in the global scope available in the JavaScript environment for app serivices.

Table of content

Global functions log
hexdump

Global functions

log
log(expression)

Evaluates the given expression and prints the result to the log file of the app instance using the flag LOG_APP. The function works similar to the console.log function in browsers.

Example:

log("hello world");
log("3 + 5 = " + (3 + 5));
log("message: " + JSON.stringify({ mt: "SomeMessage", value: 5 }));
Example log file:
07-29 17:05:08.982 generic@test.com JS: hello world
07-29 17:05:08.993 generic@test.com JS: 3 + 5 = 8
07-29 17:05:09.130 generic@test.com JS: message: {"mt":"SomeMessage","value":5}

hexdump
hexdump(data)

Prints a hexdump of the given data to the log file of the app instance using the flag LOG_APP. Note that data can be a string or a Uint8Array.

Example:

hexdump("hello");
hexdump(new Uint8Array([0xff, 0xfe, 0xfd]));
Example log file:
07-29 17:05:08.993 generic@test.com JS:  020c816c: 68 65 6c 6c 6f                                     hello
07-29 17:05:09.130 generic@test.com JS:  020755b8: ff fe fd                                           ...