aboutsummaryrefslogtreecommitdiff
path: root/module/calp/server/webdav.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-16 15:02:42 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-16 15:02:42 +0200
commitba392c218664937dbd07411a38cbbc4e6f0c69b3 (patch)
tree341166beba5b75ffb3b8240fc3c349b2ced111e3 /module/calp/server/webdav.scm
parentfixup! 9b28572 (diff)
downloadcalp-ba392c218664937dbd07411a38cbbc4e6f0c69b3.tar.gz
calp-ba392c218664937dbd07411a38cbbc4e6f0c69b3.tar.xz
Add number of clearifying comments + minor cleanup.
Diffstat (limited to 'module/calp/server/webdav.scm')
-rw-r--r--module/calp/server/webdav.scm38
1 files changed, 38 insertions, 0 deletions
diff --git a/module/calp/server/webdav.scm b/module/calp/server/webdav.scm
index 7cbdd32e..3413f254 100644
--- a/module/calp/server/webdav.scm
+++ b/module/calp/server/webdav.scm
@@ -131,6 +131,7 @@
+;;; Extract the root element from sxml tree
(define (root-element sxml)
(sxml-match sxml
[(*TOP* (*PI* . ,args) ,root) root]
@@ -471,15 +472,37 @@
+;;; Log tables are tables for easily adding key value data,
+;;; and later formatting them.
+;;; They in themself do not actually do any logging.
+
+;;; The "global" log table
(define log-table (make-parameter #f))
+
+;;; Initialize the global log table to an empty log table
(define (init-log-table!) (log-table '()))
+
+;;; Takes a list of alternating symbols and values,
+;;; Each such pair is added to the log global table
(define (log-table-add! . args)
(for (key value) in (group args 2)
(log-table (acons key value (log-table)))))
+
+;;; Get the given key from the global key table
+;;; or return dflt (default #f) if not found
(define* (log-table-get key optional: dflt)
(or (assoc-ref (log-table) key)
dflt))
+;;; Write data from the global log table to current output port.
+;;; Each argument should be one of the following types
+;;; string? :: printed verbatim
+;;; symbol? :: value looked up in the global log table,
+;;; and value printed
+;;; pair? :: The car is a symbol to look up per `symbol?'
+;;; The cdr is a procedure for foramtting the given
+;;; value for output
+;;; All other types are ignored.
(define (log-table-format . args)
(for-each (lambda (arg)
(cond ((string? arg) (display arg))
@@ -490,6 +513,21 @@
(else #f)))
args))
+;;; Writes a log message to current error port.
+;;; This reads values for the log table.
+;;;
+;;; The following table fields are used
+;;; now :: current datetime, as a datetime?
+;;; method :: Name of the source method
+;;; uri :: URI accessed, an an uri? object
+;;; request :: The source request
+;;; If the request-method of the request is
+;;; 'COPY or 'MOVE then `headers' is checked for a
+;;; destination header.
+;;; headers :: Request headers, see `request'
+;;; response-code :: Response code to emit (e.x. 200)
+;;; response-phrase :: Phrase belonging to that code (e.x. "OK")
+;;; msg :: Optional freetext message
(define (emit-log!)
;; (write (log-table) (current-error-port))
;; (newline (current-error-port))