moved --log parsing into MAIN

updated documentation
This commit is contained in:
a. fox 2024-01-23 01:02:21 -05:00
parent 1fb6fa3de2
commit c27fea0bef
3 changed files with 18 additions and 7 deletions

View File

@ -18,9 +18,10 @@
;; these options require a parameter passed
(:name :logging
:description "sets the log level. supported levels are info, debug, and error"
:description (format nil "sets the log level. supported levels are: ~{~(~A~)~^, ~}"
+valid-log-levels+)
:long "log"
:arg-parser #'set-logging-level
:arg-parser #'identity
:meta-var "LEVEL")
(:name :load-file
:description "loads specified lisp file before starting the server"

View File

@ -93,6 +93,18 @@ if we cannot find the file we throw an error"
(defun main ()
(multiple-value-bind (opts args) (get-opts)
(declare (ignore args))
;; --log
(when (getf opts :logging)
(let ((keyw (car (member (intern (string-upcase (getf opts :logging))
:keyword)
+valid-log-levels+))))
(if keyw
(log:config keyw)
(progn
(format t "bad value for logging level specified.~%proper values are ~{~(~A~)~^, ~}~%"
(mapcar #'string +valid-log-levels+))
(uiop:quit 1)))))
;; -h/--help
(when (getf opts :help)

View File

@ -4,11 +4,9 @@
(declaim (inline static-asset-p generate-filepath set-logging-level))
(defun set-logging-level (level)
"sets the log level for the app"
(let ((keyw (intern (string-upcase level) :keyword)))
(prog1 t
(log:config (car (member keyw '(:info :debug :error)))))))
(a:define-constant +valid-log-levels+
'(:info :debug :error)
:test 'equal)
(defmacro handle-user-abort (body &rest signal-forms)
`(handler-case