Skip to content

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

Open

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?

Activity

  1. atuttle commented on Feb 21, 2019

    @atuttle
    Author

    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

  2. Qix- commented on Mar 11, 2019

    @Qix-
    Member

    Is recursive formatting supposed to be happening?

    Definitely not. Indeed a bug; good catch!

  3. added
    bug
    change-patch
    help-wanted
    pr-welcome
    on Mar 11, 2019
  4. added this to the 5.x milestone on Mar 11, 2019
  5. RabiaSaid commented on Jun 21, 2022

    @RabiaSaid

    2.6.8

  6. RabiaSaid commented on Jun 21, 2022

    @RabiaSaid

    4.3.4

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugchange-patchhelp-wantedpr-welcome

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions