On this page:
format-req/  c
paren-format
extended-format
apache-default-format
log-format/  c
log-format->format
make

2.9 Logging

The web-server/dispatchers/dispatch-log module defines a dispatcher constructor for transparent logging of requests.
Equivalent to (-> request? string?).

Formats a request by:
(format
 "~s\n"
 (list 'from (request-client-ip req)
       'to (request-host-ip req)
       'for (url->string (request-uri req)) 'at
       (date->string
        (seconds->date (current-seconds)) #t)))

Formats a request by:
(format
 "~s\n"
 `((client-ip ,(request-client-ip req))
   (host-ip ,(request-host-ip req))
   (referer
    ,(let ([R (headers-assq*
               #"Referer"
               (request-headers/raw req))])
       (if R
           (header-value R)
           #f)))
   (uri ,(url->string (request-uri req)))
   (time ,(current-seconds))))

Formats a request like Apache’s default. However, Apache’s default includes information about the response to a request, which this function does not have access to, so it defaults the last two fields to 200 and 512.

Equivalent to (symbols 'parenthesized-default 'extended 'apache-default).

procedure

(log-format->format id)  format-req/c

  id : log-format/c
Maps 'parenthesized-default to paren-format, 'extended to extended-format, and 'apache-default to apache-default-format.

procedure

(make [#:format format #:log-path log-path])  dispatcher/c

  format : (or/c log-format/c format-req/c) = paren-format
  log-path : (or/c path-string? output-port?) = "log"
Logs requests to log-path, which can be either a filepath or an output-port?, using format to format the requests. (If format is a symbol, a log formatter will be tacitly made using log-format->format.) Then invokes next-dispatcher.

Changed in version 1.3 of package web-server-lib: Allow log-path to be an output-port?
Changed in version 1.8: Allow format to be a symbol (more precisely, a log-format/c).