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

when %j exists in a formatted object, it pulls in the timestamp/delta #687

Open
atuttle opened this issue Feb 21, 2019 · 4 comments
Open
Labels
bug This issue identifies a malfunction change-patch This proposes or provides a change that requires a patch release help-wanted This issue has an actionable item pr-welcome This issue has an approved change; a pull request would be appreciated
Milestone

Comments

@atuttle
Copy link

atuttle commented Feb 21, 2019

I found this when debugging some mysql search strings, so for example looking for a name like "jordan" to appear somewhere in a string, but wrapped with % to match anywhere in the string: %jordan%...

repro:

const demo = require('debug')('demo');
const data = [ '%j' ];
demo('%o', data);

Prints:

demo "\u001b[38;5;166m+30m\u001b[0m"

Note that the timestamp/delta is not appended to the end of the output as usual.

I know that %j is for pulling in json, but this is in the data object I'm running through the formatter. Is recursive formatting supposed to be happening? And even if it is, why would it pull in the timestamp/delta as if that were one of the arguments I was passing into the debug function?

@atuttle
Copy link
Author

atuttle commented Feb 21, 2019

I've also seen %s trigger a similar effect, but when I tried to create a simple repro for the ticket it wouldn't happen on command for me. But here it is happening for an array containing %smith%...

image

@Qix-
Copy link
Member

Qix- commented Mar 11, 2019

Is recursive formatting supposed to be happening?

Definitely not. Indeed a bug; good catch!

@Qix- Qix- added bug This issue identifies a malfunction change-patch This proposes or provides a change that requires a patch release help-wanted This issue has an actionable item pr-welcome This issue has an approved change; a pull request would be appreciated labels Mar 11, 2019
@Qix- Qix- added this to the 5.x milestone Mar 11, 2019
@RabiaSaid
Copy link

2.6.8

@RabiaSaid
Copy link

4.3.4

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 change-patch This proposes or provides a change that requires a patch release help-wanted This issue has an actionable item pr-welcome This issue has an approved change; a pull request would be appreciated
Development

No branches or pull requests

3 participants