philsturgeon/codeigniter-restserver — pull request #270 by newjueqi (2014-01-09 00:54:37+00:00)
Title: add debug log to restful controller

when debug api, i found it hard to debug ,so I write some debug funtion to log debug info.

how to use:

add following code in config.php
$config['log_api_request_response'] = 1;

and modify $config['log_threshold'] to 3 (debug level)

then we can see the log in application/logs .

for example:

we can see the request like following in log:

DEBUG - 2014-01-09 00:20:23 --> POST /api/account/set_client_id HTTP/1.1
CONTENT-LENGTH: 81
CONTENT-TYPE: application/x-www-form-urlencoded
HOST: test.com
CONNECTION: Keep-Alive
USER-AGENT: android-async-http/1.4.3 (http://loopj.com/android-async-http)
ACCEPT-ENCODING: gzip

token=7bfba7c62de28dd654&client_id=a1e88040e4285d4a42e9f2044cc4b5f8

also ,we can see result like following:

DEBUG - 2014-01-09 00:20:23 --> POST /api/account/set_client_id HTTP/1.1
DEBUG - 2014-01-09 00:20:23 --> {"status":1,"info":"","size":0,"data":[]}