Logging

Logging

We use a special logging library. To use it, #include "log.h". It implements the logging function we primarily use LOG_DEBUG, which is like printf in that anything printf does, LOG_DEBUG does too. This is because LOG_DEBUG is just a wrapper around printf, but provides information on what file and line number the LOG_DEBUG is being called from. Note that a \n should always be included at the end of a LOG_DEBUG call.

Here’s some examples:

LOG_DEBUG("Testing!\n"); // Output: Testing! LOG_DEBUG("Printing numbers: %i, %i\n", 1, 4); // Output: Printing numbers: 1, 4 LOG_DEBUG("Printing in hex: %x, %x\n", 20, 18); // Output: Printing in hex: 14, 12 // To more clearly show hex, do this: LOG_DEBUG("Good printing in hex: 0x%x\n", 20); // Output: Good printing in hex: 0x14

For more information on printing, look at any reference for the C function printf.