From c3bf1e3a9fe84f82420376ba4e4fb14a24315748 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 25 Apr 2024 21:22:21 -0500 Subject: [PATCH] updating with log info set properly --- src/main.lisp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main.lisp b/src/main.lisp index fc9522a..a78b731 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -13,6 +13,8 @@ (in-package :tfcserver) +(log:config :daily "/tmp/tfc-%Y%m%d.log") + (defvar *server*) (defun start-server (port) (setq *server* @@ -243,7 +245,7 @@ (defun mail-mt-form (form attachment) "Takes the form as an alist and sends a table formatted email with the image attached to us" - (uiop:println form) + (log:info form) (let ((first-name (cdr (assoc "firstname" form :test 'string=))) (last-name (cdr (assoc "lastname" form :test 'string=))) (form (reverse form))) @@ -371,11 +373,9 @@ with the image attached" (uiop:println d) (if (string= "firstname" (car d)) (progn - (uiop:println (cdr d)) (setf first-name (cdr d)))) (if (string= "lastname" (car d)) (progn - (uiop:println (cdr d)) (setf last-name (cdr d)))) (if (string= "image" (car d)) (let ((path (path-join @@ -391,8 +391,8 @@ with the image attached" (cadr (uiop:split-string (car (last d 2)) :separator "."))))) (setf attachment path) - (uiop:println attachment))))) - (uiop:println data) + (log:info attachment))))) + (log:info data) (mail-health-form data attachment) (cond ((string= registration "now") (setf (hunchentoot:header-out :HX-Redirect) "https://secure.myvanco.com/L-Z772/campaign/C-13JPJ")) @@ -414,19 +414,18 @@ with the image attached" (data (hunchentoot:post-parameters* hunchentoot:*request*)) (registration (cdr (assoc "registration" data :test 'string=))) (health (cdr (assoc "health" data :test 'string=)))) - (uiop:println data) + (log:info data) ;; This is extremely necessary so that cors is right (setf (tbnl:header-out :access-control-expose-headers) "*") (if (string= health "later") (progn (uiop:println "Selected health later") (cond ((string= registration "now") (setf (hunchentoot:header-out :HX-Redirect) "https://secure.myvanco.com/L-Z772/campaign/C-13JPJ") - (uiop:println (tbnl:headers-out*)) - (uiop:println (hunchentoot:return-code*)) + (log:info (tbnl:headers-out*)) (mail-camp-form data nil)) ((string= registration "full") (setf (tbnl:header-out :HX-Redirect) "https://secure.myvanco.com/L-Z772/campaign/C-13JQE") - (uiop:println (tbnl:headers-out*)) + (log:info (tbnl:headers-out*)) (mail-camp-form data nil)) ((string= registration "later") (let ((first-name (cdr (assoc "firstname" data :test 'string=))) @@ -443,14 +442,13 @@ with the image attached" (:p :class "text-md" "If you'd like to pay for your registration go to the donate tab in the top right when you are ready and find the camp registration option."))))))) (progn - (uiop:println "Health now") (setf (tbnl:header-out :HX-Redirect) (format nil "/camp-health-form/?registration=~A" registration)) - (uiop:println (tbnl:headers-out*)) + (log:info (tbnl:headers-out*)) (mail-camp-form data nil))))) (defun main () (start-server 4242) - (format t "Server has started on port 4242~&") + (log:info "Server has started on port 4242~&") (handler-case (bt:join-thread (find-if (lambda (th) (search "hunchentoot" (bt:thread-name th)))