diff --git a/lib/python/spontini_server_core.py b/lib/python/spontini_server_core.py index 49a7a4a..5e16e98 100644 --- a/lib/python/spontini_server_core.py +++ b/lib/python/spontini_server_core.py @@ -834,6 +834,14 @@ def doPostSync(message, request): log(clientInfo + traceback.format_exc(), "E") return sendCompleteResponse("KO", traceback.format_exc().encode("utf8")) + if message['cmd'] == 'LOG': + if not checkMsgStructure(message, 2): + return sendMalformedMsgResponse() + text = message['param1'] + level = message['param2'] + log(clientInfo + text, level) + return sendCompleteResponse("OK", "") + if message['cmd'] == 'EXEC_PLUGIN': if not checkMsgStructure(message, 5): return sendMalformedMsgResponse() diff --git a/lib/webgui/js/midi-functions.js b/lib/webgui/js/midi-functions.js index 8da7d76..0952bd6 100644 --- a/lib/webgui/js/midi-functions.js +++ b/lib/webgui/js/midi-functions.js @@ -226,7 +226,11 @@ function turnOnMidiInputAndListenOnChannel(channel) { WebMidi .enable() .then(onEnabled) - .catch(err => alert(err)); + .catch(err => { + console.error(err) + sendMsgToSpontiniServer({ cmd: 'LOG', param1: "[MIDI input] " + + err.toString(), param2: 'E' }, function(statusTxt, responseTxt) {}) + }); // Function triggered when WebMidi.js is ready function onEnabled() {