Skip to content

Commit

Permalink
chore: add console proxy script
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Dec 4, 2023
1 parent 51d2db6 commit 3dd62e1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/isolate/scripts/console-proxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* eslint-disable no-global-assign */
/* eslint-disable no-undef */

'use strict'

var logs = {
log: [],
error: [],
warn: [],
info: []
}

console = new Proxy(console, {
get(_obj, prop) {
return (...params) => {
params.forEach((param) => {
if (isObject(param)) {
logs[prop].push(param.toString())
} else {
logs[prop].push(param)
}
})
}
}
})

0 comments on commit 3dd62e1

Please sign in to comment.