调试
你可以通过 DEBUG
环境变量在 Prisma Client 和 Prisma CLI 中启用调试输出。它接受两个命名空间来打印调试输出:
¥You can enable debugging output in Prisma Client and Prisma CLI via the DEBUG
environment variable. It accepts two namespaces to print debugging output:
-
prisma:engine
:打印 Prisma ORM engine 中发生的相关调试消息¥
prisma:engine
: Prints relevant debug messages happening in a Prisma ORM engine -
prisma:client
:打印 Prisma 客户端运行时中发生的相关调试消息¥
prisma:client
: Prints relevant debug messages happening in the Prisma Client runtime -
prisma*
:从 Prisma 客户端或 CLI 打印所有调试消息¥
prisma*
: Prints all debug messages from Prisma Client or CLI -
*
:打印所有调试消息¥
*
: Prints all debug messages
Prisma 客户端可以配置为记录与发送到数据库的查询相关的警告、错误和信息。请参阅 配置日志记录 了解更多信息。
¥Prisma Client can be configured to log warnings, errors and information related to queries sent to the database. See Configuring logging for more information.
设置 DEBUG
环境变量
¥Setting the DEBUG
environment variable
以下是在 bash 中设置这些调试选项的示例:
¥Here are examples for setting these debugging options in bash:
# enable only `prisma:engine`-level debugging output
export DEBUG="prisma:engine"
# enable only `prisma:client`-level debugging output
export DEBUG="prisma:client"
# enable both `prisma-client`- and `engine`-level debugging output
export DEBUG="prisma:client,prisma:engine"
要启用所有 prisma
调试选项,请将 DEBUG
设置为 prisma*
:
¥To enable all prisma
debugging options, set DEBUG
to prisma*
:
export DEBUG="prisma*"
在 Windows 上,使用 set
而不是 export
:
¥On Windows, use set
instead of export
:
set DEBUG="prisma*"
要启用所有调试选项,请将 DEBUG
设置为 *
:
¥To enable all debugging options, set DEBUG
to *
:
export DEBUG="*"