2017 © Pedro Peláez
 

library log-frontend

image

tarnawski/log-frontend

  • Thursday, August 11, 2016
  • by tarnawski
  • Repository
  • 0 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

LogFrontend

This bundle allows to log events in your backend via endpoint., (*1)

1.Download

Open a command console, enter your project directory and execute the following command:, (*2)

$ 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., (*3)

<?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:, (*4)

log_frontend:
    path: /dev/shm/api-backend/logs/front.log
    allow_host: ~

You can log the events by send request with body:, (*5)

{
    "level": "ERROR",
    "message": "Error with send email",
    "context": "The email address not valid"
}

Available logging levels: EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, INFO, NOTICE, DEBUG, (*6)

Example with jQuery:, (*7)

$.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, (*8)

The Versions