6.2.6 Directing trace output


Trace keyword

:trace-output stream

This option allows you to direct trace output to a stream other than the listener in which the original function call was made. By using this you can arrange to dispatch traced output from different functions to different places.

Consider the following example:

  1. In the listener, create a file stream as follows:
  2. CL-USER 129 > (setq str (open "trace.txt" :direction :output))
    Warning: Setting unbound variable STR
    #<File stream "/u/neald/trace.txt">
  3. Set the value of the :trace-output option for the function fac to str .
  4. Call the fac function, and then close the file stream as follows:
CL-USER 138 > (fac 8)
CL-USER 139 > (close str)

Inspect the file trace.txt in order to see the trace output for the call of (fac 8) .

LispWorks User Guide - 11 Mar 2008