Next: , Previous: answer, Up: Top   [Contents][Index]

13 (www server-utils log)

The (www server-utils log) module provides procedure generators for writing log information to an output port. Each generator is conventionally named log-SOMETHING-proc.

Procedure: string<-sockaddr saddr

Return a string describing the AF_INET or AF_UNIX socket address object saddr. This is typically found as the CDR of the accept return value.

For AF_UNIX, return "localhost" unless (somehow) the expression (sockaddr:path saddr) has non-#f and non-empty-string value.

For AF_INET the format is hostname:port, where hostname is from inet-ntoa and port is an integer.

For any other family, return what object->string returns.

Procedure: log-http-response-proc port [gmtime? [stamp-format [method-pair?]]]

Return a procedure that writes an HTTP response log entry to port. The procedure is called with args client, method, upath (strings or symbols) and status (either an atom or a list), and writes a one-line entry of the form:


where the ‘YYYY..TZ’ are the year, month, day, hour, minute, second and timezone components, respectively, of the localtime representation of the current time; and ‘STn’ are the space-separated elements of status.

Optional second arg gmtime? non-#f means use gmtime instead of localtime. Optional third arg stamp-format specifies a format string passed to strftime to use for the timestamp portion that appears between the square braces (default: "%Y-%m-%d:%H:%M:%S %Z").

Optional fourth arg method-pair? non-#f means that method is expected to be a pair (meth . vers), in which case the portion between the double quotes becomes "meth upath vers". This is to support excruciating conformity to Apache for the benefit of downstream programs that might fall over less than gracefully otherwise. Please enjoy the slack.

The buffering mode for port is set to line-buffered.

Next: , Previous: answer, Up: Top   [Contents][Index]