Adding generalization of log to serve/servlet
This commit is contained in:
parent
a11734d990
commit
f0e52b80df
|
@ -166,7 +166,7 @@ Like always, you don't even need to save the file.
|
|||
[#:ssl-key ssl-key (or/c false/c path-string?) (and ssl? (build-path server-root-path "private-key.pem"))]
|
||||
|
||||
[#:log-file log-file (or/c false/c path-string?) #f]
|
||||
[#:log-format log-format log-format/c 'apache-default])
|
||||
[#:log-format log-format (or/c log-format/c format-req/c) 'apache-default])
|
||||
void]{
|
||||
This sets up and starts a fairly default server instance.
|
||||
|
||||
|
@ -211,7 +211,7 @@ Like always, you don't even need to save the file.
|
|||
Web Server is used instead. Of course, if a path is given, then it overrides this behavior.
|
||||
|
||||
If @racket[log-file] is given, then it used to log requests using @racket[log-format] as the format. Allowable formats
|
||||
are those allowed by @racket[log-format->format].
|
||||
are those allowed by @racket[log-format->format]. If @racket[log-format] is a function, it is used directly to render the log entry.
|
||||
|
||||
If @racket[connection-close?] is @racket[#t], then every connection is closed after one
|
||||
request. Otherwise, the client decides based on what HTTP version it uses.
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
#:servlet-path string?
|
||||
#:servlet-regexp regexp?
|
||||
#:log-file (or/c false/c path-string?)
|
||||
#:log-format log:log-format/c)
|
||||
#:log-format (or/c log:log-format/c log:format-req/c))
|
||||
. ->* .
|
||||
void)])
|
||||
|
||||
|
@ -145,7 +145,10 @@
|
|||
[log-format 'apache-default])
|
||||
(define (dispatcher sema)
|
||||
(dispatcher-sequence
|
||||
(and log-file (log:make #:format (log:log-format->format log-format)
|
||||
(and log-file (log:make #:format
|
||||
(if (symbol? log-format)
|
||||
(log:log-format->format log-format)
|
||||
log-format)
|
||||
#:log-path log-file))
|
||||
(and quit? (filter:make #rx"^/quit$" (quit-server sema)))
|
||||
(dispatch/servlet
|
||||
|
|
Loading…
Reference in New Issue
Block a user