PHPackages                             xiaoyukarl/xlog - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. xiaoyukarl/xlog

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

xiaoyukarl/xlog
===============

不依赖框架的日志读取和储存的类

v1.0.1(6y ago)017MITPHPPHP &gt;=5.4.0

Since Jul 22Pushed 6y agoCompare

[ Source](https://github.com/xiaoyukarl/xLog)[ Packagist](https://packagist.org/packages/xiaoyukarl/xlog)[ RSS](/packages/xiaoyukarl-xlog/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (1)Used By (0)

xLog
----

[](#xlog)

此包大部分思想参考 arcanedev/log-viewer, 如有雷同,纯属抄袭

因公司有多个项目是使用其他框架开发, 日志查看十分不方便, 因此参考log-viewer写一个相对通用的日志工具.

若条件许可,各位最好使用elasticsearch + kibana, es提供日志储存,kibana提供视图查看和分析

#### 使用说明

[](#使用说明)

##### 获取此包

[](#获取此包)

`composer require xiaoyukarl/xlog`

##### 修改配置文件

[](#修改配置文件)

```
    'storagePath' => __DIR__.'/../logs/',//日志保存目录, 请修改为你的项目日志保存目录
    'viewsPath' => __DIR__.'/../resources/views/',//模板目录, 如需修改请将文件夹复制到你的项目模板目录
    'staticPath' => '/resources/static/',//静态文件目录, 必须修改,否则无法读取

    /* -----------------------------------------------------------------
    |  为了适配不同的框架,需要重新定义下面几个url
    | -----------------------------------------------------------------
    */
    'dashboardUrl' => 'http://xlog.test/test/dashboard.php/',//仪表台url
    'logListUrl' => 'http://xlog.test/test/logs.php/',//日志文件列表url
    'showUrl' => 'http://xlog.test/test/show.php/',//详情url
    'downloadUrl' => 'http://xlog.test/test/download.php/',//下载url
    'deleteUrl' => 'http://xlog.test/test/delete.php/',//删除url

```

##### 写日志

[](#写日志)

```
//示例,支持静态方法
//'emergency','alert','critical','error','warning','notice','info','debug'

\Xlog\Lib\LogWriter::log('debug','message', ['context'=>'this is context']);
\Xlog\Lib\LogWriter::debug('message', ['context'=>'this is context']);

```

##### 图片展示

[](#图片展示)

[![参考 logviewer 重写了一个日志读写包](https://camo.githubusercontent.com/94fa7b8ec656f9c3fb14fc306633d869cae494f666c309894d340274719451f3/68747470733a2f2f7468756d626e61696c302e62616964757063732e636f6d2f7468756d626e61696c2f33386639393730623632363535353333326464326463306338623161343566643f6669643d313538353231333732352d3235303532382d3135353432313130383637383137342672743d7072267369676e3d4644544145522d44436237343063636335353131653565386665646366663036623038313230332d44536a31357566546d25326276683544422532624f5a746d36494976586d6325336426657870697265733d38682663686b62643d302663686b763d302664702d6c6f6769643d353039303539313330303238363732313533342664702d63616c6c69643d302674696d653d313536353233333230302673697a653d63313434305f75393030267175616c6974793d39302676756b3d313538353231333732352666743d696d616765266175746f706f6c6963793d31)](https://camo.githubusercontent.com/94fa7b8ec656f9c3fb14fc306633d869cae494f666c309894d340274719451f3/68747470733a2f2f7468756d626e61696c302e62616964757063732e636f6d2f7468756d626e61696c2f33386639393730623632363535353333326464326463306338623161343566643f6669643d313538353231333732352d3235303532382d3135353432313130383637383137342672743d7072267369676e3d4644544145522d44436237343063636335353131653565386665646366663036623038313230332d44536a31357566546d25326276683544422532624f5a746d36494976586d6325336426657870697265733d38682663686b62643d302663686b763d302664702d6c6f6769643d353039303539313330303238363732313533342664702d63616c6c69643d302674696d653d313536353233333230302673697a653d63313434305f75393030267175616c6974793d39302676756b3d313538353231333732352666743d696d616765266175746f706f6c6963793d31)

[![参考 logviewer 重写了一个日志读写包](https://camo.githubusercontent.com/79961158b4833daabdbf0b2e6c46e49b34139840c326b066686c5c83857a9c2b/68747470733a2f2f7468756d626e61696c302e62616964757063732e636f6d2f7468756d626e61696c2f30313036393234316430373933363439323561663430376233626361663466393f6669643d313538353231333732352d3235303532382d3836333134303538323335363334322672743d7072267369676e3d4644544145522d44436237343063636335353131653565386665646366663036623038313230332d73774b477a336b4d4a6a5a4b787042456d5a6a77747a437238455925336426657870697265733d38682663686b62643d302663686b763d302664702d6c6f6769643d353039303539313330303238363732313533342664702d63616c6c69643d302674696d653d313536353233333230302673697a653d63313434305f75393030267175616c6974793d39302676756b3d313538353231333732352666743d696d616765266175746f706f6c6963793d31)](https://camo.githubusercontent.com/79961158b4833daabdbf0b2e6c46e49b34139840c326b066686c5c83857a9c2b/68747470733a2f2f7468756d626e61696c302e62616964757063732e636f6d2f7468756d626e61696c2f30313036393234316430373933363439323561663430376233626361663466393f6669643d313538353231333732352d3235303532382d3836333134303538323335363334322672743d7072267369676e3d4644544145522d44436237343063636335353131653565386665646366663036623038313230332d73774b477a336b4d4a6a5a4b787042456d5a6a77747a437238455925336426657870697265733d38682663686b62643d302663686b763d302664702d6c6f6769643d353039303539313330303238363732313533342664702d63616c6c69643d302674696d653d313536353233333230302673697a653d63313434305f75393030267175616c6974793d39302676756b3d313538353231333732352666743d696d616765266175746f706f6c6963793d31)

[![参考 logviewer 重写了一个日志读写包](https://camo.githubusercontent.com/729b19b01169e3345a81463422117468da49b0340e9b844b47965b077c809aa6/68747470733a2f2f7468756d626e61696c302e62616964757063732e636f6d2f7468756d626e61696c2f35623531343864303936353735646435376235623135326232663361646332323f6669643d313538353231333732352d3235303532382d3832313832383939313936383339352672743d7072267369676e3d4644544145522d44436237343063636335353131653565386665646366663036623038313230332d253262386d373979376133304b584c4e486a384e755549785237727a6725336426657870697265733d38682663686b62643d302663686b763d302664702d6c6f6769643d353039303539313330303238363732313533342664702d63616c6c69643d302674696d653d313536353233333230302673697a653d63313434305f75393030267175616c6974793d39302676756b3d313538353231333732352666743d696d616765266175746f706f6c6963793d31)](https://camo.githubusercontent.com/729b19b01169e3345a81463422117468da49b0340e9b844b47965b077c809aa6/68747470733a2f2f7468756d626e61696c302e62616964757063732e636f6d2f7468756d626e61696c2f35623531343864303936353735646435376235623135326232663361646332323f6669643d313538353231333732352d3235303532382d3832313832383939313936383339352672743d7072267369676e3d4644544145522d44436237343063636335353131653565386665646366663036623038313230332d253262386d373979376133304b584c4e486a384e755549785237727a6725336426657870697265733d38682663686b62643d302663686b763d302664702d6c6f6769643d353039303539313330303238363732313533342664702d63616c6c69643d302674696d653d313536353233333230302673697a653d63313434305f75393030267175616c6974793d39302676756b3d313538353231333732352666743d696d616765266175746f706f6c6963793d31)

- 目录说明

```

 ├─xLog                扩展包根目录
 │  ├─config                    扩展包代码目录
 │  │  ├─xlog-config.php    配置文件
 │  ├─logs   临时日志保存目录
 │  ├─resources     资源文件目录
 │  │  ├─static
 │  │  │  ├─fonts     字体库
 │  │  │  ├─bootstrap.min.css
 │  │  │  ├─bootstrap.min.js
 │  │  │  ├─Chart.min.js
 │  │  │  ├─font-awesome.min.css
 │  │  │  ├─googleapis.css
 │  │  │  ├─jquery-3.2.1.min.js
 │  │  │  ├─popper.min.js
 │  │  ├─views
 │  │  │  ├─dashboard.html   仪表台模板
 │  │  │  ├─footer.html
 │  │  │  ├─header.html
 │  │  │  ├─logs.html   日志文件列表
 │  │  │  ├─show.html   日志文件内容
 │  ├─src                   测试目录
 │  │  ├─Entities
 │  │  │  ├─Controller.php     集合类
 │  │  │  ├─Log.php    日志类
 │  │  │  ├─LogCollection.php    日志文件集合类
 │  │  │  ├─LogEntity.php    日志实体类
 │  │  │  ├─LogEntityCollection.php     日志集合
 │  │  ├─Http
 │  │  │  ├─LogController.php     控制器
 │  │  ├─Lib
 │  │  │  ├─Config.php     配置文件类
 │  │  │  ├─Helpers.php    公共方法
 │  │  │  ├─LogParser.php     日志处理类
 │  │  │  ├─LogWriter.php     写日志类
 │  │  │  ├─Page.php     分页类
 │  │  │  ├─Xlog.php     日志处理类
 │  ├─test    测试目录
 │  │  ├─dashboard.php  仪表台测试文件
 │  │  ├─delete.php     删除日志测试文件
 │  │  ├─download.php     下载日志测试文件
 │  │  ├─logs.php     日志列表测试文件
 │  │  ├─show.php     日志详细测试文件
 │  ├─.gitignore
 │  ├─composer.json
 │  ├─LICENSE
 │  └─README.md

```

License
-------

[](#license)

[Apache License 2.0](./LICENSE)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2484d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83313e5c6f2761172c5589687d0ad55718e958b5c46597e3c84751d240f7e4c7?d=identicon)[xiaoyukarl](/maintainers/xiaoyukarl)

---

Top Contributors

[![xiaoyukarl](https://avatars.githubusercontent.com/u/24753149?v=4)](https://github.com/xiaoyukarl "xiaoyukarl (20 commits)")

---

Tags

phplog viewerxlog

### Embed Badge

![Health badge](/badges/xiaoyukarl-xlog/health.svg)

```
[![Health](https://phpackages.com/badges/xiaoyukarl-xlog/health.svg)](https://phpackages.com/packages/xiaoyukarl-xlog)
```

###  Alternatives

[inspector-apm/inspector-symfony

Code Execution Monitoring for Symfony applications.

2830.1k2](/packages/inspector-apm-inspector-symfony)[melihovv/laravel-log-viewer

A Laravel log viewer

1231.5k1](/packages/melihovv-laravel-log-viewer)[eduardoarandah/backpacklogviewer

Integrate ArcaneDev/LogViewer in your Laravel-Backpack project

264.5k1](/packages/eduardoarandah-backpacklogviewer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
