Skip to content

Commit

Permalink
fix: improve logging for on-demand pages (#11069)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored May 16, 2024
1 parent 1f988ed commit 240a70a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-parents-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Improves debug logging for on-demand pages
8 changes: 8 additions & 0 deletions packages/astro/src/core/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ export class App {
this.#logRenderOptionsDeprecationWarning();
}
}
if (routeData) {
this.#logger.debug("router", "The adapter " + this.#manifest.adapterName + " provided a custom RouteData for ", request.url);
this.#logger.debug("router", "RouteData:\n" + routeData);
}
if (locals) {
if (typeof locals !== 'object') {
this.#logger.error(null, new AstroError(AstroErrorData.LocalsNotAnObject).stack!);
Expand All @@ -296,8 +300,12 @@ export class App {
}
if (!routeData) {
routeData = this.match(request);
this.#logger.debug("router", "Astro matched the following route for "+ request.url);
this.#logger.debug("router", "RouteData:\n" + routeData);
}
if (!routeData) {
this.#logger.debug("router", "Astro hasn't found routes that match " + request.url);
this.#logger.debug("router", "Here's the available routes:\n", this.#manifestData);
return this.#renderError(request, { locals, status: 404 });
}
const pathname = this.#getPathnameFromRequest(request);
Expand Down

0 comments on commit 240a70a

Please sign in to comment.