Skip to content

Use debug as default logger #261

@bas080

Description

@bas080

Many tools in the node ecosystem use https://www.npmjs.com/package/debug to make it easy for people to start debugging a certain library in their application.

I can for example do DEBUG='express:*' npm start to get debug information on the express side of things in my app.

It would be neat to be able to do the same for postgres. DEBUG=postgres:* npm start would report on all kinds of events happening during initialization and on queries.

I know I can set a debug callback already.

const debug = require('debug')('postgres:debug')

postgres(process.ENV.DATABASE_URL, {
  debug: (...args) => debug(args)
})

That's what I'm doing currently.

Just trying to suggest a nice default for logging; and yes, my suggestion does add a dependency (downside?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions