User Tools

Site Tools


dev:logging_and_debugging

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:logging_and_debugging [2014/09/28 09:33] ackleydev:logging_and_debugging [2014/09/28 11:34] (current) ackley
Line 4: Line 4:
  
   * The simulator has a logging system accessed via the static object ''LOG''.   * The simulator has a logging system accessed via the static object ''LOG''.
-  * The logging system has a 'level' determining how much output is desired.  The level can be set on the command line by the ''-l NUM'' switch, where ''NUM'' can range from 0 (for the least output) to (for the most output).+  * The logging system has a 'level' determining how much output is desired.  The level can be set on the command line by the ''-l NUM'' switch, where ''NUM'' can range from 0 to 8.  ''-l 0'' on the command line produces the least output, ''-l 8'' produces the most.
   * The logging levels have names and numbers: NONE(0), ERROR(1), WARNING(2), MESSAGE(3), DEBUG(4), DEBUG1(5), DEBUG2(6), DEBUG3(7), and ALL(8).    * The logging levels have names and numbers: NONE(0), ERROR(1), WARNING(2), MESSAGE(3), DEBUG(4), DEBUG1(5), DEBUG2(6), DEBUG3(7), and ALL(8). 
   * The logging code provides direct methods for producing output at levels ERROR, WARNING, MESSAGE, and DEBUG.  For example: <code cpp>LOG.Debug("Hi there");</code> prints 'Hi there' to the console and the logging buffer (whose display is toggled by 'l' in the GUI) -- **if** the logging level is 4 or larger.   * The logging code provides direct methods for producing output at levels ERROR, WARNING, MESSAGE, and DEBUG.  For example: <code cpp>LOG.Debug("Hi there");</code> prints 'Hi there' to the console and the logging buffer (whose display is toggled by 'l' in the GUI) -- **if** the logging level is 4 or larger.
Line 23: Line 23:
 if the logging level was 3 or higher. if the logging level was 3 or higher.
   * Note the logger adds a newline at the end of each log message, so typically it's expected that each log message will be a single line.   * Note the logger adds a newline at the end of each log message, so typically it's expected that each log message will be a single line.
-  * Use %d for both signed and unsigned ints; there is no '%u'+  * Use %d for both signed and unsigned ints; there is no '%u'.  (Or use %x or %o)
-  * Grep around in the codebase for examples!+  * Grep around in the codebase for 'LOG' to find lots of examples!
dev/logging_and_debugging.1411896827.txt.gz · Last modified: 2014/09/28 09:33 by ackley