Closed josefsabl closed 1 year ago
Issue is not just about mailer
, it includes also properties fromEmail
and emailSnooze
.
Fixing it by condition just continues to ignore error - user set a property, which is expected to do something, but in reality does nothing.
And fixing it by introducing new interface is a BC break making existing compatible loggers broken.
If a library replaces original logger, it is its responsibility to maintain compatibility.
Compatibility logger wrapper in its simplest version may look like this:
use Tracy\ILogger;
class ReplacingLogger implements ILogger
{
private ILogger $originalLogger;
public function __construct(ILogger $originalLogger)
{
$this->originalLogger = $originalLogger;
}
public function log($value, $level = self::INFO)
{
$this->originalLogger->log($value, $level);
}
public function __set(string $name, mixed $value): void
{
$this->originalLogger->$name = $value;
}
public function __get(string $name): mixed
{
return $this->originalLogger->$name;
}
public function __isset(string $name): bool
{
return isset($this->originalLogger->$name);
}
/**
* @param array<mixed> $arguments
*/
public function __call(string $name, array $arguments): mixed
{
return $this->originalLogger->$name(...$arguments);
}
}
Fixed dea9aa33fd2ab91e3123d90d83cffe00feb62f72