<?php
/**
 * -----------------------------------------------------------------------------
 *
 * SyL - Web Application Framework for PHP
 *
 * PHP version 4 (>= 4.3.x) or 5
 *
 * Copyright (C) 2006 k.watanabe
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * -----------------------------------------------------------------------------
 * @package   SyL
 * @author    k.watanabe <k.watanabe@syl.jp>
 * @copyright 2006 k.watanabe
 * @license   http://www.opensource.org/licenses/lgpl-license.php
 * @version   CVS: $Id: SyL_LoggerHtml.php,v 1.8 2006/12/25 17:30:18 seasonstream Exp $
 * @link      http://www.syl.jp/
 * -----------------------------------------------------------------------------
 */

/**
 * HTML画面への文言ログ出力クラス
 *
 * @package   SyL
 * @author    k.watanabe <k.watanabe@syl.jp>
 * @copyright 2006 k.watanabe
 * @license   http://www.opensource.org/licenses/lgpl-license.php
 * @version   CVS: $Id: SyL_LoggerHtml.php,v 1.8 2006/12/25 17:30:18 seasonstream Exp $
 * @link      http://www.syl.jp/
 */
class SyL_LoggerHtml extends SyL_Logger
{
    /**
     * コンストラクタ
     * 
     * @access public
     * @param boolean ログ即時出力フラグ true: 即時出力、false: リクエスト終了後に出力
     */
    function SyL_LoggerHtml($immediate)
    {
        parent::SyL_Logger($immediate);
    }

    /**
     * ブラウザにログメッセージを出力する
     *
     * @access public
     * @param string ログレベル名
     * @param string メッセージ
     */
    function log($level, $message)
    {
        if ($level != '') {
            $message = sprintf ('%s [%s] %s "%s %s" %s', date('Y-m-d H:i:s'), $level, $this->remote_addr, $this->request_method, $this->request_uri, rtrim($message));
        }
        if ($this->immediate || ($level == '')) {
            echo '<font color="CC0000">' . $message . '</font><br>' . $this->eof;
        } else {
            $this->buffer[] = $message;
        }
     }

}

?>
