for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Class LogOutputAbstract
*
* @filesource LogOutputAbstract.php
* @created 04.01.2018
* @package chillerlan\Logger\Output
* @author Smiley <[email protected]>
* @copyright 2018 Smiley
* @license MIT
*/
namespace chillerlan\Logger\Output;
use chillerlan\Logger\LogOptions;
abstract class LogOutputAbstract implements LogOutputInterface{
* @var \chillerlan\Logger\LogOptions
protected $options;
public function __construct(LogOptions $options = null){
$this->options = $options ?? new LogOptions;
}
public function __destruct(){
$this->close();
public function close():LogOutputInterface{
return $this;
abstract protected function __log(string $level, string $message, array $context = null);
public function log(string $level, string $message, array $context = null){ // @todo: loglevel bitmask
if((array_key_exists($level, $this::LEVELS) && $this::LEVELS[$level] >= $this::LEVELS[$this->options->minLogLevel]) || (!array_key_exists($level, $this::LEVELS) && !empty($level))){
$this->__log($level, $message, $context);