Skip to content

Instantly share code, notes, and snippets.

@Pum-purum
Created January 16, 2019 07:34
Show Gist options
  • Save Pum-purum/e748af8e88682f392a001671ecfc7535 to your computer and use it in GitHub Desktop.
Save Pum-purum/e748af8e88682f392a001671ecfc7535 to your computer and use it in GitHub Desktop.
Bitrix JS logging
var originalBxOnCustomEvent = BX.onCustomEvent;
BX.onCustomEvent = function (eventObject, eventName, eventParams, secureParams) {
var logData = {
eventObject: eventObject,
eventName: eventName,
eventParams: eventParams,
secureParams: secureParams
};
if (eventObject !== null && typeof eventObject == 'object' && eventObject.constructor) {
logData['eventObjectClassName'] = eventObject.constructor.name;
}
console.log(logData);
originalBxOnCustomEvent.apply(null, [eventObject, eventName, eventParams, secureParams]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment