I feel stupid for even asking, but how can I get my API code to write debug logs? The docs here are remarkably obtuse.
https://docs.nextcloud.com/server/latest/developer_manual/basics/logging.html?highlight=logging
I feel stupid for even asking, but how can I get my API code to write debug logs? The docs here are remarkably obtuse.
https://docs.nextcloud.com/server/latest/developer_manual/basics/logging.html?highlight=logging
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 globallyapp
is an application name that worksurl
basically is the message body and here you can put whatever output you needlevel
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…
Hah yes, in the PHP code. I was trying to add some debugging to the REST API controller, but can’t figure out how to get access to the $logger
. I made do with throwing an exception, but that’s going to make debugging harder.