Handle logging correctly

master
not manx 4 years ago
parent 53ca0a271c
commit ac3d3cc35d
Signed by: C-xC-c
GPG Key ID: F52ED472284EF2F4

@ -24,7 +24,7 @@ Use cl-rng to pick a random page from the lolibooru API"
(cl-ppcre:register-groups-bind (url)
("(?:file_url\":\")(.*?)(?:\",)"
(dex:get (str "https://lolibooru.moe/post/index.json?tags=rating:"
(or (cl-ppcre:scan-to-strings "-?[sqe]" rating) "s")
(or (cl-ppcre:scan-to-strings "^-?[sqe]$" rating) "s")
"+-3dcg+-rape&limit=1&page="
(write-to-string (cl-rng:crandom :limit 25000 :transform 'floor)))))
(cl-ppcre:regex-replace-all "\\\\/" url "/")))
@ -46,18 +46,26 @@ Use cl-rng to pick a random page from the lolibooru API"
(:a :id "about" :href "/loli/about" "about")))
x))
(henh:host-file "/loli/about" "about.html" @html)
(defun configure ()
(setf *serb* (make-instance 'hunchentoot:easy-acceptor
:port (config-item :port)
:document-root (config-item :document-root))))
:port (config-item :port)
:document-root (config-item :document-root)
;; We (eval) these because quoting streams is werid.
;; '*standard-ouput* is not of type stream why?
:access-log-destination (eval (config-item :access-log))
:message-log-destination (eval (config-item :error-log)))))
(defun start ()
(handler-case (configure)
(error (e) "Configuration failed: ~a" e))
(when (null *serb*)
(error "Serb is nill? ehh?"))
(hunchentoot:start *serb*))
(defun stop ()
(hunchentoot:stop *serb*))
(export '(configure
start
stop
*serb*))

Loading…
Cancel
Save