Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save imtrinity94/d99206e3670434fea0502d5a256b4421 to your computer and use it in GitHub Desktop.
Save imtrinity94/d99206e3670434fea0502d5a256b4421 to your computer and use it in GitHub Desktop.
vRO action that logs the content of a Properties object
System.log("==== Begin: vRA Event Broker Payload Properties ====");
logAllProperties(payload,0);
System.log("==== End: vRA Event Broker Payload Properties ====");
function logAllProperties(props,indent) {
var keys = (props.keys).sort();
for each (var key in keys) {
var prop = props.get(key);
var type = System.getObjectType(prop);
if (type == "Properties") {
logSingleProperty(key,prop,indent);
logAllProperties(prop,indent+1);
}
else {
logSingleProperty(key,prop,indent);
}
}
}
function logSingleProperty(name,value,i) {
var prefix = "";
if (i > 0) {
var prefix = Array(i+1).join("-") + " ";
}
System.log(prefix + name + " :: " + System.getObjectType(value) + " :: " + value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment