set up logging in test-web

This commit is contained in:
Helmut Merz 2024-07-04 06:57:48 +02:00
parent 093509863a
commit 5ed409fe4a
5 changed files with 11 additions and 3 deletions

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
test.db test.db
bin bin
log
.env .env
*-test.log

View file

@ -58,7 +58,7 @@
(defun setup-services (&optional (cfg config:*root*)) (defun setup-services (&optional (cfg config:*root*))
(setf *root* (make-instance 'context :config cfg)) (setf *root* (make-instance 'context :config cfg))
(dolist (c (config:children cfg)) (dolist (c (reverse (config:children cfg)))
(add-service *root* c))) (add-service *root* c)))
(defun shutdown () (defun shutdown ()
@ -74,6 +74,7 @@
(actions ctx))))) (actions ctx)))))
(defun add-service (ctx cfg) (defun add-service (ctx cfg)
(format t "~&add-service: ~s~%" (config:name cfg))
(with-slots (services) ctx (with-slots (services) ctx
(let ((child (funcall (config:setup cfg) cfg))) (let ((child (funcall (config:setup cfg) cfg)))
(when child (when child

View file

@ -4,6 +4,11 @@
(config:root :env-keys '(:address :port)) (config:root :env-keys '(:address :port))
(config:add :logger :class 'logging:config
:loglevel :info
:logfile (t:test-path "scopes-test.log" "log")
:console nil)
(config:add :server :class 'server:config (config:add :server :class 'server:config
:port "8899" :port "8899"
:routes :routes

View file

@ -5,6 +5,7 @@
(:local-nicknames (:config :scopes/config) (:local-nicknames (:config :scopes/config)
(:core :scopes/core) (:core :scopes/core)
(:client :scopes/web/client) (:client :scopes/web/client)
(:logging :scopes/logging)
(:message :scopes/core/message) (:message :scopes/core/message)
(:server :scopes/web/server) (:server :scopes/web/server)
(:t :scopes/testing)) (:t :scopes/testing))

View file

@ -32,7 +32,8 @@
:port (parse-integer (port cfg)) :port (parse-integer (port cfg))
:address (address cfg) :address (address cfg)
;:server :woo ;:server :woo
:silent t)))) :silent t))
(log:info "server started on port ~s." (port cfg))))
(defun stop (ctx) (defun stop (ctx)
(clack:stop (listener ctx))) (clack:stop (listener ctx)))