Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to Codeigniter 4 #21

Merged
merged 18 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 36 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
CodeIgniter Log Viewer
CodeIgniter 4 Log Viewer
=======================

[![Latest Stable Version](https://poser.pugx.org/seunmatt/codeigniter-log-viewer/v/stable)](https://packagist.org/packages/seunmatt/codeigniter-log-viewer) [![Total Downloads](https://poser.pugx.org/seunmatt/codeigniter-log-viewer/downloads)](https://packagist.org/packages/seunmatt/codeigniter-log-viewer) [![License](https://poser.pugx.org/seunmatt/codeigniter-log-viewer/license)](https://packagist.org/packages/seunmatt/codeigniter-log-viewer)
This is a simple Log Viewer for viewing CodeIgniter 4 logs in the browser or via API calls (that returns a JSON response)
savioret marked this conversation as resolved.
Show resolved Hide resolved

This is a simple Log Viewer for viewing CodeIgniter logs in the browser or via API calls (that returns a JSON response)

This project is inspired by the [laravel-log-viewer project](https://github.com/rap2hpoutre/laravel-log-viewer).
This project is a fork of [Codeigniter 3 Log viewer](https://github.com/SeunMatt/codeigniter-log-viewer) by SeunMat
savioret marked this conversation as resolved.
Show resolved Hide resolved

A typical log view looks like this:

Expand All @@ -14,17 +12,14 @@ A typical log view looks like this:
Usage
=====

Requirement
Requirements
-----------
- PHP >= 7.1
- PHP >= 7.2
- Codeigniter 4

Composer Installation
---------------------
Execute:

```
composer require seunmatt/codeigniter-log-viewer
```
*not available yet*
savioret marked this conversation as resolved.
Show resolved Hide resolved

Controller Integration for Browser Display
------------------------------------------
Expand All @@ -35,41 +30,50 @@ All that is required is to execute the `showLogs()` method in a Controller that
A typical Controller *(LogViewerController.php)* will have the following content:

```php
private $logViewer;
namespace App\Controllers;
use CILogViewer\CILogViewer;

public function __construct() {
parent::__construct();
$this->logViewer = new \CILogViewer\CILogViewer();
//...
}

public function index() {
echo $this->logViewer->showLogs();
return;
class LogViewerController extends BaseController
{
public function index() {
$logViewer = new CILogViewer();
return $this->logViewer->showLogs();
}
}
```

Then the route *(application/config/routes.php)* can be configured thus:
Then the route `app/Config/Routes.php` can be configured like:

```php
$route['logs'] = "logViewerController/index";
$routes->add('logs', "logViewerController::index");
savioret marked this conversation as resolved.
Show resolved Hide resolved
```

And that's all! If you visit `/logs` on your browser
you should see all the logs that are in *application/logs* folder and their content
you should see all the logs that are in `writable/logs` folder and their content


Configuration
==============

- The folder path for log files can be configured by adding `clv_log_folder_path` to CodeIgniter's `config.php` file e.g.
Configuration (optional) parameters can be set by adding `$logFolderPath` to a `CILogViewer` class in the CodeIgniter's `Config` folder.
savioret marked this conversation as resolved.
Show resolved Hide resolved

- The folder path for log files can be configured with the `$logFolderPath` config var.

- The file pattern for matching all the log files in the log folder can be configured by adding `$logFilePattern` config var.
- The name of the view that renders the logs page can be changed using the `$viewName` config var. Please note that this can be a route relative to your `View` path or a namespace route.

`$config["clv_log_folder_path"] = APPPATH . "logs";`
Example configuration file `app/Config/CILogViewer.php`:

- The file pattern for matching all the log files in the log folder can be configured by adding
`clv_log_file_pattern` to CodeIgniter's `config.php` file e.g.
```php
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;

`$config["clv_log_file_pattern"] = "log-*.php";`
class CILogViewer extends BaseConfig {
public $logFilePattern = 'log-*.php';
public $viewName = 'myLogViewer/log'
}
```


Viewing Log Files via API Calls
Expand Down Expand Up @@ -207,24 +211,11 @@ SECURITY NOTE
**It is Highly Recommended that you protect/secure the route for your logs. It should not be an open resource!**


Contributions
=============

**Love this library? You can support by [buying me a coffee](http://wallet.ng/pay/ossmatt)** :coffee:

Found a bug? Kindly create an issue for it.

Want to contribute? Submit your pull-request(s)

Remember to :star: star the repo and share with friends

Author
======
Made with :heart: by [Seun Matt](https://smattme.com)
Codeigniter 4 Log Viewer by Miguel Martinez\
Based on the Codeigniter 3 version by by [Seun Matt](https://smattme.com)

CHANGELOG
=========
[Changelog](CHANGELOG.md)

LICENSE
=======
Expand Down
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"name": "seunmatt/codeigniter-log-viewer",
savioret marked this conversation as resolved.
Show resolved Hide resolved
"description": "This is a simple Log Viewer for viewing Code Igniter log files on the browser",
"keywords": ["Code Igniter", "Log Viewer", "PHP"],
"name": "savioret/codeigniter-log-viewer",
"description": "This is a simple Log Viewer for viewing Code Igniter 4 log files on the browser",
"keywords": ["Code Igniter", "Code Igniter 4", "ci4", "Log Viewer", "PHP"],
"license": "MIT",
"github": "https://github.com/SeunMatt/codeigniter-log-viewer",
"github": "https://github.com/savioret/codeigniter-log-viewer",
"authors": [
{
"name": "Miguel Martinez",
"email": "rodilla@gmail.com"
},
{
"name": "Seun Matt",
"email": "smatt382@gmail.com"
Expand Down
Loading