Refactor lola logging

This commit is contained in:
Jeremy Dormitzer 2020-06-02 09:41:04 -04:00
parent c8f6d12bb0
commit 2e6ca39bce

View File

@ -5308,19 +5308,6 @@ Some functions to make my day job easier.
(t (error "virtual environment %s does not exist" venv)))))
(call-with-env-from-file (format "%s/bin/activate" venv-dir) callback)))
(defun get-latest-lola-log (prefix)
(lambda ()
(concat
"~/lola/logs/"
(car (last (directory-files "~/lola/logs"
nil
(concat prefix "[[:digit:]-]+T[[:digit:]:]+\\.log")))))))
(defun lola-log-file (prefix)
(format "~/lola/logs/%s%s.log"
prefix
(format-time-string "%Y-%m-%dT%H:%M:%S")))
(defun kill-log-buffers ()
(interactive)
(kill-matching-buffers "\\.log$" nil t)
@ -5354,12 +5341,10 @@ Some functions to make my day job easier.
:args (lambda ()
(list
"-c"
(format
"gunicorn -c server/web/gunicorn.conf.py \
"gunicorn -c server/web/gunicorn.conf.py \
-b 127.0.0.1:7200 bin.start_web:init_and_create_flask_app\\(\\) \
&> %s"
(lola-log-file "lola-server-"))))
:file (get-latest-lola-log "lola-server-")
>> ~/lola/logs/lola-server.log 2>&1"))
:file "~/lola/logs/lola-server.log"
:inhibit-process-filter t
:cwd "~/lola/lola-server"
:stop-signal 'int
@ -5384,11 +5369,9 @@ Some functions to make my day job easier.
:command "bash"
:args (lambda ()
(list
"-c"
(format "python bin/start_web.py &> %s"
(lola-log-file "travel-svc-"))))
"-c" "python bin/start_web.py >> ~/lola/logs/travel-svc.log 2>&1"))
:cwd "~/lola/lola-travel-service"
:file (get-latest-lola-log "travel-svc-")
:file "~/lola/logs/travel-svc.log"
:inhibit-process-filter t
:stop-signal 'int
:truncate-output t
@ -5407,8 +5390,8 @@ Some functions to make my day job easier.
"-n " "travel-service "
"-Q "
"default,io_pool,cpu_pool,priority_io_pool,priority_cpu_pool "
(format "&> %s" (lola-log-file "travel-svc-celery-")))))
:file (get-latest-lola-log "travel-svc-celery-")
">> ~/lola/logs/travel-svc-celery.log 2>&1")))
:file "~/lola/logs/travel-svc-celery.log"
:inhibit-process-filter t
:cwd "~/lola/lola-travel-service"
:stop-signal 'int
@ -5503,9 +5486,12 @@ Some functions to make my day job easier.
(prodigy-define-service
:name "ean-hotels-service"
:tags '(lola backend)
:command "~/lola/python_services/ean_hotels/bin/start.sh"
:args '("web")
:command "bash"
:args '("-c"
"ean_hotels/bin/start.sh web >> ~/lola/logs/ean-hotels.log 2>&1")
:cwd "~/lola/python_services"
:inhibit-process-filter t
:file "~/lola/logs/ean-hotels.log"
:stop-signal 'kill
:init-async (python-service-setup "~/lola/python_services/.venv"
"~/lola/python_services/ean_hotels/.env"