Oops, forgot to include the logging code.
authorChris Hanson <org/chris-hanson/cph>
Sat, 30 Oct 2004 04:57:27 +0000 (04:57 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sat, 30 Oct 2004 04:57:27 +0000 (04:57 +0000)
v7/src/ssp/mod-lisp.scm
v7/src/ssp/ssp.pkg

index 97da522e286012fbb24d9bb564d3c446c0c16662..dc59be3fb00bc3ad9079e0b776af66d0e331c56e 100644 (file)
@@ -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
index 06ea777b24e32e21ee91deb34f8c43b39cccc546..876b903fbd7e332adcd5eaef28dc3c732b07e865 100644 (file)
@@ -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