Skip to content

Way to disable printf-style feature temporarily #976

@sdepold

Description

@sdepold

We are seeing some interesting side-effect of the printf-style feature outlined here: sequelize/sequelize#17448

Long story short, we are using debug to print SQL queries that are executed against database servers and whenever people use a like or ilike query in combination with % at the beginning, it sometimes happens that the logs show NaN. This happens when the search term starts with any of the printf-style characters, e.g. for something like SELECT * FROM foo WHERE name LIKE %fauzi%. The logs will then contain NaNauzi.

Would it be possible to force a debug log statement to ignore any printf formatting?

Something like:

const log = debug('sql')

log("%fauzi%", { printfFormatting: false})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions