mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: Don't add HTMLElements to openvidu-browser logs
parent
eb3c28d0be
commit
43339f7df8
|
@ -28,14 +28,13 @@ export class OpenViduLogger {
|
||||||
private constructor() {}
|
private constructor() {}
|
||||||
|
|
||||||
static configureJSNLog(openVidu: OpenVidu, token: string) {
|
static configureJSNLog(openVidu: OpenVidu, token: string) {
|
||||||
|
try {
|
||||||
// If instance is created and it is OpenVidu Pro
|
// If instance is created and it is OpenVidu Pro
|
||||||
if (this.instance && openVidu.webrtcStatsInterval > -1
|
if (this.instance && openVidu.webrtcStatsInterval > -1
|
||||||
// If logs are enabled
|
// If logs are enabled
|
||||||
&& openVidu.sendBrowserLogs === OpenViduLoggerConfiguration.debug
|
&& openVidu.sendBrowserLogs === OpenViduLoggerConfiguration.debug
|
||||||
// Only reconfigure it if session or finalUserId has changed
|
// Only reconfigure it if session or finalUserId has changed
|
||||||
&& this.instance.canConfigureJSNLog(openVidu, this.instance)) {
|
&& this.instance.canConfigureJSNLog(openVidu, this.instance)) {
|
||||||
|
|
||||||
try {
|
|
||||||
// isJSNLogSetup will not be true until completed setup
|
// isJSNLogSetup will not be true until completed setup
|
||||||
this.instance.isJSNLogSetup = false;
|
this.instance.isJSNLogSetup = false;
|
||||||
this.instance.info("Configuring JSNLogs.");
|
this.instance.info("Configuring JSNLogs.");
|
||||||
|
@ -79,7 +78,7 @@ export class OpenViduLogger {
|
||||||
const seen = new WeakSet();
|
const seen = new WeakSet();
|
||||||
return (key, value) => {
|
return (key, value) => {
|
||||||
if (typeof value === "object" && value != null) {
|
if (typeof value === "object" && value != null) {
|
||||||
if (seen.has(value)) {
|
if (seen.has(value) || value instanceof HTMLElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
seen.add(value);
|
seen.add(value);
|
||||||
|
@ -109,6 +108,7 @@ export class OpenViduLogger {
|
||||||
this.instance.loggingSessionId = sessionId;
|
this.instance.loggingSessionId = sessionId;
|
||||||
this.instance.loggingFinalUserId = finalUserId;
|
this.instance.loggingFinalUserId = finalUserId;
|
||||||
this.instance.info("JSNLog configured.");
|
this.instance.info("JSNLog configured.");
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Error configuring JSNLog: ");
|
console.error("Error configuring JSNLog: ");
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
@ -118,7 +118,6 @@ export class OpenViduLogger {
|
||||||
this.instance.currentAppender = undefined;
|
this.instance.currentAppender = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static getInstance(): OpenViduLogger {
|
static getInstance(): OpenViduLogger {
|
||||||
if(!OpenViduLogger.instance){
|
if(!OpenViduLogger.instance){
|
||||||
|
|
Loading…
Reference in New Issue