Skip to content

Commit 240a70a

Browse files
authoredMay 16, 2024··
fix: improve logging for on-demand pages (#11069)
1 parent 1f988ed commit 240a70a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
 

‎.changeset/silly-parents-repair.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"astro": patch
3+
---
4+
5+
Improves debug logging for on-demand pages

‎packages/astro/src/core/app/index.ts

+8
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ export class App {
280280
this.#logRenderOptionsDeprecationWarning();
281281
}
282282
}
283+
if (routeData) {
284+
this.#logger.debug("router", "The adapter " + this.#manifest.adapterName + " provided a custom RouteData for ", request.url);
285+
this.#logger.debug("router", "RouteData:\n" + routeData);
286+
}
283287
if (locals) {
284288
if (typeof locals !== 'object') {
285289
this.#logger.error(null, new AstroError(AstroErrorData.LocalsNotAnObject).stack!);
@@ -296,8 +300,12 @@ export class App {
296300
}
297301
if (!routeData) {
298302
routeData = this.match(request);
303+
this.#logger.debug("router", "Astro matched the following route for "+ request.url);
304+
this.#logger.debug("router", "RouteData:\n" + routeData);
299305
}
300306
if (!routeData) {
307+
this.#logger.debug("router", "Astro hasn't found routes that match " + request.url);
308+
this.#logger.debug("router", "Here's the available routes:\n", this.#manifestData);
301309
return this.#renderError(request, { locals, status: 404 });
302310
}
303311
const pathname = this.#getPathnameFromRequest(request);

0 commit comments

Comments
 (0)
Please sign in to comment.