Follow up questions for this solution: https://stackoverflow.com/a/31883204/3548238
- If i want to log the request in "onRespond()" event, how can i access to the status code? For example: if request responds with status code 200, i'd want to log "success = 1" and if its something else, then "success = 0"
- Can i somehow access the message, if my API throws exception with "throw new RestException(404, "Example not found");" or if auth failed or whatever the cause is.
- Can i/how can i make some of the requests so that they wont be logged in any situation? I know i should create some kind of annotation for it, but: how?
For example something like this:
/**
*
* @status 200
*
* @description Get all logs
* @url GET logs
* @access protected
* @class AccessControl {@requires admin}
*
* @log false
*
* @throws RestException
*/
public function list_all_logs() {
...
...