Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 31 |
ScreenLogger | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 31 |
__construct($htmlOutput = true) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
log($message, $eventType = ScreenLogger::NORMAL) | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
_getHTMLString($message, $timeString, $eventType) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 23 |
<?php | |
/** | |
* | |
*/ | |
namespace aae\log { | |
/** | |
* @author Axel Ancona Esselmann | |
* @package aae\log | |
*/ | |
class ScreenLogger extends \aae\log\AbstractLogger implements \aae\log\Loggable { | |
private $_htmlOutput; | |
protected $_newLine = "<br />"; | |
public function __construct($htmlOutput = true) { | |
$this->_htmlOutput = $htmlOutput; | |
} | |
public function log($message, $eventType = ScreenLogger::NORMAL) { | |
$timeString = $this->_getTimeString(); | |
if ($this->_htmlOutput) { | |
echo $this->_getHTMLString($message, $timeString, $eventType); | |
} else { | |
echo $this->_getString($message, $timeString, $eventType); | |
} | |
} | |
private function _getHTMLString($message, $timeString, $eventType) { | |
$titlStyle = "<span style=\"color:black; font-style:italic\">"; | |
$mssgStyle = "<span style=\"color:blue; font-weight:bold\">"; | |
$timeStyle = "<span style=\"color:green; font-weight:bold\">"; | |
$typeStyle = "<span style=\"color:red; font-weight:bold\">"; | |
$styleEnd = "</span> "; | |
return $titlStyle. | |
"Type:". | |
$styleEnd. | |
$typeStyle. | |
$eventType. | |
$styleEnd. | |
", ".$titlStyle. | |
"Time:". | |
$styleEnd. | |
$timeStyle. | |
$timeString. | |
$styleEnd. | |
", ".$titlStyle. | |
"Message:". | |
$styleEnd. | |
$mssgStyle. | |
"'".$message."'". | |
$styleEnd. | |
$this->_newLine; | |
} | |
} | |
} |