Skip to content

Commit 9c5345d

Browse files
authored
Merge pull request #51 from ryukinix/refactor-logs
refactor: reduce logs verbosity
2 parents c4a0181 + b18bedc commit 9c5345d

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ COPY *.lisp .
99
RUN ros install ./lisp-inference.asd
1010
RUN ros run -s lisp-inference/web -q
1111
EXPOSE 40000
12-
ENTRYPOINT ["/root/.roswell/bin/inference-server"]
12+
ENTRYPOINT ["/app/roswell/inference-server.ros"]

lisp-inference.asd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
:homepage "https://github.com/ryukinix/lisp-inference"
3232
:serial t
3333
:depends-on (:lisp-inference
34+
:40ants-logging
3435
:40ants-routes ;; implicit dependency of reblocks
3536
:reblocks
3637
:reblocks-ui

roswell/inference-server.ros

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ exec ros -Q -- $0 "$@"
3232
(unwind-protect
3333
(handler-case
3434
(progn
35-
(format t "[+] Starting Lisp Inference server...~%")
36-
(lisp-inference/web:start *port*)
37-
(format t "[+] http://127.0.0.1:~a~%" *port*)
38-
(format t "[+] Press C-c to kill Lisp Inference server...~%")
35+
(lisp-inference/web:start :port *port* :debug nil)
36+
(log:info "[+] Starting Lisp Inference server...")
37+
(log:info "[+] http://127.0.0.1:~a" *port*)
38+
(log:info "[+] Press C-c to kill Lisp Inference server...")
3939
(loop do (sleep 10)))
4040
(#+sbcl sb-sys:interactive-interrupt
4141
#+ccl ccl:interrupt-signal-condition

web/webapp.lisp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,17 @@ history.pushState(null, '', url);
9191
(defun truth-table (exp)
9292
(with-output-to-string (s)
9393
(let ((inference:*output-stream* s))
94+
(log:info "expression: ~a" exp)
9495
(handler-case (inference:print-truth-table
9596
(inference:parse-logic exp))
9697
(simple-error (c)
98+
(log:warn "Maximum variables reached in expression '~a' generated the error: ~a" exp c)
9799
(apply #'format s
98100
(simple-condition-format-control c)
99101
(simple-condition-format-arguments c)))
100102
(error (c)
101103
(declare (ignore c))
104+
(log:error "Invalid expression: '~a' generated the error: ~a" exp c)
102105
(format s "error: invalid logic expression!"))))))
103106

104107
(defun create-table (exp-string)
@@ -192,8 +195,10 @@ history.pushState(null, '', url);
192195
*proposition*
193196
prop))))
194197

195-
(defun start (&optional (port *port*))
196-
(reblocks/debug:on)
198+
(defun start (&key (port *port*) (debug t))
199+
(if debug
200+
(reblocks/debug:on)
201+
(40ants-logging:setup-for-cli :level :info))
197202
(reblocks/server:stop)
198203
(reblocks/server:start :port port))
199204

0 commit comments

Comments
 (0)