The global logger makes it easier to log messages using GSLog.
// Initialize the logger
var log = new [Prefix]_LOG(name);
// Supported: All log methods
log.debug("debug");
log.info("info");
log.notice("notice");
log.warn("warn");
log.error("error");
// Supported: Multiple arguments
log.info("arg1", "arg2", "arg3", "arg4");
// Supported: All variables are logged as clear strings
log.info(0);
log.info(1.1);
log.info("string");
log.info([1, "23", ["a", "b", "c"]]);
log.info({a: 1,b: 2,c: "abc"});name [string] The name of the script you are working in. This name will be added to the log message.
name [string] The name of the sys_propery you need to create to enable/disable logging at a specific level.
note: You can pass an array and an object to the logger and it will log them correctly.
(an object not like [object Object] and array not like a comma seperated string)
You need to create a true|false sys_property with name log.#{name} and value true to be able to see the debug, info and notice messages.
Debug, info and notice messages will not be logged if the sys_property value is set to false or if the sys_proprty is not defined.
var log = new [Prefix]_LOG("testScriptInclude");The code above would require a sys_property with name log.testScriptInclude to be able to show debug, info and notice messages.
Check the GSLog for more info about log levels