Skip to content

Commit

Permalink
Add experimental verbose logging flag (#49250)
Browse files Browse the repository at this point in the history
Only shows fetch request logs by default and allows opting into verbose
request timings via experimental config.

x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1683236293282549)
  • Loading branch information
ijjk authored May 5, 2023
1 parent fd319d3 commit c881224
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/next/src/server/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ const configSchema = {
},
},
},
logging: {
type: 'string',
},
},
type: 'object',
},
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export interface NextJsWebpackConfig {
}

export interface ExperimentalConfig {
logging?: 'verbose'
appDocumentPreloading?: boolean
strictNextHead?: boolean
clientRouterFilter?: boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ export default class NextNodeServer extends BaseServer {
)
}
process.stdout.write('\n')
} else {
} else if (this.nextConfig.experimental.logging === 'verbose') {
process.stdout.write(
`- ${chalk.cyan(req.method || 'GET')} ${req.url} ${
res.statusCode
Expand Down

0 comments on commit c881224

Please sign in to comment.