Using trace() to view data for debugging

Why not use print() to debug?

The first impression when using trace() and print() is that the results are identical, and it is true that the Annotations that they produce are the same:

Screen Shot 2014-05-27 at 15.58.22

However there is one major difference when you run the channel, print() creates a informational Iguana Log entry but trace() does not. So to prevent the Log from being cluttered with debugging information we recommend that you use trace().

I ran 200 sample messages through the channel and the print statement created 200 informational message entries in the log. The last three messages are shown above. As you can see this is not desirable behaviour, particularly if you are processing tens of thousands of messages per day.

Note: The Iguana queue is not active in the editor (test mode). So the log messages from print() are only created when the channel is run.

Tip: A better way to create informational messages is to use the Iguana logging functions. These give you control over which type of message you want to create.

  • logDebug : Add a log entry (Debug) with the given text.
  • logError : Add a log entry (Error) with the given text.
  • logInfo : Add a log entry (Info) with the given text.
  • logWarning : Add a log entry (Warning) with the given text.