From: Chris Hanson Date: Sat, 30 Oct 2004 04:57:27 +0000 (+0000) Subject: Oops, forgot to include the logging code. X-Git-Tag: 20090517-FFI~1495 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=59c9555104da0c7767516ff67fa92ccb3227579b;p=mit-scheme.git Oops, forgot to include the logging code. --- diff --git a/v7/src/ssp/mod-lisp.scm b/v7/src/ssp/mod-lisp.scm index 97da522e2..dc59be3fb 100644 --- a/v7/src/ssp/mod-lisp.scm +++ b/v7/src/ssp/mod-lisp.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: mod-lisp.scm,v 1.5 2004/10/30 04:44:09 cph Exp $ +$Id: mod-lisp.scm,v 1.6 2004/10/30 04:57:19 cph Exp $ Copyright 2003,2004 Massachusetts Institute of Technology @@ -749,4 +749,30 @@ USA. (if (not (eof-object? line)) (begin (procedure line) - (loop)))))) \ No newline at end of file + (loop)))))) + +;;;; Logging + +(define (start-logging-requests pathname) + (if (hook-in-list? mod-lisp-before-expander-hooks 'LOG-REQUESTS) + (error "Logging already started.")) + (set! request-log-port (open-output-file pathname 'APPEND)) + (add-hook-to-list mod-lisp-before-expander-hooks 'LOG-REQUESTS log-requests)) + +(define (stop-logging-requests) + (remove-hook-from-list mod-lisp-before-expander-hooks 'LOG-REQUESTS) + (let ((port request-log-port)) + (set! request-log-port #f) + (if port + (close-port port)))) + +(define (log-requests request) + (if request-log-port + (write-line (list (get-universal-time) + (http-message-method request) + (http-message-url request) + (http-message-user-name request) + (http-message-post-parameters request)) + request-log-port))) + +(define request-log-port #f) \ No newline at end of file diff --git a/v7/src/ssp/ssp.pkg b/v7/src/ssp/ssp.pkg index 06ea777b2..876b903fb 100644 --- a/v7/src/ssp/ssp.pkg +++ b/v7/src/ssp/ssp.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: ssp.pkg,v 1.6 2004/10/30 04:44:51 cph Exp $ +$Id: ssp.pkg,v 1.7 2004/10/30 04:57:27 cph Exp $ Copyright 2003,2004 Massachusetts Institute of Technology @@ -69,7 +69,10 @@ USA. http-response-header http-status-response mod-lisp-expander - server-root-dir) + server-root-dir + start-logging-requests + stop-logging-requests + trace-requests?) (export (runtime ssp-expander-environment) http-browser-type html-content-type