diff --git a/src/Logging/Message.php b/src/Logging/Message.php index 8759ce4..1816464 100644 --- a/src/Logging/Message.php +++ b/src/Logging/Message.php @@ -5,6 +5,7 @@ namespace Fykosak\Utils\Logging; use Nette\SmartObject; +use Nette\Utils\Html; class Message { @@ -16,10 +17,13 @@ class Message public const LVL_INFO = 'info'; public const LVL_PRIMARY = 'primary'; - public string $text; + public $text; public string $level; - public function __construct(string $message, string $level) + /** + * @param string|Html $message + */ + public function __construct($message, string $level) { $this->text = $message; $this->level = $level; @@ -31,7 +35,7 @@ public function __construct(string $message, string $level) public function __toArray(): array { return [ - 'text' => $this->text, + 'text' => ($this->text instanceof Html) ? $this->text->toHtml() : $this->text, 'level' => $this->level, ]; }