public function export()
{
foreach ($this->messages as $message) {
list($text, $level, $category, $timestamp) = $message;
if (!is_string($text)) {
// exceptions may not be serializable if in the call stack somewhere is a Closure
if ($text instanceof \Throwable || $text instanceof \Exception) {
$text = (string) $text;
} else {
$text = VarDumper::export($text);
}
}
$string = "[{$level}][{$category}] {$text}";
if ($level == Logger::LEVEL_ERROR) {
Console::stderr($string);
} else {
Console::stdout($string);
}
}
}