PHP code example of yoannrenard / inline-logger
1. Go to this page and download the library: Download yoannrenard/inline-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/ */
yoannrenard / inline-logger example snippets
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
class RandomClass
{
/** @var LoggerInterface */
protected $logger;
/**
* @param LoggerInterface $logger
*/
public function __construct(LoggerInterface $logger = null)
{
$this->logger = $logger ?: new NullLogger();
}
public function randomMethod()
{
$this->logger->info('My random log');
}
}
$randomClass = new RandomClass(new InlineLogger());
$randomClass->randomMethod();
bash
[2017-02-13 16:07:30] php.INFO: My random log