* @license LGPL http://www.gnu.org/licenses/lgpl.html * @package Wombat * @subpackage base */ /** * HTML log driver * * @version 0.1.0 * @package Wombat * @subpackage base * @test test/unit/log */ class WBLog_Html extends WBLog { /** * format log message * * @param array|string $msg * @return string */ protected function format($msg) { if(!is_array($msg)) { return $msg; } $string = array(); foreach ($msg as $k => $v) { $string[] = sprintf('%s: %s', $k, $v); } return implode(" | ", $string); } /** * Write log message * * @param int $level * @param mixed $msg * @return true on success */ protected function write($level, $msg) { printf('
%s %s %s %s
' . "\n", gmdate(parent::$_dateFormat), $this->_service, $level, $msg ); flush(); return true; } }