fix: fix console plugin's OOM problem (#656)
* fix: fix console plugin's OOM problem * fix: fix console plugin * feat: patch * feat: patch * feat: patch Co-authored-by: chenyangbj01 <chenyangbj01@fenbi.com>
This commit is contained in:
@@ -37,6 +37,7 @@ rrweb.record({
|
||||
stringifyOptions: {
|
||||
stringLengthLimit: 1000,
|
||||
numOfKeysLimit: 100,
|
||||
depthOfLimit: 1
|
||||
},
|
||||
logger: window.console,
|
||||
})],
|
||||
@@ -44,12 +45,12 @@ rrweb.record({
|
||||
```
|
||||
|
||||
如下是配置选项的详细说明:
|
||||
| key | 默认值 | 功能 |
|
||||
| ---------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| level | ['log','warn','error',...] | 默认值包含了 console 的全部函数,你也可以传入想要录制的 console 函数。 |
|
||||
| lengthThreshold | 1000 | 录制 console 输出信息的最大条数。 |
|
||||
| stringifyOptions | { stringLengthLimit: undefined, numOfKeysLimit: 50 } | 如果 console 输出包含了 js 对象,我们需要对其进行序列化,`stringLengthLimit` 限制了单个值能转化的最大字符串长度,`numOfKeysLimit` 限制了一个被序列化的 js 对象能够包含的最大数量 key,如果对象的 key 数量超过了这个限制,我们将只保留对象的名字。你能通过这些选项来减小生成的 events 的体积。 |
|
||||
| logger | window.console | 要录制的 console 对象,你也可以传入一个想要录制的其他 js 执行环境的 console 对象。 |
|
||||
| key | 默认值 | 功能 |
|
||||
| ---------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| level | ['log','warn','error',...] | 默认值包含了 console 的全部函数,你也可以传入想要录制的 console 函数。 |
|
||||
| lengthThreshold | 1000 | 录制 console 输出信息的最大条数。 |
|
||||
| stringifyOptions | { stringLengthLimit: undefined, numOfKeysLimit: 50, depthOfLimit: 4 } | 如果 console 输出包含了 js 对象,我们需要对其进行序列化,`stringLengthLimit` 限制了单个值能转化的最大字符串长度,`numOfKeysLimit` 限制了一个被序列化的 js 对象能够包含的最大数量 key,`depthOfLimit` 限制了一个被序列化的 js 对象能够拥有的对象深度(层数),如果对象的 key 数量超过了这个限制,我们将只保留对象的名字。你能通过这些选项来减小生成的 events 的体积。 |
|
||||
| logger | window.console | 要录制的 console 对象,你也可以传入一个想要录制的其他 js 执行环境的 console 对象。 |
|
||||
|
||||
## 播放 console 数据
|
||||
|
||||
|
||||
Reference in New Issue
Block a user