summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <my.burning@gmail.com> 2024-05-16 16:13:32 +0100
committerGravatar GitHub <noreply@github.com> 2024-05-16 16:13:32 +0100
commit240a70a29f8e11d161da021845c208f982d64e5c (patch)
tree6bc62597d616a99e431b0e6c6fb3fabceaed4238
parent1f988ed10f4737b5333c9978115ee531786eb539 (diff)
downloadastro-240a70a29f8e11d161da021845c208f982d64e5c.tar.gz
astro-240a70a29f8e11d161da021845c208f982d64e5c.tar.zst
astro-240a70a29f8e11d161da021845c208f982d64e5c.zip
fix: improve logging for on-demand pages (#11069)
-rw-r--r--.changeset/silly-parents-repair.md5
-rw-r--r--packages/astro/src/core/app/index.ts8
2 files changed, 13 insertions, 0 deletions
diff --git a/.changeset/silly-parents-repair.md b/.changeset/silly-parents-repair.md
new file mode 100644
index 000000000..9157e6cc6
--- /dev/null
+++ b/.changeset/silly-parents-repair.md
@@ -0,0 +1,5 @@
+---
+"astro": patch
+---
+
+Improves debug logging for on-demand pages
diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts
index 1ba5d9479..58dbae9f5 100644
--- a/packages/astro/src/core/app/index.ts
+++ b/packages/astro/src/core/app/index.ts
@@ -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!);
@@ -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);