Merge "Added source to log messages"
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);
};
diff --git a/dev/scss/main/alertify.scss b/dev/scss/main/alertify.scss
index df1225c..55f6c59 100644
--- a/dev/scss/main/alertify.scss
+++ b/dev/scss/main/alertify.scss
@@ -10,4 +10,13 @@
article.alertify-log-warn {
background-color: $dark-orange;
+ code.src {
+ color: $darkest-orange;
+ }
}
+
+article.alertify-log code.src {
+ display: block;
+ color: $dark-red;
+ font-size: 70%;
+}
\ No newline at end of file