Develop a method to log your messages without using gs.info().
gs.info() / gs.error() adds a new record for each call to table syslog_list
. This can get cluttered, if you are one of many developers using the same method.
I propose an alternate method. We create a new record on table task
and add a new work_note to the task as form of logging.
sys_script_include
, marking Accesible from
to All application scopes
var logToTask = Class.create();
logToTask.prototype = {
initialize: function() {
},
logToTask : function(string,sys_id){
var taskGr = new GlideRecord("task");
if (taskGr.get(sys_id)){
taskGr.work_notes = string;
taskGr.update();
return true;
}
return false;
},
type: 'logToTask'
};
var ltt = new global.logToTask().logToTask;
// ltt ( string to log, sys_id of task record )
ltt("Some things are better with logging.","6f6f85d5c3030210dea6160ed40131eb");