Posts a message to the impCentral™ device log
Device + Agent
The message to be logged
Integer — 0 on success, or a Send Error Code on failure
This method logs a message to the server-side, per-device log file. The message is automatically timestamped by the server, and is displayed in impCentral’s device log.
server.log() assumes that you are passing valid UTF-8 code sequences. If it doesn’t recognize the string as UTF-8, it will convert it to binary.
If the imp has been disconnected from the server and the current network interface disabled, typically with a server.disconnect() call, any subsequent use of server.log() may cause the imp’s current network interface to be powered back on and a connection to be established with the Electric Imp impCloud™. This occurs when SUSPEND_ON_ERROR has been selected as the imp’s timeout policy. If the policy has been set to RETURN_ON_ERROR, however, the current network interface will not be re-enabled until your code calls server.connect(). Log messages posted between the disconnection and subsequent re-connection will be lost; the method will return the value SEND_ERROR_NOT_CONNECTED.
For more information on debugging disconnected devices, see the guide Debugging Disconnected Applications.
For more information on imp timeout policies, see the server.setsendtimeoutpolicy() documentation.