First setup of logging implemented.

#FA-8 #FA-10
This commit is contained in:
admin
2023-01-14 09:38:17 -08:00
parent 899dce3143
commit be5c79f086
27 changed files with 1265 additions and 2 deletions

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_script_include">
<sys_script_include action="INSERT_OR_UPDATE">
<access>package_private</access>
<active>true</active>
<api_name>x_355681_fa.LogUtils</api_name>
<caller_access/>
<client_callable>false</client_callable>
<description/>
<name>LogUtils</name>
<script><![CDATA[var LogUtils = Class.create();
LogUtils.prototype = {
initialize: function() {
},
get logSource(){
if(_source){
return {
table: _source.getTableName(),
sys_id: _source.getValue('sys_id'),
gr: _source
};
}else{
return false;
}
},
write: function(message, options){
var {
type = "info",
timestamp = new Date(),
funcName = "Unknown",
currentRecord = current
} = options;
if(message){
var logGr = new GlideRecord('x_355681_fa_log');
logGr.initialize();
logGr.setValue("type", type);
logGr.setValue("timestamp", timestamp.toISOString());
logGr.setValue("message", message);
logGr.setValue("function_name", funcName);
if(currentRecord)
logGr.setValue("impacted_record", currentRecord.sys_id);
if(this.logSource){
logGr.setValue("source_table", this.logSource.table);
logGr.setValue("source_record", this.logSource.sys_id);
}
logGr.insert();
}
},
type: 'LogUtils'
};]]></script>
<sys_class_name>sys_script_include</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2023-01-13 22:05:52</sys_created_on>
<sys_id>0d925a7a975821105838bfb3f153afb0</sys_id>
<sys_name>LogUtils</sys_name>
<sys_package display_value="Fulfilment Automater" source="x_355681_fa">c04afa629713111093a8337e6253af6d</sys_package>
<sys_policy>read</sys_policy>
<sys_scope display_value="Fulfilment Automater">c04afa629713111093a8337e6253af6d</sys_scope>
<sys_update_name>sys_script_include_0d925a7a975821105838bfb3f153afb0</sys_update_name>
</sys_script_include>
</record_update>