for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) Flipbox Digital Limited
* @license https://github.com/flipbox/skeleton/blob/master/LICENSE
* @link https://github.com/flipbox/skeleton
*/
namespace Flipbox\Skeleton\Logger;
use Psr\Log\LoggerInterface;
use Psr\Log\LoggerTrait;
* @author Flipbox Factory <[email protected]>
* @since 2.0.0
trait AutoLoggerTrait
{
use LoggerTrait;
* The logger instance.
*
* @var LoggerInterface
private $logger;
* Set a logger
* @param LoggerInterface $logger
public function setLogger(LoggerInterface $logger)
$this->logger = $logger;
}
* Get a logger
* @return LoggerInterface|null
public function getLogger()
return $this->logger;
* Logs with an arbitrary level.
* @param mixed $level
* @param string $message
* @param array $context
public function log($level, $message, array $context = [])
if ($this->getLogger()) {
$this->getLogger()->log($level, $message, $context);