Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document logging options (via DEBUG env var) #1697

Closed
nikolasburk opened this issue Feb 25, 2020 · 2 comments
Closed

Document logging options (via DEBUG env var) #1697

nikolasburk opened this issue Feb 25, 2020 · 2 comments
Assignees

Comments

@nikolasburk
Copy link
Member

When using Prisma Client, you can set different log levels via the DEBUG env var. This needs to be documented. Eg.: DEBUG=prisma-client or DEBUG=*

@pantharshit00
Copy link
Contributor

pantharshit00 commented Feb 25, 2020

We use the popular nodejs logging library debug: https://www.npmjs.com/package/debug

Many other packages like express also use the same library. So when you initialize debug, you give your debugger a namespace like shown below:

const debug = require('debug')('prisma-client')

and it is shown in the debug output when you enable it via the DEBUG environment variable:
image

So DEBUG=* enables all the debug loggers and DEBUG=prisma-client only enables the debug output for Prisma namespace. The two major namespaces that we use in the client right now are prisma-client and engine so you can only enable debug output from these using DEBUG=prisma-client,engine.

Also, if you want to force the debug output regardless of the DEBUG env, you can pass the debug option in the Prisma client constructor like so new PrismaClient({ __internal: {debug: true}})

@divyenduz divyenduz added this to the Preview 24 New milestone Mar 3, 2020
@nikolasburk
Copy link
Member Author

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

No branches or pull requests

4 participants