1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: 19: 20: 21: 22: 23: 24: 25: 26:
27: class cDebugFileAndVisAdv extends cDebugVisibleAdv {
28:
29: 30: 31: 32: 33: 34:
35: protected static $_instance;
36:
37: 38: 39: 40:
41: private $_aItems;
42:
43: 44: 45: 46:
47: private $_filePathName;
48:
49: 50: 51: 52: 53:
54: public static function getInstance() {
55: if (self::$_instance == NULL) {
56: self::$_instance = new cDebugFileAndVisAdv();
57: }
58: return self::$_instance;
59: }
60:
61: 62: 63:
64: private function __construct() {
65: global $cfg;
66: $this->_aItems = array();
67: $this->_filePathName = $cfg['path']['contenido_logs'] . 'debug.log';
68: }
69:
70: 71: 72: 73: 74:
75: public function out($msg) {
76: parent::out($msg);
77:
78: $sDate = date('Y-m-d H:i:s');
79: cFileHandler::write($this->_filePathName, $sDate . ": " . $msg . "\n", true);
80: }
81:
82: 83: 84: 85: 86:
87: public function show($mVariable, $sVariableDescription = '', $bExit = false) {
88: parent::show($mVariable, $sVariableDescription, $bExit);
89:
90: if (is_writeable($this->_filePathName)) {
91: $sDate = date('Y-m-d H:i:s');
92: $sContent = '#################### ' . $sDate . ' ####################' . "\n" . $sVariableDescription . "\n" . print_r($mVariable, true) . "\n" . '#################### /' . $sDate . ' ###################' . "\n\n";
93: cFileHandler::write($this->_filePathName, $sContent, true);
94: }
95: }
96: }
97: