Skip to content

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

Open
@atuttle

Description

@atuttle

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue identifies a malfunctionchange-patchThis proposes or provides a change that requires a patch releasehelp-wantedThis issue has an actionable itempr-welcomeThis issue has an approved change; a pull request would be appreciated

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions