> but it would be nice to have a function pair (log and unlog) that does
> all this:
> - trace the function
> - redirect the output of trace to a file too
> - untrace and go back to default stderr
> something like this
> #+begin_src picolisp
> (de log (Func)
> (err (tmp "log")
> (trace Func)
> (pass Func) ) )
> but this does not work unfortunately...
How about this?
(de log (File Funs . Prg)
(mapc trace Funs)
(run Prg 1)
(mapc untrace Funs) ) ) )
It can be used like
(log "+myLogFile" '(gt0 le0 + - * /)
(foo (bar ..)) ) ) )
This example traces all calls to the comparison and arithmetic functions
in the list while 'myProgram' is running.
The "+" is to append the output to the log file. Without it, "myLogFile"
will be overwritten from scratch each time.