► |  | Web Server: PLT HTTP Server

1 | Running the Web Server
2 | Writing Servlets
3 | Extending the Web Server
4 | Troubleshooting and Tips
5 | Acknowledgements
| Index

► | 3 | Extending the Web Server

3.1 | Configuration
3.2 | Setting Up Servlets
3.3 | Dispatchers
3.4 | Web Config Unit
3.5 | Web Server Unit
3.6 | Internal

▼ | 3.3 | Dispatchers

3.3.1 | General
3.3.2 | Mapping URLs to Paths
3.3.3 | Sequencing
3.3.4 | Timeouts
3.3.5 | Lifting Procedures
3.3.6 | Filtering Requests
3.3.7 | Procedure Invocation upon Request
3.3.8 | Logging
3.3.9 | Password Protection
3.3.10 | Virtual Hosts
3.3.11 | Serving Files
3.3.12 | Serving Servlets
3.3.13 | Statistics
3.3.14 | Limiting Requests

On this page:

format-req/ c
paren-format
extended-format
apache-default-format
log-format->format
make

Version: 4.1.4
top← prev up next →

##### 3.3.8`` Logging

(require web-server/dispatchers/dispatch-log)

The web-server/dispatchers/dispatch-log module defines a dispatcher constructor for transparent logging of requests.

format-req/c : contract?

Equivalent to (-> request? string?).

paren-format : format-req/c

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)))

extended-format : format-req/c

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))))

apache-default-format : format-req/c

Formats a request like Apache’s default.

(log-format->format id) → format-req/c
id : symbol?

Maps 'parenthesized-default to paren-format, 'extended to extended-format, and 'apache-default to apache-default-format.

(make [#:format format #:log-path log-path]) → dispatcher/c
format : format-req/c = paren-format
log-path : path-string? = "log"

Logs requests to log-path by using format to format the requests. Then invokes next-dispatcher.

top← prev up next →