2017 © Pedro Peláez
 

package logger-package

Package for store logs with RabbitMQ

image

kasan/logger-package

Package for store logs with RabbitMQ

  • Friday, June 22, 2018
  • by Kasan67
  • Repository
  • 1 Watchers
  • 0 Stars
  • 47 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 114 % Grown

The README.md

RabbitLoggerPackage

Introduction

License

RabbitLogger is open-sourced software licensed under the MIT license, (*1)

Official Documentation

To get started use Composer to add the package to your project's dependencies:, (*2)

composer require kasan/logger-package

Configuration

After installing the library, register the kashirin\rabbit_mq\RabbitLoggerServiceProvider in your config/app.php configuration file:, (*3)

'providers' => [
    // Other service providers...

    kashirin\rabbit_mq\RabbitLoggerServiceProvider::class,
],

You will also need to add credentials in your config/services.php configuration file. For example:, (*4)

'rabbit_log' => [
    'host' => 'your-rabbit-host',  //required
    'port' => 'your-rabbit-port', //required
    'user' => 'your-rabbit-user-name', //required
    'password' => 'your-rabbit-user-password',  //required
    'facility' => 'project-path-from-github', //required
    'queue' => 'your-rabbit-queue', //required
    'second_queue' => 'your-rabbit-queue',
    'exchange' => 'your-rabbit-exchange',
    'exchange_type' => 'your-rabbit-exchange-type',
    'key' => 'your-rabbit-key',
    'vhost' => 'your-rabbit-vhost'
],

To handle all application errors, you need to add to the file app/Exceptions/Handler.php these lines in the method :, (*5)


use kashirin\rabbit_mq\Log; public function render($request, Exception $exception) { //init and configure logger $config = config('services.rabbit_log'); $logger = new Log($config); $logger->error($exception); return parent::render($request, $exception); }

To handle all application requests and responses, you need to add to the file app/Http/Kernel.php this line. Recommended use its in block HTTP middlewares, but you can use it in any block., (*6)


protected $middleware = [ // Other app middlewares... \kashirin\rabbit_mq\Middlewares\ResponseHandlerMiddleware::class, ];

Basic Usage

In any place of application you can use Logger with type of methods from PSR-3 standard, (*7)

use Illuminate\Http\Request;
use kashirin\rabbit_mq\Log;


/**
 * Class IndexController
 * @package App\Http\Controllers
 */
class IndexController extends Controller
{
    /**
     * @param Request $request
     * @param Log $log
     * @return array
     * @throws \AMQPChannelException
     * @throws \AMQPConnectionException
     * @throws \AMQPExchangeException
     */
    public function index(Request $request, Log $log)
    {
       $response = [];

       //some logic

       //simply message log
       $log->info('message to log');

       try {
           $data = 'some logic';
       } catch (Exception $exception) {
           //log any Throwable error or exception
           $log->error($exception);
       }

       //this type of logs except to use Response and Request objects from Laravel. Used in middleware.
       $log->log($response, $request);

       //log any JsonSerializable data
       $log->debug($data);

       return $response;
    }
} 

The Versions

22/06 2018

dev-master

9999999-dev

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

22/06 2018

1.2.1

1.2.1.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

22/06 2018

1.2.0

1.2.0.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

24/04 2018

1.1.9

1.1.9.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

18/04 2018

1.1.8

1.1.8.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

18/04 2018

1.1.7

1.1.7.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

16/04 2018

1.1.6

1.1.6.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

13/04 2018

1.1.5

1.1.5.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

13/04 2018

1.1.4

1.1.4.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

11/04 2018

1.1.3

1.1.3.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

10/04 2018

1.1.2

1.1.2.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

10/04 2018

1.1.1

1.1.1.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

10/04 2018

1.1.0

1.1.0.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit

10/04 2018

1.0.4

1.0.4.0

Package for store logs with RabbitMQ

  Sources   Download

MIT

The Requires

 

by Kasan

log logging rabbit