Log route count on boot and no-match on route attempts

Shows "pages: N routes loaded" at startup and
"sx:route no match (N routes) /path" when no route matches,
so we can see if routes loaded and why matching fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 21:10:24 +00:00
parent a7d09291b8
commit eb70e7237e
3 changed files with 11 additions and 6 deletions

View File

@@ -319,7 +319,8 @@
(merge page
{"parsed" (parse-route-pattern (get page "path"))})))
pages))))))
scripts))))
scripts)
(log-info (str "pages: " (len _page-routes) " routes loaded")))))
;; --------------------------------------------------------------------------

View File

@@ -543,7 +543,7 @@
;; Only works for pages without :data dependencies.
(let ((match (find-matching-route pathname _page-routes)))
(if (nil? match)
false
(do (log-info (str "sx:route no match (" (len _page-routes) " routes) " pathname)) false)
(if (get match "has-data")
(do (log-info (str "sx:route server (has data) " pathname)) false)
(let ((content-src (get match "content"))