tarnawski / log-frontend
1.0.4
2016-08-11 21:08 UTC
Requires
- php: >=5.4
- symfony/framework-bundle: ~2.3|~3.0
- symfony/twig-bundle: ~2.3|~3.0
Requires (Dev)
- coduo/php-matcher: 2.0.1
- pdepend/pdepend: 2.2.4
- phpmd/phpmd: @stable
- phpspec/phpspec: ~2.0
- phpunit/phpunit: ~4.3
- sebastian/phpcpd: ^2.0
- squizlabs/php_codesniffer: ~2.0
This package is auto-updated.
Last update: 2024-10-14 23:58:09 UTC
README
This bundle allows to log events in your backend via endpoint.
1.Download
Open a command console, enter your project directory and execute the following command:
$ composer require tarnawski/log-frontend
2.Enable the Bundle
Enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project.
<?php
$bundles = array(
new LogFrontendBundle\LogFrontendBundle(),
);
3.Register the Routes:
LogFrontendBundle:
resource: "@LogFrontendBundle/Resources/config/routing.yml"
prefix: /logger
4.Configure the Bundle:
log_frontend:
path: /dev/shm/api-backend/logs/front.log
allow_host:
- api-backend.dev
- ras-backend.dev
If you wont allow all host:
log_frontend:
path: /dev/shm/api-backend/logs/front.log
allow_host: ~
You can log the events by send request with body:
{
"level": "ERROR",
"message": "Error with send email",
"context": "The email address not valid"
}
Available logging levels:
EMERGENCY
, ALERT
, CRITICAL
, ERROR
, WARNING
, INFO
, NOTICE
, DEBUG
Example with jQuery:
$.post( "your-app.com/logger", {
"level": "ERROR",
"message": "Error with send email",
"context": "The email address not valid"
});
To nicely display log files you can use: LogViewerBundle