for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WebPConvert\Loggers;
use WebPConvert\Loggers\BaseLogger;
class BufferLogger extends BaseLogger
{
public $entries = array();
public function log($msg, $style = '')
$this->entries[] = [$msg, $style];
}
public function ln()
$this->entries[] = '';
public function getHtml()
$html = '';
foreach ($this->entries as $entry) {
if ($entry == '') {
$html .= '<br>';
} else {
list($msg, $style) = $entry;
$msg = htmlspecialchars($msg);
if ($style == 'bold') {
$html .= '<b>' . $msg . '</b>';
} elseif ($style == 'italic') {
$html .= '<i>' . $msg . '</i>';
$html .= $msg;
return $html;
public function getText($newLineChar = ' ')
$text = '';
if ($entry == '') { // empty string means new line
if (substr($text, -2) != '.' . $newLineChar) {
$text .= '.' . $newLineChar;
$text .= $msg;
return $text;