PHP code example of virdiggg / log-parser-ci3
1. Go to this page and download the library: Download virdiggg/log-parser-ci3 library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
virdiggg / log-parser-ci3 example snippets
defined('BASEPATH') or exit('No direct script access allowed');
use Virdiggg\LogParserCI3\MYViewer;
class App extends CI_Controller
{
public $logs;
public function __construct()
{
parent::__construct();
$this->logs = new MYViewer();
}
public function logs()
{
// Log path
$this->logs->setPath(APPPATH . 'logs');
// Log extension
$this->logs->setExt('php');
$filterDate = $this->input->post('date') ? $this->input->post('date') : '2023-01-01';
$this->logs->setName('log-' . $filterDate);
$result = $this->logs->getLogs();
echo json_encode($result);
return;
}
}