aseemann/php-livelog
Composer 安装命令:
composer require aseemann/php-livelog
包简介
Livelogger for your php projects. See the logs you send to the writer your request.
README 文档
README
What it does
This small tool should simplify the developer's life by offering the possibility to follow the logs of a web application live.
You don't have to tail and grep the logfiles direct on the machine or to download it.
The logs will only be written for the current session, so you see only the log of your own requests.
Install
The suggested install-method is to use composer composer req aseemann/php-livelog.
After installing the package you have to set a symlink to the web folder in your public
directory e.g. ln -s vendor/aseemann/php-livelog/web docroot/livelog
Now you can open the log dashboard in your webbrowser under the path of the symlinks.
e.g domian.tld/livelog
For easier setup you can add this to your composer.json file in the scripts section.
{
"scripts": {
"set-symlinks": [
"ln -sfT ../vendor/aseemann/php-livelog/web docroot/livelog"
],
"post-install-cmd": [
"@set-symlinks"
],
"post-update-cmd": [
"@set-symlinks"
]
}
}
How to use
To send logs to the log page integrate the logger into your scripts as described below.
$logger = new \ASeemann\PhpLiveLog\Logger('Application Name', 'LoggerName'); $logger->info('A small info massage'); $logger->notice('Some notice', ['data' => 'data for notice']);
Afterward the logs should appear on the logging page grouped by the request.
Connectors
For the easy integration in some projects there are also connectors available. So you only have to add some configuration in your application and all logs of your app will appear on the logging page.
TYPO3
Add the following lines to your AdditionalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['FE']['debug'] = true; $GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] = true; $GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG'] = true, $GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_errorDLOG'] = true, $GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_exceptionDLOG'] = true, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'] = 0, if (false === is_array($GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::DEBUG])) { $GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::DEBUG] = []; } $GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::DEBUG] [\ASeemann\PhpLiveLog\Connector\TYPO3\LogWriter::class] = [ ]; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'] = []; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'][] = \ASeemann\PhpLiveLog\Connector\TYPO3\DevLogger::class . "->devLogger";
The lines you take from here may vary depending on you typo3 installation.
You have also the possibility to exclude some loggers. So you can keep the focus on what you
want to see. To exclude the logger pass the option ignorePattern to the log-writer.
Example: (Ignore all logger wich contains Frontend in their names )
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::DEBUG] [\ASeemann\PhpLiveLog\Connector\TYPO3\LogWriter::class] = [ 'ignorePattern' => '.*Frontend.*' ];
Todos
- Add formatter for context
- escape tags in context
- Add more connectors.
aseemann/php-livelog 适用场景与选型建议
aseemann/php-livelog 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 984 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 12 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 aseemann/php-livelog 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aseemann/php-livelog 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 984
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2021-12-18
