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:
Peter Chen
2021-08-07 23:06:50 +08:00
committed by GitHub
parent 838287a16d
commit 8d40e52010
6 changed files with 70 additions and 22 deletions

View File

@@ -38,6 +38,7 @@ rrweb.record({
stringifyOptions: {
stringLengthLimit: 1000,
numOfKeysLimit: 100,
depthOfLimit: 1
},
logger: window.console,
})],
@@ -45,12 +46,12 @@ rrweb.record({
```
All recordLog options are described below:
| key | default | description |
| ---------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| level | ['log','warn','error',...] | Default value contains names of all console functions. You can override it by setting console levels you need. |
| lengthThreshold | 1000 | Maximum number of records of console output. |
| stringifyOptions | { stringLengthLimit: undefined, numOfKeysLimit: 50 } | If console output includes js objects, we need to stringify them. `stringLengthLimit` limits the string length of single value. `numOfKeysLimit` limits the number of keys in an object. If an object contains more keys than this limit, we would only save object's name. You can reduce the size of events by setting these options. |
| logger | window.console | the console object we would record.You can set a console object from another execution environment where you would like to record. |
| key | default | description |
| ---------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| level | ['log','warn','error',...] | Default value contains names of all console functions. You can override it by setting console levels you need. |
| lengthThreshold | 1000 | Maximum number of records of console output. |
| stringifyOptions | { stringLengthLimit: undefined, numOfKeysLimit: 50, depthOfLimit: 4 } | If console output includes js objects, we need to stringify them. `stringLengthLimit` limits the string length of single value. `numOfKeysLimit` limits the number of keys in an object. `depthOfLimit` limits the depth of object. If an object contains more keys than this limit, we would only save object's name. You can reduce the size of events by setting these options. |
| logger | window.console | the console object we would record.You can set a console object from another execution environment where you would like to record. |
## replay console