From 71a7c39292eef91d732c0b98e3939032c5ae338b Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 12 Oct 2025 23:27:25 +0300 Subject: Replace my simple logging implementation with log4cl --- src/main.lisp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/main.lisp') diff --git a/src/main.lisp b/src/main.lisp index f31cd7c..f90bfb3 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -2,8 +2,9 @@ ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs (defpackage :ukkoclot/main (:nicknames :ukkoclot) - (:use :c2cl :ukkoclot/bot :ukkoclot/config :ukkoclot/inline-bots :ukkoclot/log :ukkoclot/tg-types) + (:use :c2cl :ukkoclot/bot :ukkoclot/config :ukkoclot/inline-bots :ukkoclot/tg-types) (:import-from :anaphora :acond :awhen :it) + (:import-from :log) (:import-from :ukkoclot/bot :make-bot :bot-power-on :fixup-value) (:import-from :ukkoclot/db :with-db) (:import-from :ukkoclot/strings :escape-xml :is-tg-whitespace-str :starts-with :starts-with-ignore-case) @@ -24,12 +25,12 @@ (unwind-protect (let ((config (config-load #P"config.default.lisp"))) (config-merge config #P"config.lisp") - (log-info "Starting up ~A" (config-bot-name config)) + (log:info "Starting up ~A" (config-bot-name config)) (with-db (db (config-db-path config)) (let ((bot (make-bot config db))) ;; TODO: Catch fatal errors & report them (wrapped-main bot config)))) - (log-info "We're done!"))) + (log:info "We're done!"))) (defun wrapped-main (bot config) (when *in-prod* @@ -81,7 +82,7 @@ :callback-query-id (callback-query-id cb) :text "OK")) (t - (log-info "Unrecognised callback query data: ~A" data) + (log:info "Unrecognised callback query data: ~A" data) (answer-callback-query bot :callback-query-id (callback-query-id cb) :text "Unallowed callback query, don't press the button again" @@ -215,7 +216,7 @@ (defun on-text-command (bot msg text cmd) (let ((simple-cmd (simplify-cmd bot cmd))) - (log-debug "text-command: ~A AKA ~A" cmd simple-cmd) + (log:debug "text-command: ~A AKA ~A" cmd simple-cmd) ;; TODO: Replace this cond with a nicer dispatch. Something like string-case? (acond ((equal simple-cmd "chatid") @@ -246,7 +247,7 @@ Send time: ...")) ))) (defun report-error (bot evt err) - (log-error "While handling ~A: ~A" evt err) + (log:error "While handling ~A: ~A" evt err) (let ((msg (format nil "~A while handling ~&
~A
" (escape-xml (format nil "~A" err)) (escape-xml (format nil "~A" evt))))) -- cgit v1.2.3