Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Logging URL objects fails #93

Closed
whitphx opened this issue Mar 9, 2021 · 3 comments · Fixed by brad-jones/ssh-add-with-pass#33, tianhaoz95/approveman#319 or miko-org/Miko#38
Closed
Labels
bug Something isn't working

Comments

@whitphx
Copy link

whitphx commented Mar 9, 2021

Describe the bug
TSlog version: 3.1.1

Similar to #86.
When logging a URL object, an error occurs.

root@88f15f987cd8:/srv# yarn ts-node src/tslogdebug.ts
yarn run v1.22.5
$ /srv/node_modules/.bin/ts-node src/tslogdebug.ts
2021-03-09 18:30:36.039  INFO [src/tslogdebug.ts:5 Object.<anonymous>] TypeError: Cannot convert undefined or null to object
    at getPrototypeOf (<anonymous>)
    at URL.[nodejs.util.inspect.custom] (internal/url.js:357:9)
    at internal/per_context/primordials.js:23:32
    at formatValue (internal/util/inspect.js:783:19)
    at Object.inspect (internal/util/inspect.js:337:10)
    at Logger._inspectAndHideSensitive (/srv/node_modules/tslog/src/LoggerWithoutCallSite.ts:897:26)
    at /srv/node_modules/tslog/src/LoggerWithoutCallSite.ts:664:18
    at Array.forEach (<anonymous>)
    at Logger.printPrettyLog (/srv/node_modules/tslog/src/LoggerWithoutCallSite.ts:632:30)
    at Logger._handleLog (/srv/node_modules/tslog/src/LoggerWithoutCallSite.ts:348:14)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To Reproduce
Steps to reproduce the behavior:
Run the code below.

import { Logger } from "tslog";

const logger = new Logger();
const url = new URL("http://example.com");
logger.info(url);

Additional context
Add any other context about the problem here.

Node.js Version
v14.16.0 (node:14.16.0-buster docker image)

OS incl. Version
Debian (buster) docker image on Debian (buster) host.

@whitphx whitphx added the bug Something isn't working label Mar 9, 2021
@terehov
Copy link
Contributor

terehov commented Mar 10, 2021

Thank you. I am on it.

@terehov
Copy link
Contributor

terehov commented Mar 11, 2021

Fixed in 3.1.2 and should now also be more generic. Thank you once again.

https://github.com/fullstack-build/tslog/releases/tag/v3.1.2

@terehov terehov closed this as completed Mar 11, 2021
@whitphx
Copy link
Author

whitphx commented Mar 11, 2021

Thank you for such a quick fix! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment