1. Go to this page and download the library: Download sebk/small-logger-bundle 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/ */
sebk / small-logger-bundle example snippets
namespace App\Log;
use Sebk\SmallLogger\Contracts\LogInterface;
use Sebk\SmallLogger\Log\BasicLog;
use Sebk\SmallLoggerBundle\Service\Logger;
class Shortcuts
{
public function __construct(Logger $logger)
{
$logger->registerShortcut('info', function(Logger $logger, $message) {
$logger->log(new BasicLog(new \DateTime(), LogInterface::ERR_LEVEL_INFO, $message));
});
}
}
namespace App\Controller;
use Sebk\SmallLoggerBundle\Service\Logger;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class TestLog extends AbstractController
{
/**
* @Route("/log")
* @param Dao $daoFactory
* @param Logger $logger
* @return Response
*/
public function logAction(Logger $logger)
{
$logger->info('This is a message');
return new Response("That's done !");
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.