2.9 Logging
The web-server/dispatchers/dispatch-logresp module defines a dispatcher constructor
for transparent logging of requests and responses.
value
value
Formats a request and a response 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) 'code (response-code resp)))
value
Formats a request and a response 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)) (code ,(response-code resp))))
Formats a request and a response like Apache’s default. However, Apache’s default
includes information about the size of the object returned to the client,
which this function does not have access to, so it defaults the last field
to -.
value
procedure
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) → dispatcher/c format : (or/c log-format/c format-reqresp/c) = paren-format log-path : (or/c path-string? output-port?) = "log" dispatcher : dispatcher/c
If dispatcher is successfully dispatched,
logs requests and responses (without the body information)
to log-path, which can be either a filepath or an output-port?,
using format to format the requests and responses
(or just requests if format only accepts one argument).
If format is a symbol, a log formatter will be tacitly made using log-format->format.
Added in version 1.12 of package web-server-lib.