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: protected static $_instance;
30:
31: private $_aItems;
32:
33: private $_filePathName;
34:
35: private function __construct() {
36: global $cfg;
37: $this->_aItems = array();
38: $this->_filePathName = $cfg['path']['contenido_logs'] . 'debug.log';
39: }
40:
41: static public function getInstance() {
42: if (self::$_instance == null) {
43: self::$_instance = new cDebugFileAndVisAdv();
44: }
45: return self::$_instance;
46: }
47:
48: public function out($msg) {
49: parent::out($msg);
50:
51: if (is_writeable($this->_filePathName)) {
52: $sDate = date('Y-m-d H:i:s');
53: cFileHandler::write($this->_filePathName, $sDate . ": " . $msg . "\n", true);
54: }
55: }
56:
57: public function show($mVariable, $sVariableDescription = '', $bExit = false) {
58: parent::show($mVariable, $sVariableDescription, $bExit);
59:
60: if (is_writeable($this->_filePathName)) {
61: $sDate = date('Y-m-d H:i:s');
62: $sContent = '#################### ' . $sDate . ' ####################' . "\n" . $sVariableDescription . "\n" . print_r($mVariable, true) . "\n" . '#################### /' . $sDate . ' ###################' . "\n\n";
63: cFileHandler::write($this->_filePathName, $sContent, true);
64: }
65: }
66:
67: }
68: