chameleon-m/phalcon-logger 问题修复 & 功能扩展

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

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

chameleon-m/phalcon-logger

Composer 安装命令:

composer require chameleon-m/phalcon-logger

包简介

Phalcon logger

README 文档

README

Latest Version Software License Total Downloads Build Status

How to install

Using Composer (recommended)

Best way to install skeleton would be Composer, if you didn't install it

Run code in the terminal:

composer create-project Chameleon-m/phalcon-logger /path/to/install

Using Git

First you need to clone the project, update vendors:

git clone https://github.com/Chameleon-m/phalcon-logger.git ./project
cd project
composer update

DB

For PostgreSQL:

psql -h <host> -d <database> -U <user_name> -p <port> -a -w -f tests/_data/dump.sql

Or run migration (use phalcon devtools): phalcon migration run

Two methods are available:

POST /api/logs

POST /api/logs?queue=1 - push in queue (for save need run task php cli.php logs queue -v -t )

The data in it is passed to json. For example:

POST curl -X POST -d '{"entity":"Event","entityId":1000,"date":"2017-12-12 12:12:12","userId":3,"action":"create","diff":{"before":"test1","after":"test2"}}' http://phalcon-logger.dev/api/logs

{
    "entity": "Event",
    "entityId": 1000,
    "date": "2017-12-12 12:12:12",
    "userId": 3,
    "action": "create",
    "diff": {
        "before": "test1",
        "after": "test2"
    }
}

The date is passed in the Postgresql timestamp format.

GET /api/logs

Possible filters for the query:

  • from - paired filter from to. Indicates the date on which the filtering starts.
  • to - paired filter with from. Indicates the date the filtering ends.
  • entity - the name of the entity.
  • entityId - array with entity id.
  • action - the name of the action.
  • userId - array with user id.

The response is as follows:

GET curl -X GET http://phalcon-logger.dev/api/logs?page=3

{
    "items": [
        {
            "id": 1,
            "entity": "Event",
            "entityId": 1000,
            "date": "2017-12-12 12:12:12",
            "userId": 3,
            "action": "create",
            "diff": {
                "before": "test1",
                "after": "test2"
            }
        },
        {...},
        {...},
    ],
    "first": 1,
    "before": 2,
    "current": 3,
    "last": 8,
    "next": 4,
    "total_pages": 8,
    "total_items": 72,
    "limit": 10
}

Attribute - Description

items - The set of records to be displayed at the current page
current - The current page
before - The previous page to the current one
next - The next page to the current one
last - The last page in the set of records
total_pages - The number of pages
total_items - The number of items in the source data\

Testing

First you need to re-generate base classes for test all suites:

vendor/bin/codecept build

Once the database is created and base clases re-generated, run the tests on a terminal:

vendor/bin/codecept run

or for detailed output:

vendor/bin/codecept run --debug

Requirements

  • PHP 7.0 and up
  • Phalcon 3.2.0
  • Composer

License

This project is open-sourced software licensed under the MIT License.

See the LICENSE file for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固