[hunchentoot-devel] resurrect tbnl's debug-value macro?

Mac Chan emailmac at gmail.com
Thu May 3 19:31:39 UTC 2007


On 5/3/07, Daniel Gackle <danielgackle at gmail.com> wrote:
> I'm curious: when you say "there are other ways to do it," what do you have in mind?
>
> Dan

With this ugly bit of code. The debug-value macro is still nicer though :-)


(let ((saved-process-request #'hunchentoot::process-request)
      last-request last-session)

  (defun request-sniffer (request)
    (setf last-request request
          last-session *session*)
    (values))

  (defun enable-debug-mode ()
    (push #'request-sniffer *dispatch-table*)
    (setf (fdefinition 'hunchentoot::process-request)
          #'(lambda (&rest args)
              (prog1 (apply saved-process-request args)
                (setq *request* last-request
                      *session* last-session)))))

  (defun disable-debug-mode ()
    (makunbound '*request*)
    (makunbound '*session*)
    (setf last-request nil last-session nil
          *dispatch-table* (delete #'request-sniffer *dispatch-table*)
          (fdefinition 'hunchentoot::process-request) saved-process-request)))



More information about the Tbnl-devel mailing list