Error handling and logging
Most functions in the Azure Sphere custom application libraries (applibs) return -1 to indicate failure and zero or a positive value to indicate success. In case of failure, the function sets the value of the errno
variable to the POSIX error that corresponds to the failure. Applications must include the errno.h header file, which defines this variable. The errno
variable is global per thread.
Applications can log errors in the following ways:
During debugging, use the Log_Debug() or Log_DebugVarArgs() function to write a debug message to the Device Output window in the IDE. The format for the message is the same as that for printf.
During execution, send messages to an Azure IoT Hub. See Using Microsoft Azure IoT for details.