Skip to content

Commit

Permalink
chore(server): improve dev logs formatting (vercel#41109)
Browse files Browse the repository at this point in the history
# Why

Use the custom, build-in logger for the dev server messages, to unify
their appearance with other ones:

<img width="415" alt="Screenshot 2022-10-02 135927"
src="https://user-images.githubusercontent.com/719641/193454207-88c415a2-9b43-45f3-ae52-3f088bccfd01.png">

# How

Replace `console` with `Log` calls in `next-dev-server.ts`.
  • Loading branch information
Simek authored and Kikobeats committed Oct 24, 2022
1 parent 8486475 commit cc8b757
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/next/server/dev/next-dev-server.ts
Expand Up @@ -178,7 +178,7 @@ export default class DevServer extends Server {
})
}
if (fs.existsSync(pathJoin(this.dir, 'static'))) {
console.warn(
Log.warn(
`The static directory has been deprecated in favor of the public directory. https://nextjs.org/docs/messages/static-dir-deprecated`
)
}
Expand Down Expand Up @@ -207,7 +207,7 @@ export default class DevServer extends Server {
// Makes `next export` exportPathMap work in development mode.
// So that the user doesn't have to define a custom server reading the exportPathMap
if (this.nextConfig.exportPathMap) {
console.log('Defining routes from exportPathMap')
Log.info('Defining routes from exportPathMap')
const exportPathMap = await this.nextConfig.exportPathMap(
{},
{
Expand All @@ -231,7 +231,7 @@ export default class DevServer extends Server {
Object.keys(urlQuery)
.filter((key) => query[key] === undefined)
.forEach((key) =>
console.warn(
Log.warn(
`Url '${path}' defines a query parameter '${key}' that is missing in exportPathMap`
)
)
Expand Down Expand Up @@ -613,7 +613,7 @@ export default class DevServer extends Server {
reject(e)
resolved = true
} else {
console.warn('Failed to reload dynamic routes:', e)
Log.warn('Failed to reload dynamic routes:', e)
}
}
})
Expand Down

0 comments on commit cc8b757

Please sign in to comment.