source: branches/comu-ver2/data/class/logger/log/GC_Log_Log4php.php @ 18220

Revision 18220, 2.7 KB checked in by yokkuns, 15 years ago (diff)

#149 ロガークラス作成

RevLine 
[18220]1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2009 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24if(!defined('LOG4PHP_CONFIGURATION')){
25    define('LOG4PHP_CONFIGURATION', realpath(dirname(__FILE__)) . '/../../../conf/log4php.properties');
26}
27
28if(phpversion() >= '5.0.0') {
29    require_once (realpath(dirname(__FILE__)) . '/../../../module/log4php/php5/log4php/LoggerManager.php');
30} else {
31    require_once (realpath(dirname(__FILE__)) . '/../../../module/log4php/php4/log4php/LoggerManager.php');
32}
33
34require_once (realpath(dirname(__FILE__)) . '/GC_Log_Interface.php');
35
36/**
37 * GC_Log_Log4phpクラス
38 *
39 * ロギングをlog4phpで行うクラス
40 *
41 *
42 * @package Logger
43 * @author LOCKON CO.,LTD.
44 * @version $Id$
45 */
46
47class GC_Log_Log4php extends GC_Log_Interface{
48    /** @var logger loggerインスタンス*/
49    var $logger;
50
51    /**
52     * コンストラクタ
53     *
54     * @param void
55     * @return void
56     *
57     */
58    function GC_Log_Log4php($loggerName='EC_CUBE') {
59        $this->logger =& LoggerManager::getLogger($loggerName);
60    }
61
62    /**
63     * DEBUGログ
64     *
65     * @param string 出力したいログ
66     * @return void
67     *
68     */
69    function gfDebug($log) {
70        $this->logger->debug($log);
71    }
72
73    /**
74     * INFOログ
75     *
76     * @param string 出力したいログ
77     * @return void
78     *
79     */
80    function gfInfo($log) {
81        $this->logger->info($log);
82    }
83
84    /**
85     * WARNログ
86     *
87     * @param string 出力したいログ
88     * @return void
89     *
90     */
91    function gfWarn($log) {
92        $this->logger->warn($log);
93    }
94
95    /**
96     * ERRORログ
97     *
98     * @param string 出力したいログ
99     * @return void
100     *
101     */
102    function gfError($log) {
103        $this->logger->error($log);
104    }
105
106    /**
107     * FATALログ
108     *
109     * @param string 出力したいログ
110     * @return void
111     *
112     */
113    function gfFatal($log) {
114        $this->logger->fatal($log);
115    }
116}
117?>
Note: See TracBrowser for help on using the repository browser.