logging
你可以配置日志记录级别以及在开发模式下运行 Next.js 时是否将完整 URL 记录到控制台。
¥You can configure the logging level and whether the full URL is logged to the console when running Next.js in development mode.
目前,logging
仅适用于使用 fetch
API 获取数据。它尚未应用于 Next.js 内的其他日志。
¥Currently, logging
only applies to data fetching using the fetch
API. It does not yet apply to other logs inside of Next.js.
module.exports = {
logging: {
fetches: {
fullUrl: true,
},
},
}
默认情况下,不会记录从 服务器组件 HMR 缓存 恢复的任何 fetch
请求。但是,可以通过将 logging.fetches.hmrRefreshes
设置为 true
来启用此功能。
¥Any fetch
requests that are restored from the Server Components HMR cache are not logged by default. However, this can be enabled by setting logging.fetches.hmrRefreshes
to true
.
module.exports = {
logging: {
fetches: {
hmrRefreshes: true,
},
},
}
此外,你可以通过将 logging
设置为 false
来禁用开发日志记录。
¥In addition, you can disable the development logging by setting logging
to false
.
module.exports = {
logging: false,
}