fix(tracker): rewrite logs to use tracker logger instead of plain console
This commit is contained in:
parent
e2d92b2b69
commit
18ac7c6685
8 changed files with 22 additions and 22 deletions
|
|
@ -535,7 +535,7 @@ export default class Assist {
|
|||
}
|
||||
|
||||
if (!callUI) {
|
||||
callUI = new CallWindow(console.log, this.options.callUITemplate)
|
||||
callUI = new CallWindow(app.debug.error, this.options.callUITemplate)
|
||||
callUI.setVideoToggleCallback(updateVideoFeed)
|
||||
}
|
||||
callUI.showControls(initiateCallEnd)
|
||||
|
|
@ -583,7 +583,6 @@ export default class Assist {
|
|||
sessionStorage.setItem(this.options.session_calling_peer_key, JSON.stringify(callingPeerIds))
|
||||
this.emit('UPDATE_SESSION', { agentIds: callingPeerIds, isCallActive: true, })
|
||||
}).catch(reason => { // in case of Confirm.remove() without user answer (not a error)
|
||||
console.log(reason)
|
||||
app.debug.log(reason)
|
||||
})
|
||||
})
|
||||
|
|
@ -615,6 +614,7 @@ export default class Assist {
|
|||
}
|
||||
})
|
||||
},
|
||||
app.debug.error,
|
||||
)
|
||||
this.canvasMap.set(id, canvasHandler)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export default class CallWindow {
|
|||
|
||||
const doc = iframe.contentDocument
|
||||
if (!doc) {
|
||||
console.error('OpenReplay: CallWindow iframe document is not reachable.')
|
||||
app.debug.error('OpenReplay: CallWindow iframe document is not reachable.')
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ export default class CanvasRecorder {
|
|||
private readonly canvas: HTMLCanvasElement,
|
||||
private readonly canvasId: number,
|
||||
private readonly fps: number,
|
||||
private readonly onStream: (stream: MediaStream) => void
|
||||
private readonly onStream: (stream: MediaStream) => void,
|
||||
private readonly logError: (...args: any[]) => void,
|
||||
) {
|
||||
this.canvas.getContext('2d', { alpha: true, })
|
||||
const stream = this.canvas.captureStream(this.fps)
|
||||
|
|
@ -39,7 +40,7 @@ export default class CanvasRecorder {
|
|||
|
||||
void video.play()
|
||||
video.addEventListener('error', (e) => {
|
||||
console.error('Video error:', e)
|
||||
this.logError('Video error:', e)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ export default class CanvasRecorder {
|
|||
if (this.stream) {
|
||||
this.onStream(this.stream)
|
||||
} else {
|
||||
console.error('no stream for canvas', this.canvasId)
|
||||
this.logError('no stream for canvas', this.canvasId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class CanvasRecorder {
|
|||
const cid = this.app.nodes.getID(node)
|
||||
const canvas = cid ? this.app.nodes.getNode(cid) : undefined
|
||||
if (!canvas || !hasTag(canvas, 'canvas') || canvas !== node) {
|
||||
console.log('Canvas element not in sync')
|
||||
this.app.debug.log('Canvas element not in sync')
|
||||
clearInterval(int)
|
||||
} else {
|
||||
const snapshot = captureSnapshot(canvas, this.options.quality)
|
||||
|
|
@ -58,7 +58,6 @@ class CanvasRecorder {
|
|||
|
||||
sendSnaps(images: { data: string; id: number }[], canvasId: number, createdAt: number) {
|
||||
if (Object.keys(this.snapshots).length === 0) {
|
||||
console.log(this.snapshots)
|
||||
return
|
||||
}
|
||||
const formData = new FormData()
|
||||
|
|
@ -75,16 +74,15 @@ class CanvasRecorder {
|
|||
},
|
||||
body: formData,
|
||||
})
|
||||
.then((r) => {
|
||||
console.log('done', r)
|
||||
.then(() => {
|
||||
return true
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error('error saving canvas', e)
|
||||
this.app.debug.error('error saving canvas', e)
|
||||
})
|
||||
}
|
||||
|
||||
clear() {
|
||||
console.log('cleaning up')
|
||||
this.intervals.forEach((int) => clearInterval(int))
|
||||
this.snapshots = {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,9 +236,10 @@ export default class App {
|
|||
this.stop(false)
|
||||
void this.start({}, true)
|
||||
} else if (data === 'not_init') {
|
||||
console.warn('WebWorker: writer not initialised. Restarting tracker')
|
||||
this.debug.warn('OR WebWorker: writer not initialised. Restarting tracker')
|
||||
} else if (data.type === 'failure') {
|
||||
this.stop(false)
|
||||
this.debug.error('worker_failed', data.reason)
|
||||
this._debug('worker_failed', data.reason)
|
||||
} else if (data.type === 'compress') {
|
||||
const batch = data.batch
|
||||
|
|
@ -246,7 +247,7 @@ export default class App {
|
|||
if (batchSize > this.compressionThreshold) {
|
||||
gzip(data.batch, { mtime: 0 }, (err, result) => {
|
||||
if (err) {
|
||||
console.error('Openreplay compression error:', err)
|
||||
this.debug.error('Openreplay compression error:', err)
|
||||
this.stop(false)
|
||||
if (this.restartAttempts < 3) {
|
||||
this.restartAttempts += 1
|
||||
|
|
@ -595,7 +596,7 @@ export default class App {
|
|||
const sessionToken = this.session.getSessionToken()
|
||||
const isNewSession = needNewSessionID || !sessionToken
|
||||
|
||||
console.log(
|
||||
this.debug.log(
|
||||
'OpenReplay: starting session; need new session id?',
|
||||
needNewSessionID,
|
||||
'session token: ',
|
||||
|
|
@ -682,7 +683,7 @@ export default class App {
|
|||
projectID,
|
||||
})
|
||||
if (!isNewSession && token === sessionToken) {
|
||||
console.log('continuing session on new tab', this.session.getTabId())
|
||||
this.debug.log('continuing session on new tab', this.session.getTabId())
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
this.send(TabChange(this.session.getTabId()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export default class IFrameObserver extends Observer {
|
|||
this.observeRoot(doc, (docID) => {
|
||||
//MBTODO: do not send if empty (send on load? it might be in-place iframe, like our replayer, which does not get loaded)
|
||||
if (docID === undefined) {
|
||||
console.log('OpenReplay: Iframe document not bound')
|
||||
this.app.debug.log('OpenReplay: Iframe document not bound')
|
||||
return
|
||||
}
|
||||
this.app.send(CreateIFrameDocument(hostID, docID))
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default class ShadowRootObserver extends Observer {
|
|||
} // log
|
||||
this.observeRoot(shRoot, (rootID) => {
|
||||
if (rootID === undefined) {
|
||||
console.log('OpenReplay: Shadow Root was not bound')
|
||||
this.app.debug.error('OpenReplay: Shadow Root was not bound')
|
||||
return
|
||||
}
|
||||
this.app.send(CreateIFrameDocument(hostID, rootID))
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ self.onmessage = ({ data }: { data: ToWorkerData }): any => {
|
|||
|
||||
if (data.type === 'compressed') {
|
||||
if (!sender) {
|
||||
console.debug('WebWorker: sender not initialised. Compressed batch.')
|
||||
console.debug('OR WebWorker: sender not initialised. Compressed batch.')
|
||||
initiateRestart()
|
||||
return
|
||||
}
|
||||
|
|
@ -123,7 +123,7 @@ self.onmessage = ({ data }: { data: ToWorkerData }): any => {
|
|||
}
|
||||
if (data.type === 'uncompressed') {
|
||||
if (!sender) {
|
||||
console.debug('WebWorker: sender not initialised. Uncompressed batch.')
|
||||
console.debug('OR WebWorker: sender not initialised. Uncompressed batch.')
|
||||
initiateRestart()
|
||||
return
|
||||
}
|
||||
|
|
@ -163,13 +163,13 @@ self.onmessage = ({ data }: { data: ToWorkerData }): any => {
|
|||
|
||||
if (data.type === 'auth') {
|
||||
if (!sender) {
|
||||
console.debug('WebWorker: sender not initialised. Received auth.')
|
||||
console.debug('OR WebWorker: sender not initialised. Received auth.')
|
||||
initiateRestart()
|
||||
return
|
||||
}
|
||||
|
||||
if (!writer) {
|
||||
console.debug('WebWorker: writer not initialised. Received auth.')
|
||||
console.debug('OR WebWorker: writer not initialised. Received auth.')
|
||||
initiateRestart()
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue