Closed abirtley closed 1 year ago
I came here to report the same issue with tslog v4.8.2
, on both OS X and Linux with two different versions of node. Running the above test case, here are the stack traces I'm seeing:
node:internal/url:668
ObjectGetPrototypeOf(this[context]) !== URLContext.prototype) {
^
TypeError: Cannot convert undefined or null to object
at getPrototypeOf (<anonymous>)
at [nodejs.util.inspect.custom] (node:internal/url:668:9)
at formatValue (node:internal/util/inspect:806:19)
at inspect (node:internal/util/inspect:365:10)
at formatWithOptionsInternal (node:internal/util/inspect:2273:40)
at formatWithOptions (node:internal/util/inspect:2135:10)
at transportFormatted (file://redacted/node_modules/tslog/dist/esm/runtime/nodejs/index.js:89:33)
at Logger.log (file://redacted/node_modules/tslog/dist/esm/BaseLogger.js:104:19)
at Logger.info (file://redacted/node_modules/tslog/dist/esm/index.js:20:22)
at file://redacted/repro.mjs:4:8
Node.js v18.13.0
node:internal/url:815
return this.#context.href;
^
TypeError: Cannot read private member #context from an object whose class did not declare it
at get href [as href] (node:internal/url:815:17)
at [nodejs.util.inspect.custom] (node:internal/url:756:21)
at formatValue (node:internal/util/inspect:804:19)
at inspect (node:internal/util/inspect:363:10)
at formatWithOptionsInternal (node:internal/util/inspect:2297:40)
at formatWithOptions (node:internal/util/inspect:2159:10)
at transportFormatted (file://redacted/node_modules/.pnpm/tslog@4.8.2/node_modules/tslog/dist/esm/runtime/nodejs/index.js:89:33)
at Logger.log (file://redacted/node_modules/.pnpm/tslog@4.8.2/node_modules/tslog/dist/esm/BaseLogger.js:104:19)
at Logger.info (file://redacted/node_modules/.pnpm/tslog@4.8.2/node_modules/tslog/dist/esm/index.js:20:22)
at file://redacted/repro.mjs:4:8
Node.js v20.2.0
It's solved in V4.9.0
.
Thanks for pointing it out.
Describe the bug If you attempt to log a URL, you get a variety of errors, depending on whether the URL is a top level logged item, or a field inside a logged object. Either way, it fails.
To Reproduce Steps to reproduce the behavior:
Expected behavior The URLs are logged without error.
Screenshots
Additional context
Seems to be a reversion of https://github.com/fullstack-build/tslog/issues/93, but perhaps a different cause.
I have managed to hack around it with the following additions in BaseLogger.js (node_modules/tslog/dist/esm/BaseLogger.js). With this amended code, URL objects can be logged without issue.
Node.js Version e.g. 18.16.0
OS incl. Version macOS 13.4.1 (c)