2017 © Pedro Peláez
 

library phalcon-logger

Phalcon logger

image

chameleon-m/phalcon-logger

Phalcon logger

  • Sunday, October 8, 2017
  • by Chameleon-m
  • Repository
  • 2 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Logger

Latest Version Software License Total Downloads Build Status, (*1)

How to install

Best way to install skeleton would be Composer, if you didn't install it, (*2)

Run code in the terminal:, (*3)

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

Using Git

First you need to clone the project, update vendors:, (*4)

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

DB

For PostgreSQL:, (*5)

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

Or run migration (use phalcon devtools): phalcon migration run, (*7)

Two methods are available:, (*8)

POST /api/logs, (*9)

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

The data in it is passed to json. For example:, (*11)

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, (*12)

{
    "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., (*13)

GET /api/logs, (*14)

Possible filters for the query:, (*15)

  • 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:, (*16)

GET curl -X GET http://phalcon-logger.dev/api/logs?page=3, (*17)

{
    "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, (*18)

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\, (*19)

Testing

First you need to re-generate base classes for test all suites:, (*20)

vendor/bin/codecept build, (*21)

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

vendor/bin/codecept run, (*23)

or for detailed output:, (*24)

vendor/bin/codecept run --debug, (*25)

Requirements

  • PHP 7.0 and up
  • Phalcon 3.2.0
  • Composer

License

This project is open-sourced software licensed under the MIT License., (*26)

See the LICENSE file for more information., (*27)

The Versions

08/10 2017
29/09 2017

v0.2.0

0.2.0.0

Phalcon logger

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Korolev

api logger phalcon

09/09 2017

v0.1.0

0.1.0.0

Phalcon logger

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Korolev

api logger phalcon