for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace WebServCo\Framework\Traits;
use WebServCo\Framework\Interfaces\OutputLoggerInterface;
/**
* Log simple messages to both file and output.
*/
trait LogTrait
{
protected \WebServCo\Framework\Interfaces\LoggerInterface $fileLogger;
protected ?OutputLoggerInterface $outputLogger = null;
* @param mixed $context
protected function logDebug(string $message, $context = []): void
$this->fileLogger->debug($message, $context);
if (!$this->outputLogger instanceof OutputLoggerInterface) {
return;
}
$this->outputLogger->output($message);
protected function logError(string $message, $context = []): void
$this->fileLogger->error($message, $context);
protected function logInfo(string $message, $context = []): void
$this->fileLogger->info($message, $context);
protected function logWarning(string $message, $context = []): void
$this->fileLogger->warning($message, $context);