dev:logging_and_debugging
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:logging_and_debugging [2014/09/28 08:44] – ackley | dev:logging_and_debugging [2014/09/28 11:34] (current) – ackley | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Logging and Debugging ====== | ====== Logging and Debugging ====== | ||
- | Here are a few quick tips on getting logging output from the simulator. | + | Here are a few quick notes on getting logging output from the simulator. |
- | + | ||
- | ===== Key concepts ===== | + | |
* The simulator has a logging system accessed via the static object '' | * The simulator has a logging system accessed via the static object '' | ||
- | * The logging system has a ' | + | * The logging system has a ' |
* 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. | + | * The logging code provides direct methods for producing output at levels ERROR, WARNING, MESSAGE, and DEBUG. |
- | * '' | + | * '' |
+ | <code cpp> | ||
+ | virtual void Behavior(EventWindow< | ||
+ | { | ||
+ | T self = window.GetCenterAtom(); | ||
+ | LOG.Message(" | ||
+ | window.GetCenterInTile().GetX(), | ||
+ | window.GetCenterInTile().GetY(), | ||
+ | self.GetType(), | ||
+ | "so there" | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | might print something like '' | ||
+ | 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. | ||
+ | * Use %d for both signed and unsigned ints; there is no ' | ||
+ | * Grep around in the codebase for ' |
dev/logging_and_debugging.1411893897.txt.gz · Last modified: 2014/09/28 08:44 by ackley