@rarible/logger
Advanced tools
Comparing version 0.10.0-alpha.13 to 0.10.0-alpha.14
@@ -6,3 +6,3 @@ "use strict"; | ||
const object_sizeof_1 = tslib_1.__importDefault(require("object-sizeof")); | ||
const is_circular_1 = require("@rarible/utils/build/common/is-circular"); | ||
const json_stringify_safe_1 = tslib_1.__importDefault(require("json-stringify-safe")); | ||
const utils_1 = require("@rarible/utils/build/error/utils"); | ||
@@ -15,8 +15,3 @@ const UNKNOWN = `[unknown]`; | ||
const result = stringify(value, indent); | ||
if ((0, object_sizeof_1.default)(result) > maxByteSize) { | ||
prev[key] = `[too-big-object]`; | ||
} | ||
else { | ||
prev[key] = result; | ||
} | ||
prev[key] = (0, object_sizeof_1.default)(result) > maxByteSize ? `[too-big-object]` : result; | ||
return prev; | ||
@@ -30,9 +25,4 @@ }, {}); | ||
return loggableValue; | ||
if (typeof value === "object") { | ||
// Check for circular structures on this stage because all below might | ||
// be a subject of circular structures | ||
if ((0, is_circular_1.isCircular)(value)) | ||
return `[circular-object]`; | ||
return JSON.stringify(value, serializer, indent); | ||
} | ||
if (typeof value === "object") | ||
return (0, json_stringify_safe_1.default)(value, serializer, indent); | ||
return UNKNOWN; | ||
@@ -58,2 +48,4 @@ } | ||
return `[function: ${value.name || "unnamed"}]`; | ||
if (value instanceof Date) | ||
return `[date: ${value.toISOString()}]`; | ||
if ((0, utils_1.isErrorLike)(value)) | ||
@@ -60,0 +52,0 @@ return `[${value.name}: ${value.message}]`; |
{ | ||
"name": "@rarible/logger", | ||
"version": "0.10.0-alpha.13", | ||
"version": "0.10.0-alpha.14", | ||
"private": false, | ||
@@ -24,2 +24,3 @@ "description": "Logging utility for ts projects", | ||
"generic-type-guard": "^3.7.2", | ||
"json-stringify-safe": "^5.0.1", | ||
"object-sizeof": "^2.6.3" | ||
@@ -44,3 +45,3 @@ }, | ||
}, | ||
"gitHead": "248bce48687c674c82baeaf28130f91975b7a4dc" | ||
"gitHead": "c169f0960cf610481c428a8fa4b884de4cdf1996" | ||
} |
Sorry, the diff of this file is not supported yet
54910
5
574
+ Addedjson-stringify-safe@^5.0.1
+ Addedjson-stringify-safe@5.0.1(transitive)