From 8c120d41f1a202105175503629aa79b2808421d2 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sat, 9 May 2020 21:29:17 -0500 Subject: added logging switch and stream --- lazybones.lisp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lazybones.lisp') diff --git a/lazybones.lisp b/lazybones.lisp index 318ae95..92f6d93 100644 --- a/lazybones.lisp +++ b/lazybones.lisp @@ -20,6 +20,12 @@ If no known decoder matches, holds a stream. Bound by route handlers for POST, PUT, and PATCH requests.") +(defvar *logging-p* nil + "Set to T if you want ot log requests to the value of *logging-stream*.") + +(defvar *logging-stream* t + "Set to T (i.e the standard output) by default.") + (defvar *resp-headers* nil "A PLIST bound at the beginning of every response. Can be used to add additional headers to responses valid responses.") @@ -260,6 +266,8 @@ for the request's path." (defun main-handler (req) + (when *logging-p* + (format *logging-stream* "~a~%" req)) (handler-case (multiple-value-bind (args handler) (lookup-route req) (if handler -- cgit v1.2.3