dev-stylish
Matthew Butterick 6 years ago
parent a7c4733e58
commit 830ca4960e

@ -58,14 +58,15 @@
;; print message to console about a request ;; print message to console about a request
(define/contract (logger req) (define/contract (logger req)
(request? . -> . void?) (request? . -> . void?)
(define client (request-client-ip req))
(define localhost-client "::1") (define localhost-client "::1")
(define url-string (url->string (request-uri req))) (define url-string (url->string (request-uri req)))
(unless (ends-with? url-string "favicon.ico") (unless (ends-with? url-string "favicon.ico")
(message (if (regexp-match #rx"/$" url-string) (message (match url-string
(string-append url-string " directory default page") [(regexp #rx"/$") (string-append url-string " directory default page")]
(string-replace url-string (setup:main-pagetree) " dashboard")) [_ (string-replace url-string (setup:main-pagetree) " dashboard")])
(if (not (equal? client localhost-client)) (format "from ~a" client) ""))) (match (request-client-ip req)
[(== localhost-client) ""]
[client (format "from ~a" client)]))))
;; pass string args to route, then ;; pass string args to route, then
;; package route into right format for web server ;; package route into right format for web server

Loading…
Cancel
Save