Q: logging in realtime

From: Vasilis Margioulas (vasilism_at_hotmail.com)
Date: 04/14/04


Date: 14 Apr 2004 03:06:15 -0700

Hi all.

What i want to do is to log some trace massages when *trace-enabled*
flag is set to t.
Due to real time requirements when *trace-enabled* is set to nil
trace code must not be present in function definition.

My aproach is the following:

(defmacro def-some-function ()
  `(defun some-function (arg)
     ,(if *trace-enabled*
        `(progn
           (log-to-file *trace-file* (format nil "~A" arg))
           arg)
        'arg)))

changing *trace-enabled* to t and reevaluating (def-some-function) take
the desired behavior but the code to support this is not so clean

Any better ideas?

Thanks in advance.