logging: use customized pattern layout

This commit is contained in:
Helmut Merz 2024-07-04 11:35:17 +02:00
parent 999589a380
commit b7502e5e77
3 changed files with 5 additions and 4 deletions

View file

@ -17,6 +17,7 @@
(defun setup(cfg)
(let ((loglevel (config:from-env :loglevel (loglevel cfg)))
(logfile (config:from-env :logfile (logfile cfg)))
(pat "%&%<%I%;<;;>;-5p [%D{%H:%M:%S}] %g{}{}{:downcase}%:; ;F%2.2N - %:_%m%>%n")
params)
(if (stringp loglevel)
(setf loglevel (util:to-keyword loglevel)))
@ -24,7 +25,7 @@
(setf logfile (util:path-from-string logfile)))
(util:ensure-dir logfile)
;(format t "~&loglevel: ~s, logfile: ~s~%" loglevel logfile)
(setf params (list :sane loglevel :daily logfile))
(setf params (list :sane loglevel :daily logfile :pattern pat))
(if (console cfg)
(setf params (cons :console params)))
(apply #'log4cl:log-config params)))
(apply #'log:config params)))

View file

@ -7,7 +7,7 @@
(config:add :logger :class 'logging:config
:loglevel :info
:logfile (t:test-path "scopes-test.log" "log")
:console nil)
:console t)
(config:add :server :class 'server:config
:port "8899"

View file

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