2.10 Basic Logging

► |  | Web Server: HTTP Server

1 | Dispatching Server
2 | Dispatchers
3 | Launching Servers
4 | Web Servers
5 | Internal APIs
6 | Troubleshooting and Tips
| Index

▼ | 2 | Dispatchers

2.1 | General
2.2 | Mapping URLs to Paths
2.3 | Sequencing
2.4 | Timeouts
2.5 | Lifting Procedures
2.6 | Filtering Requests by URL
2.7 | Filtering Requests by Method
2.8 | Procedure Invocation upon Request
2.9 | Logging
2.10 | Basic Logging
2.11 | Password Protection
2.12 | Virtual Hosts
2.13 | Serving Files
2.14 | Serving Servlets
2.15 | Statistics
2.16 | Limiting Requests
2.17 | Wrapping Requests & Responses

On this page:

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

top contents ← prev up next →

#### 2.10`` Basic Logging🔗ℹ

(require web-server/dispatchers/dispatch-log)
| package: web-server-lib

The web-server/dispatchers/dispatch-log module defines a dispatcher constructor for transparent logging of requests. Consider using the facilities in Logging instead, as it provides more flexibility.

> value format-req/c : contract?

Equivalent to (-> request? string?).

> value paren-format : format-req/c

Formats a request like its counterpart in Logging, but without the response code information.

> value extended-format : format-req/c

Formats a request like its counterpart in Logging, but without the response code information.

> value apache-default-format : format-req/c

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 - and -.

> value combined-log-format : format-req/c

Formats a request and a response to approximate the Combined Log Format. As this function does not have access to the size of the object returned to the client, it defaults the field to -.

> value log-format/c : contract?

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

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

Maps 'parenthesized-default to paren-format, 'extended to extended-format, 'apache-default to apache-default-format, and 'combined to combined-log-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).

top contents ← prev up next →