I am new to code igniter and PHP5. From the following url http://techtots.blogspot.in/2011/12/logging-request-parameters-in.html i am trying to create a logger where it logs all the request into a table.My question is where should the following code reside.And how will i specify the table name.
class Logger {
private $CI;
public function __construct() {
$this->CI =& get_instance();
}
public function request_logger() {
$uri = $this->CI->uri->uri_string();
$params = trim(print_r($this->CI->input->post(), TRUE));
log_message('info', '==============');
log_message('info', 'URI: ' . $uri);
log_message('info', '--------------');
log_message('info', $params);
log_message('info', '==============');
}
}
You have to create a library for this code
And modify it with:
or create constant variable in application/config/constants.php for specify a table name.