toanlk / codeigniter_telescope
Codeigniter的简单日志查看器
0.1.0
2020-02-28 04:14 UTC
Requires
- php: >=5.4.8
README
安装
通过composer安装
composer require toanlk/codeigniter_telescope
自动加载
编辑application/config/config.php文件
$config['composer_autoload'] = FALSE;
↓
$config['composer_autoload'] = realpath(APPPATH . '../vendor/autoload.php');
可以通过在Codeigniter的config.php文件中添加clv_log_folder_path来配置日志文件的文件夹路径,例如。
$config['ci_telescope_log_folder_path'] = STORAGE_PATH.'/storage/logs/';
集成
只需在映射到路由的Controller中执行show()方法即可。
一个典型的Controller(Logs.php)将包含以下内容
class Logs extends CI_Controller
{
private $logViewer;
public function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->logViewer = new \CI_Telescope\CI_Telescope();
}
public function index()
{
echo $this->logViewer->show();
}
// --------------------------------------------------------------------
public function get_last_logs()
{
echo $this->logViewer->get_last_logs();
}
}