How do I write to the log?

Yeah, a bit of reverse engineering needed. Basically it is JSON, but with few mandatory fields, e.g. example from preview generator:

Where

  • reqid is some random unique string for the transaction, e.g. reqId=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c20)
  • user is user, or none if script executed globally
  • app is an application name that works
  • url basically is the message body and here you can put whatever output you need
  • level in your case could be debug
  • time is a timestamp in standard +%Y-%m-%dT%H:%M:%S%:z or customized in config.php format.

UPDATE:

Sorry, I see that you asked from the PHP api…