hi2rashid/codeigniter-log-viewer

这是一个简单的日志查看器,用于在浏览器中查看Code Igniter的日志文件

v1.1.0 2018-11-07 05:22 UTC

This package is not auto-updated.

Last update: 2024-09-30 10:24:25 UTC


README

Codeigniter应用程序生成的日志查看器。支持CI v3.1.9

灵感来源于 https://github.com/SeunMatt/codeigniter-log-viewer

变更日志

发布版本:v1.0.0 日期:2018年7月18日

  • 您可以通过传递路径作为构造函数来更改日志查看器路径。

如何使用它

使用composer安装

composer require hi2rashid/codeigniter-log-viewer

将以下代码行复制到您的任何Codeigniter控制器中

方法1 ()

Welcome.php 控制器中

public function index() {
    $CILogs = new \CILogViewer\CILogViewer("/var/log/localhost/");
    echo $CILogs->showLogs();
    return;
}

方法2 ()

Welcome.php 控制器中

public function index() {
    $CILogs = new \CILogViewer\CILogViewer($this->config->item('ci_log_path'));
    echo $CILogs->showLogs();
    return;
}

application/config/config.php 配置文件中

$config['ci_log_path'] = "/var/log/localhost/ci_log_path"

您还需要确保创建了目录 /var/log/localhost/ci_log_path 并且可写

在终端中: sudo mkdir -p /var/log/localhost/ci_log_path sudo chmod -Rf 777 /var/log/localhost/ci_log_path(请确保不要在生产系统中使用777)

自动刷新日志查看页面

只需附加 ?rt=5000(例如: https:///codeigniter/welcome/logviewer?rt=5000)(5秒)