All Manuals > LispWorks® User Guide and Reference Manual > 5 The Trace Facility

5.4 Tracing methods

You can also trace methods (primary and auxiliary) within a generic function. The following example shows how to specify any qualifiers and specializers.

  1. Type the following methods into the listener:
    (defmethod foo (x) 
      (print 'there))
     
    (defmethod foo :before ((x integer))
      (print 'hello))
    
  2. Next, trace only the second of these methods by typing the following definition spec.
    (trace (method foo :before (integer)))
    
  3. Test that the trace has worked by calling the methods in the listener:
    CL-USER 226 > (foo 'x)
     
    THERE 
    THERE
     
    CL-USER 227 > (foo 4)
    0 (METHOD FOO :BEFORE (INTEGER)) > (4)
     
    HELLO 
    0 (METHOD FOO :BEFORE (INTEGER)) < (HELLO)
     
    THERE 
    THERE
     
    CL-USER 228 > 
    

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:18