Added source to log messages
Change-Id: Iacc15ff3514373814ad4f4b3de206d6a83d5338d
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index 0e9944d..54dc713 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -52,7 +52,11 @@
// Override KorAP.log
window.alertify = alertifyClass;
- KorAP.log = function (code, msg) {
+ KorAP.log = function (code, msg, src) {
+
+ if (src) {
+ msg += '<code class="src">'+src+'</code>';
+ };
// Use alertify to log errors
alertifyClass.log(
diff --git a/dev/js/src/plugin/server.js b/dev/js/src/plugin/server.js
index 9401de6..7dd0fce 100644
--- a/dev/js/src/plugin/server.js
+++ b/dev/js/src/plugin/server.js
@@ -116,7 +116,7 @@
if (limits[id]-- < 0) {
// Kill widget
- KorAP.log(0, 'Suspicious action from ' + widget.src);
+ KorAP.log(0, 'Suspicious action by widget', widget.src);
widget.shutdown();
delete limits[id];
delete widgets[id];
@@ -130,7 +130,7 @@
// Log message from iframe
else if (d.action === 'log') {
- KorAP.log(d.code, d.msg);
+ KorAP.log(d.code, d.msg, widget.src);
};
// TODO:
diff --git a/dev/js/src/util.js b/dev/js/src/util.js
index 80f6364..cb60c2a 100644
--- a/dev/js/src/util.js
+++ b/dev/js/src/util.js
@@ -99,7 +99,8 @@
// Default log message
- KorAP.log = KorAP.log || function (type, msg) {
+ KorAP.log = KorAP.log || function (type, msg, src) {
+ if (src) msg += ' from ' + src;
console.log(type + ": " + msg);
};