Jump to content

Recommended Posts

  • 1 year later...

Thanks for coming back. Pretty much all Opusmodus functions calls are traced (https://en.wikipedia.org/wiki/Tracing_(software)) in the listener, when they are called. (Apologies if the link is over the top, just want to clarify.)

 

Example, which causes a trace of rnd-pick.

 

(loop repeat 10
  collect (rnd-pick '(1 2 3)))

 

I understand that this can be very useful for debugging, in particular if further information is shown like the function arguments etc., but I would like to disable it by default. Is that possible perhaps?

 

BTW: Below is the definition of a very similar tracing function, that allows to control which functions are currently traced, or to switch of tracing globally.

 

Best,

Torsten

 

(defvar *dbg-ids* NIL "Identifiers used by dbg")

;; was once named debug, but symbol debug is already defined in common-lisp (see opimize)
(defun dbg (id format-string &rest args)
  "Print debugging info if (DEBUG ID) has been specified"
  (when (member id *dbg-ids*)
    (fresh-line *debug-io*)
    (apply #'format *debug-io* format-string args)))

(defun start-debug (&rest ids) 
  "Start debug output on the given ids."
  (setf *dbg-ids* (union ids *dbg-ids*)))

(defun stop-debug (&rest ids) ; was once named undebug
  "Stop debug on ids. With no ids stop debugging altogether."
  (setf *dbg-ids* (if (null ids) NIL
                      (set-difference *dbg-ids* ids))))


#| ; demo
(defun test (x)
  (tu:dbg 'test "test")
  (list x x))

(tu::start-debug 'test)

(loop repeat 10
  collect (test 1))

(tu::stop-debug) 

|#

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy