log.publish

The log.publish command is used to publish a log entry for a Thing.

TR50 Request

{
  "cmd": {
    "command": "log.publish",
    "params": {
      "thingKey": "mything",
      "msg": "Log message"
    }
  }
}

Request Parameters

Name Type Required Description
thingKey String Identifies the Thing to which the log entry is to be associated. Defaults to the current session's Thing.
ts String The timestamp to be associated with the log entry. Defaults to the current time.
msg String Yes The message to publish to the log.
level Integer The log level. Defaults to 2. The log levels are 0 (Error), 1 (Warning), and 2 (Information).
corrId String The correlation identifier to be associated with the log entry.
global Boolean If set to true the log entry is global, otherwise it will be associated with the thingKey.

TR50 Response

If the command is sent successfully a success message is returned. Otherwise, an error and error message will be returned.

{
  "cmd": {
    "success": true
  }
}

C API

// basic API
int tr50_log_publish(void *tr50, const char *msg);
 
// extended API
int tr50_log_publish_ex(void *tr50, const char * msg, void* optional_params, void** optional_reply,char** error_msg);

JAVA API

// Synchronous
int publish(String thingKey, String ts, Integer level, String corrId, String msg, Object response);
 
// Asynchronous
int publish(String thingKey, String ts, Integer level, String corrId, String msg, DwOpenReceiveActionListener recv, Object response);

Response Objects:  StringReplyDwOpenResponse