print warning for large serialized strings

This commit is contained in:
Tobias Koppers 2019-11-07 16:49:55 +01:00
parent 81d413a175
commit 6eb9958643
1 changed files with 10 additions and 0 deletions

View File

@ -177,6 +177,16 @@ class BinaryMiddleware extends SerializerMiddleware {
}
currentBuffer.write(thing, currentPosition);
currentPosition += len;
if (len > 102400 && context.logger) {
context.logger.warn(
`Serializing big strings (${Math.round(
len / 1024
)}kiB) impacts deserialization performance (consider Buffer instead): ${thing.slice(
0,
100
)}...\n`
);
}
break;
}
case "number": {