i was looking at the implementation of logging levels, i think it would be a better idea to assign each level a number this would be much faster than the current list based implementation, when we add or remove levels we can just update the numbers associated with each level. what do you think?
-- Marco Ring the bells that still can ring. Forget the perfect offering. There is a crack in everything. That's how the light gets in. -Leonard Cohen
Marco Baringer mb@bese.it writes:
i was looking at the implementation of logging levels, i think it would be a better idea to assign each level a number this would be much faster than the current list based implementation, when we add or remove levels we can just update the numbers associated with each level. what do you think?
Currently levels are defined like this :
(defparameter *levels* '(:debug :info :warning :error :fatal))
would you like to create a such structure like this :
(defparameter *levels* '((:debug . 1) (:info . 2) (:warning . 3) (:error . 4) (:fatal . 5)))
?
---- Wiadomość Oryginalna ---- Od: Lam lam@tuxfamily.org Do: log4cl-devel@common-lisp.net Data: Tue, 09 Mar 2004 19:03:53 +0100 Temat: Re: [log4cl-devel] logging levels
Marco Baringer mb@bese.it writes:
i was looking at the implementation of logging levels, i think it would be a better idea to assign each level a number this would be much faster than the current list based implementation, when we
add or
remove levels we can just update the numbers associated with each level. what do you think?
Currently levels are defined like this :
(defparameter *levels* '(:debug :info :warning :error :fatal))
would you like to create a such structure like this :
(defparameter *levels* '((:debug . 1) (:info . 2) (:warning . 3) (:error . 4) (:fatal . 5)))
I prefer using symbol properties to things like that.
Example code (not tested):
(defun update-level-symbols-properties () (let ((level 0)) (dolist (i *levels*) (setf (get i 'log4cl-level) (incf level)))))
(defun level> (a b) (> (get a 'log4cl-level) (get b 'log4cl-level))
-- Pozdrawiam, Rafal Strzalinski (nabla) http://nabla.prv.pl