(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
: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))
(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
: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)
(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))
: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))