% symbol in object interpreted as formatter
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- observability
Research direction
Start with the JavaScript reproductions in the issue and trace the formatter used by debug("%o", ...); no source files or tests are named. Done means literal percent-containing object keys and values are preserved, including across repeated calls, with regression coverage for the shown cases.
Written by the indexing model from the issue text.
Description
const debug = require('debug')('foo')
debug.enabled = true // Or use ENV variables
const someObjectIWantToLog = { "%j": "%j %j %%" }
debug("%o", someObjectIWantToLog, 1, 2, 3)
result:
foo { '1': '2 3 %' } +0ms
expected result:
foo { "%j": "%j %j %%" } 1 2 3 +0ms
This gets even weirder when running the following several times:
debug("%o", { "%j": "%j %j %%" })
debug("%o", { "%j": "%j %j %%" })
debug("%o", { "%j": "%j %j %%" })
debug("%o", { "%j": "%j %j %%" })
result:
foo { '"\u001b[38;5;148m+3s\u001b[0m"': '%j %j %' }
foo { '"\u001b[38;5;148m+847ms\u001b[0m"': '%j %j %' }
foo { '"\u001b[38;5;148m+674ms\u001b[0m"': '%j %j %' }
foo { '"\u001b[38;5;148m+620ms\u001b[0m"': '%j %j %' }
Did I miss something in the doc? Is there a way not to interpret those % symbols? Or is this a bug?
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 992
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from debug-js/debug
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Debug as JSON Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 28/100
Similar issues
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AllTheMods/ATM-10-L#19 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
SignalK/n2k-signalk#345 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
JuliaPluto/PlutoPlotly.jl#72 ·