1: <?php
2:
3: namespace HZSystem\Core\Logger\Appenders;
4:
5: use HZSystem\Exceptions\HzNotApplicableMethodException;
6:
7: use HZSystem\Core\Logger\HZLogger;
8: use HZSystem\Core\Logger\HZLogRow;
9:
10: require($_SESSION["hzSystem_path"].str_replace('/', DIRECTORY_SEPARATOR,'hzsystem/libs/FirePHPCore/FirePHP.class.php'));
11:
12: /*
13: * Copyright (C) 2016 Luca Liscio
14: *
15: * This program is free software: you can redistribute it and/or modify
16: * it under the terms of the GNU Affero General Public License as published by
17: * the Free Software Foundation, either version 3 of the License, or
18: * (at your option) any later version.
19: *
20: * This program is distributed in the hope that it will be useful,
21: * but WITHOUT ANY WARRANTY; without even the implied warranty of
22: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23: * GNU Affero General Public License for more details.
24: *
25: * You should have received a copy of the GNU Affero General Public License
26: * along with this program. If not, see <http://www.gnu.org/licenses/agpl-3.0.html>.
27: */
28:
29: /**
30: * FireBUG appender per HZLogger
31: *
32: * @author Luca Liscio <hzkight@h0model.org>
33: * @version 0.0.2 2016/08/03 15:35:20
34: * @copyright 2016 Luca Liscio
35: * @license http://www.gnu.org/licenses/agpl-3.0.html GNU/AGPL3
36: *
37: * @package hzSystem
38: * @subpackage Core\Logger\Appenders
39: * @filesource
40: */
41:
42: class Appender_firephp extends Appender {
43:
44: /**
45: * Save one row in the log file
46: *
47: * @param HZLogRow $log_row
48: */
49: public function add(HZLogRow $log_row){
50:
51: $firephp = \FirePHP::getInstance(true);
52:
53: switch($log_row->type){
54: case HZLogger::LOG_FATAL :
55: $firephp->fb("[".$log_row->date."] ".$log_row->message,\FirePHP::ERROR);
56: break;
57: case HZLogger::LOG_ERROR :
58: $firephp->fb("[".$log_row->date."] ".$log_row->message,\FirePHP::ERROR);
59: break;
60: case HZLogger::LOG_WARNING :
61: $firephp->fb("[".$log_row->date."] ".$log_row->message,\FirePHP::WARN);
62: break;
63: case HZLogger::LOG_INFO :
64: $firephp->fb("[".$log_row->date."] ".$log_row->message,\FirePHP::INFO);
65: break;
66: case HZLogger::LOG_DEBUG :
67: $firephp->fb("[".$log_row->date."] ".$log_row->message,\FirePHP::LOG);
68: break;
69: }
70:
71: }
72:
73: /**
74: * Method not applicable
75: *
76: * @throws HzNotApplicableMethodException
77: */
78: public function get_log($start=0,$stop){
79:
80: throw new HzNotApplicableMethodException(dgettext("hzSystem","Method not applicable"));
81:
82: }
83:
84: }