Activity Log is a Codeigniter library used to record activity on a website and to fetch the results for reporting purposes.
- Is easy to Use
- Simple syntax for adding and fetching records
- Standalone library for use on any kind of website
Logger requires Codeigniter version 3 to run.
- Copy library (Logger.php) into your
/application/libraryfolder. - Import logger.sql into your database (or manually create the table).
To manually create the table run the following command in your MySql command prompt:
CREATE TABLE `logger` ( `id` bigint(20) NOT NULL AUTO_INCREMENT,
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_by`int(11) NOT NULL,
`type` varchar(255) NOT NULL,
`type_id` bigint(20) NOT NULL,
`token` varchar(255) NOT NULL,
`comment` text NOT NULL );
ALTER TABLE `logger` ADD PRIMARY KEY (`id`);You can change the field names in the library by altering the following lines in Logger.php
private $table_fields = array(
'id' => 'id', //Value will be Actual table field
'created_on' => 'created_on',
'created_by' => 'created_by',
'type' => 'type',
'type_id' => 'type_id',
'token' => 'token',
'comment' => 'comment',
);To load the logger library add the following
$this->load->library('logger');Log Activity
$this->logger
->user(1) //Set UserID, who created this Action
->type('post') //Entry type like, Post, Page, Entry
->id(1) //Entry ID
->token('delete') //Token identify Action
->log(); //Add Database EntryGet Entry
$this->logger
->user(1) //Add Only If you want user specific Entry
->type('post') //Add Only If you want type specific Entry
->id(1) //Add Only If you want typeID specific Entry
->token('delete') //Add Only If you want token specific Entry
->get(); //Get All EntryWant to contribute? Great! Just fork, clone, and start working, submit a pull request when you are ready. Or You can join our team at codelab7
- Advance testing
- Add other important fields
GPL 3.0
Free Software, Hell Yeah!