From: Frank Duncan Date: Sat, 18 Dec 2021 17:25:35 +0000 (-0600) Subject: Use utils logging X-Git-Url: https://code.consxy.com/gitweb/?a=commitdiff_plain;h=ee77eb54acee4492045d4b5885bc5df332f58566;p=candle Use utils logging --- diff --git a/src/main/aws/aws.lisp b/src/main/aws/aws.lisp index 2913d32..4182c67 100644 --- a/src/main/aws/aws.lisp +++ b/src/main/aws/aws.lisp @@ -26,7 +26,7 @@ (values-list retn)))) (defun start-shutdown-thread () - (format t "Starting AWS shutdown thread~%") + (log:info "Starting AWS shutdown thread") (sb-thread:make-thread (lambda () (loop @@ -42,7 +42,7 @@ :name "AWS Shutdown Thread")) (defmethod candle:shutdown-system ((job-system (eql :aws))) - (format t "Shutting down AWS box for exit~%") + (log:info "Shutting down AWS box for exit") ; If there's a job going, we need to wait for it to finish (sb-thread:with-mutex (*aws-mutex*)) (stop-aws-box)) diff --git a/src/main/processor.lisp b/src/main/processor.lisp index 0d6ec1e..5e33639 100644 --- a/src/main/processor.lisp +++ b/src/main/processor.lisp @@ -8,7 +8,7 @@ (defgeneric shutdown-system (job-system)) (defun start-processor-thread () - (format t "Starting processor in ~(~A~) mode~%" *job-system*) + (log:info "Starting processor in ~(~A~) mode" *job-system*) (let* ((active t) (processor-thread @@ -28,7 +28,7 @@ :name "Processor"))) (push (lambda () - (format t "Shutting down processor thread~%") + (log:info "Shutting down processor thread") (setf active nil) (awaken-processor-thread) (sb-thread:join-thread processor-thread) diff --git a/src/main/server-cli.lisp b/src/main/server-cli.lisp index 8947727..b0c378b 100644 --- a/src/main/server-cli.lisp +++ b/src/main/server-cli.lisp @@ -44,5 +44,4 @@ (if (opera:option-present :dir options) (opera:option-argument :dir options) "/opt/candle/")) - (format t "Starting server on port ~A~%" port) (candle:server port nil)))))) diff --git a/src/main/server.lisp b/src/main/server.lisp index 3df97f8..bdf8d77 100644 --- a/src/main/server.lisp +++ b/src/main/server.lisp @@ -3,17 +3,22 @@ (defun server (port &optional (background t)) (when (not *candle-dir*) (error "Need a candle dir")) (let* - ((data-dir (format nil "~Adata" *candle-dir*))) + ((data-dir (format nil "~Adata" *candle-dir*)) + (log-dir (format nil "~Alogs/" *candle-dir*))) (ensure-directories-exist *candle-dir*) (ensure-directories-exist data-dir) + (ensure-directories-exist log-dir) + (setf log-utils:*log-dir* log-dir) + (log:add-appender #'log-utils:file-appender) + (log:info "Starting server on port ~A" port) (lame-db:load-known-dbs data-dir) - (format t "Starting processor in ~(~A~) mode~%" *job-system*) + (log:info "Starting processor in ~(~A~) mode" *job-system*) (start-save-thread data-dir) (start-processor-thread) (communication:start-listener port background))) (defun start-save-thread (data-dir) - (format t "Starting Save Thread~%") + (log:info "Starting Save Thread") (let* ((mutex (sb-thread:make-mutex)) (waitq (sb-thread:make-waitqueue)) @@ -37,7 +42,7 @@ :name "Save Thread Trigger") (push (lambda () - (format t "Shutting down save thread~%") + (log:info "Shutting down save thread") (sb-thread:with-mutex (mutex) (setf active nil) (sb-thread:condition-broadcast waitq))