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

Using debug with esm renders wrong formatted output for %o / %O #744

Open
dbo opened this issue Jan 29, 2020 · 2 comments
Open

Using debug with esm renders wrong formatted output for %o / %O #744

dbo opened this issue Jan 29, 2020 · 2 comments
Labels
bug This issue identifies a malfunction
Milestone

Comments

@dbo
Copy link

dbo commented Jan 29, 2020

Using debug with or without esm produces different formatted output using %o or %O:

$ DEBUG=topic node -r esm -p 'require("debug")("topic")("out: %o", { foo: "?date=2020-01-29T14%3A24%3A44.806Z" })'
  topic out: { foo: '?date=2020-01-29T14undefinedA24undefinedA44.806Z' } +0ms
undefined

whereas the following correctly renders

$ DEBUG=topic node -p 'require("debug")("topic")("out: %o", { foo: "?date=2020-01-29T14%3A24%3A44.806Z" })'
  topic out: { foo: '?date=2020-01-29T14%3A24%3A44.806Z' } +0ms
undefined
@Konakona-chan
Copy link

Related to #786. ESM is known for working with imports as with immutable objects (so that adjacent js file can not inject %o formatter as simple, as it was in CSM).

@Qix-
Copy link
Member

Qix- commented Oct 14, 2021

Not sure what the issue is here, and I don't know why esm would have anything to do with this.

For some reason, it appears the logger is treating the % in the date string as a formatting delimiter and trying to pull them from subsequent arguments. It's quite strange and certainly not right.

I'm hoping the v5 release will fix this.

@Qix- Qix- added the bug This issue identifies a malfunction label Oct 14, 2021
@Qix- Qix- added this to the 5.x milestone Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue identifies a malfunction
Development

No branches or pull requests

3 participants