3a71e255ba2f9a34b8cbbeecd500bb20ac91fae0 — Thomas Letan 1 year, 6 months ago 2bfff68
chore: Start logging using the vom package

Contrary to the Elixir implementation, we will try to log as many
information as possible. Currently, we just warn when we register a
new player, and when we create a new instance because all the already
existing ones are already full.

Signed-off-by: Thomas Letan <contact@thomasletan.fr>
3 files changed, 12 insertions(+), 5 deletions(-)

M daemon.lisp
M daemon/scene.lisp
M lycan.asd
M daemon.lisp => daemon.lisp +2 -0
@@ 18,3 18,5 @@
  (:nicknames :ld)
  (:use :cl :alexandria)
  (:export main))

(vom:config :ld :info)

M daemon/scene.lisp => daemon/scene.lisp +9 -4
@@ 32,9 32,10 @@

(defmethod register-player ((target pool) player)
  (if (not (dolist (i (instances target))
             (when (register-player i player)
             (when (try-register-player i player)
               (return t))))
      (let ((i (make-instance 'instance :scene (scene target))))
        (vom:info "Create a new instance for scene ~a" (scene target))
        (push i (instances target))
        (register-player i player))))

@@ 45,8 46,12 @@
   (players :initform nil
            :accessor players)))

(defmethod register-player ((target instance) player)
(defmethod try-register-player ((target instance) player)
  (if-let ((limit (limit (scene target))))
    (when (< (length (players target)) limit)
      (push player (players target)))
    (push player (players target))))
      (register-player target player))
    (register-player target player)))

(defmethod register-player ((target instance) player)
  (vom:info "Register player ~a to instance ~a" player target)
  (push player (players target)))

M lycan.asd => lycan.asd +1 -1
@@ 20,7 20,7 @@
  :license  "AGPLv3"
  :version "3.0.0"
  :serial t
  :depends-on (cl-async alexandria)
  :depends-on (cl-async alexandria vom)
  :components ((:file "daemon")
               (:file "daemon/scene")
               (:file "daemon/main")))