PHP code example of antidot-fw / logger

1. Go to this page and download the library: Download antidot-fw/logger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

antidot-fw / logger example snippets



// with Antidot Framework, Zend Expressive or Zend Stratigility

$app->pipe(\Antidot\Logger\Application\Http\Middleware\ExceptionLoggerMiddleware::class);
$app->pipe(\Antidot\Logger\Application\Http\Middleware\RequestLoggerMiddleware::class);


// src/App/Container/ExceptionLoggerMiddlewareFactory.php

namespace App\Container;

use Antidot\Logger\Application\Http\Middleware\ExceptionLoggerMiddleware;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;

class ExceptionLoggerMiddlewareFactory
{
    public function __invoke(ContainerInterface $container)
    {
        return new ExceptionLoggerMiddleware($container->get(LoggerInterface::class));
    }
}



// src/App/Container/RequestLoggerMiddlewareFactory.php

namespace App\Container;

use Antidot\Logger\Application\Http\Middleware\RequestLoggerMiddleware;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;

class RequestLoggerMiddlewareFactory
{
    public function __invoke(ContainerInterface $container)
    {
        return new RequestLoggerMiddleware($container->get(LoggerInterface::class));
    }
}