rummykhan/xlog 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rummykhan/xlog

Composer 安装命令:

composer require rummykhan/xlog

包简介

A PHP Laravel package to log all the requests coming to your website

README 文档

README

Latest Stable Version

A PHP/Laravel Package to log all the requests, with the exceptions, country and city. It will help you get insight of your visitors activiy. Built on top of torann/geoip and jenssegers/agent

Installation

Install using composer:

composer require rummykhan/xlog

Add Service Providers

Add these two service provider in app/config/app.php:

\Torann\GeoIP\GeoIPServiceProvider::class,
RummyKhan\XLog\XLogServiceProvider::class,

Publish Configuration

Publish the configuration using command:

php artisan vendor:publish

Update geoip database

Update geoip database using command:

php artisan geoip:update

Add Middleware

Add XLogMiddleWare to your app\Http\Kernel.php as a web middleware group:

\RummyKhan\XLog\Http\Middleware\XLogMiddleware::class,

Migrate Log Table ( You don't have to migrate if your database is mongodb.)

Migrate Log Table migration:

php artisan migrate

Configure your application logging behavior

The php artisan vendor:publish will publish Log table migration into migrations folder, geoip.php and xlog.php in config folder of you laravel installation.

Logging Environments

In xlog.php you may specify your igonore_environments as an array, In these environment it will not log any request or response e.g.

'ignore_environments' => ['local', 'test'],

Set Database Type

In xlog.php you may specify your db_type as string. Since laravel supported databases (mysql, sqlite, pgsql) behaves differently than laravel not supported databases, For that purpose I'm using a ProxyModel Which switch the Eloquent Mode based on database type. E.g. For any laravel supported database you can leave it blank, For mongodb you can set it to 'mongo'.

'db_type' => 'mongodb'

Supported database types are (sqlite, mysql, pgsql, mongodb).

DB Connection

In xlog.php you may specify your connection as string. This connection will be used to save the logs. (By default it uses application connection)

'connection' => env('DB_CONNECTION')

Supported database types are (sqlite, mysql, pgsql, mongodb).

DB Table

In xlog.php you may specify the table_name for you logs.

'table' => 'logs'

Log Display Routes

In xlog.php you may specify your routes. For now there are only three routes.

  1. Index: where you can see the logs in tabular format using laravel pagination.
  2. Detail: Where you can see the logs detail.
  3. Delete: You can delete a log.

( You may specify you own routes and controllers in case you want to. All you have to do is Call the RummyKhan\XLog\Models\Log Model to get the logs.)

'routes' => [
    'index'  => [ 'route' => '/admin/logs',      'action' => 'XLogController@index'],        // HTTP Method is GET
    'detail' => [ 'route' => '/admin/logs/{id}', 'action' => 'XLogController@detail'],       // HTTP Method is GET
    'delete' => [ 'route' => '/admin/logs/{id}', 'action' => 'XLogController@delete']        // HTTP Method is DELETE
],

When changing routes, don't change the wildcard {id} from the routes.

Log Middleware

In xlog.php you can specify the middleware for you log routes. By default middleware is set to auth.

'middleware' => ['auth']

MIT Liscense

Laravel rummykhan/xlog is licensed under The MIT License (MIT).

rummykhan/xlog 适用场景与选型建议

rummykhan/xlog 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 107 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 08 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 rummykhan/xlog 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rummykhan/xlog 我们能提供哪些服务?
定制开发 / 二次开发

基于 rummykhan/xlog 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 107
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-19