|
Tezzeret
1
Tezzeret
|
class Geometrics::GmLog is really a name space for a set of static logging functions. The default behavior is to open a file named "Geometrics.log" on the main user-accessible file storage on an embedded device (USB drive or SD card) and then to log error messages. More...
#include <GmLog.hpp>
Public Member Functions | |
| virtual int | IsDataStorage () |
Static Public Member Functions | |
| static int | OpenLogFile (const char *logFileName, const char *serialNumber, const char *firmwareName, const char *firmwareVersion, const char *ssid) |
| static int | CloseLogFile () |
| static int | FlushLog () |
| static int | LogMessage (const char *message) |
| The main entry point into the logging system. See the notes for this class (Geometrics::GmLog) about logging practices. Many of the calls to this function find their way through a chain of C calls, rather than directly to LogMessage. | |
class Geometrics::GmLog is really a name space for a set of static logging functions. The default behavior is to open a file named "Geometrics.log" on the main user-accessible file storage on an embedded device (USB drive or SD card) and then to log error messages.
This system does not include dynamic logging; the choice about what to log is made at compile time.
There are 2 common uses for the logging system:
The first use is exemplified by the "System power on" message that's logged when the log file is first opened, and by the various other startup messages showing that various features have been started, network connected, etc.
The second use is exemplified by the many logging messages found in the network daemon code in daemon.c. In this case, the calls to Geometrics::GmLog::LogMessage aren't found in that file (it's a C file that doesn't know about C++ classes even), but are relayed through a macro "traceComment", which calls another C function, which eventually finds its way into Geometrics::GmLog::LogMessage. When the logging is needed in order to debug some functionality in the network daemon, the macro is turned on, and the log gets tons of debugging messages about the network daemons. When this specific logging isn't needed, the macro is turned off, and the calls to traceComment are no-ops.