====== moduleLog() ====== wrtc.moduleLog() logs supplied string to the [[https://developer.mozilla.org/en-US/docs/Web/API/Console/log|console log]] and to wrtc.get("log"). wrtc_kit.js logs excessive amount of information to the console log to ease debugging. Your code may also log its activities into the same log(s) using wrtc.moduleLog(). ===== Arguments ===== wrtc.moduleLog(module, msg) * module - string containing log source * msg - string containing the log message ===== Returns ===== Nothing. ===== Example ===== To log that your web client has started you can add to the beginning of your javascript code: wrtc.moduleLog('my client', 'started'); The wrtc log fetched by [[ixnx:wrtc:js:api:wrtc:get|wrtc.get("log")]] might contain: 10:52:01.647 wrtc: Initializing wrtc 10:52:01.647 wrtc: wrtc_kit.js 2.0.0 10:52:01.647 wrtc: adapter.js 0.15.1 10:52:01.648 my client: started 10:52:01.657 wrtc: client running on chrome 87 (Win32) 10:52:01.657 wrtc: stunserver:foo.com 10:52:01.657 wrtc: TURN server:foo.com 10:52:01.657 wrtc: TURN password:use_rest_credentials 10:52:01.657 wrtc: TURN enabled:true 10:52:01.657 wrtc: created wrtc.i.socket[0] 10:52:01.658 socket0[ ]: Opening web socket foo.com 10:52:01.658 socket0[ ]: Trying basic websocket to wss://foo.com/websocket 10:52:01.676 socket0[ ]: WS candidate nr. 0 opened to websocket:wss://foo.com/websocket 10:52:01.676 socket0[ ]: Channel opened to URL wss://foo.com/websocket 10:52:01.676 socket0[ ]: created wrtc.i.socket[0].line[0] 10:52:01.679 socket0[0]: C->S: {"line":"0","wcw_id":"2146993312","wcw_seq":"1","wcw_client_rand":"1608046243","wcw_version_prot":"3","wcw_version_ver":"2.0.0","wcw_version_app":"client","type":"Iam","name":"someone","CID":"05c7af9e-2301-41f8-92a6-65f2becf9982","template":"0","OID":"wrtc","name_dn":"Someone","client":"client (2.0.0)/chrome 87 (Win32)"} ... Each log entry contains hour:minute:second.millisecond module: log message ===== Log system errors ===== You are strongly recommended to add this line into your javascript code on the main html page: window.onerror = function(e, url, line) {wrtc.moduleLog('SYSTEM', e + ' at ' + url + ':' + line)}; This must be on the //main// html page - it cannot be put into a script include file. It will log many (but unfortunately still not all) system errors appearing in the javascript log into the wrtc log too. ===== Also see ===== [[ixnx:wrtc:js:api:wrtc:get|wrtc.get("log")]] [[ixnx:wrtc:js:api:wrtc:consolelog|wrtc.consoleLog()]]