Logger

Purpose

The logger is used for outputting data on the terminal. It allows filtering for log tags to make development easy and also offers some functionality to log error codes into ram.

Functionality

The logger can be used for printing log output to the terminal using the logt macro. With the logjson macro, it is possible to log a json for machine to machine communication. This logging can be removed from the compiled firmware by undefining the ENABLE_LOGGING macro or the ENABLE_JSON_LOGGING macro. Another function called trace will log a string without adding additional information such as the time or the place where the log statement was used.

The logger also has functionality for logging events to the RAM, e.g. logError or logCustomError. These will record the time and the error code into ram. Using logCustomCount allows you to increase the value each time the method is called. These error codes can be queried using the get_errors command of the StatusReporterModule. Once the error codes have been requested, the error log will be cleared.

Terminal Commands

Toggling log tags

When you want to enable or disable a specific logTag, you can toggle it with the following command. A few log tags such as ERROR or WARNING are always logged to the terminal.

debug [tagName]

//E.g. toggle logging for the node
debug node

//E.g. toggle logging for all logs
debug all

Viewing all active log tags

To get a list of all enabled log tags, use the following command:

debugtags