Attempts to fix server logging

master
Brady McDonough 10 months ago
parent fff223b450
commit b8974f5d91

@ -16,7 +16,7 @@ csv:
up: .backend.lock up: .backend.lock
.backend.lock: yacswa/yacswa.scm .backend.lock: yacswa/yacswa.scm
@${ENV} @GUILE@ yacswa/yacswa.scm 2>&1 > yacswa-backend.log & PID=$$!; echo $${PID} > .backend.lock && echo "Server spawned with PID $${PID}" && echo "Allow for a couple minutes as data is fetched and initialized." @${ENV} @GUILE@ yacswa/yacswa.scm &> server.log & PID=$$!; echo $${PID} > .backend.lock && echo "Server spawned with PID $${PID}" && echo "Allow for a couple minutes as data is fetched and initialized."
down: down:
@PID=`cat .backend.lock` && kill -15 $${PID} && rm .backend.lock && echo "Server on PID $${PID} down."; unset PID @PID=`cat .backend.lock` && kill -15 $${PID} && rm .backend.lock && echo "Server on PID $${PID} down."; unset PID

@ -5,7 +5,8 @@
#:use-module (ice-9 regex) #:use-module (ice-9 regex)
#:use-module (tk listlogic) #:use-module (tk listlogic)
#:use-module (tk short) #:use-module (tk short)
#:use-module (yacswa data)) #:use-module (yacswa data)
#:export (std-display))
(use-modules (system repl server)) (use-modules (system repl server))
@ -37,16 +38,23 @@
(regexp-match? (string-match "^[0-9][0-9][0-9][0-9]$" code))) (regexp-match? (string-match "^[0-9][0-9][0-9][0-9]$" code)))
;; Init ;; Init
(display "Spawning repl on port 1337...")
(define repl-sock (make-tcp-server-socket #:port 1337))
(display "done.\n")
;; Artanis steals stdout/stderr
(define std-display
(let ((stdout (current-output-port)))
(lambda (obj)
(display obj stdout))))
(display "Calling init-server...\n")
(std-display "Spawning repl...")
(define repl-sock (make-tcp-server-socket))
(std-display "done.\n")
(std-display "Calling init-server...\n")
(init-server #:statics '(png jpg jpeg ico html js css) (init-server #:statics '(png jpg jpeg ico html js css)
#:cache-statics? #t #:exclude '()) #:cache-statics? #t #:exclude '())
(display "Artanis initialized!\n") (std-display "Artanis initialized!\n")
(display "Setting routes...") (std-display "Setting routes...")
;; Routes ;; Routes
(get "/json/pc/:pc" (get "/json/pc/:pc"
@ -114,4 +122,4 @@
((#t) "Updated") ((#t) "Updated")
((#f) "Expecting")))) ((#f) "Expecting"))))
(display "done.\n") (std-display "done.\n")

@ -10,5 +10,5 @@
;;(spawn-server repl-sock) ;;(spawn-server repl-sock)
;; No SSL. Sad. ;; No SSL. Sad.
(display "Bringing server up...\n") (std-display "Bringing server up...\n")
(run #:port 1665) (run #:port 1665)

Loading…
Cancel
Save