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 cDebugFile implements cDebugInterface {
28:
29: 30: 31: 32: 33:
34: private static $_instance;
35:
36: 37: 38: 39:
40: private $_sPathToLogs;
41:
42: 43: 44: 45:
46: private $_sFileName;
47:
48: 49: 50: 51:
52: private $_sPathToFile;
53:
54: 55: 56: 57: 58:
59: public static function getInstance() {
60: if (self::$_instance == NULL) {
61: self::$_instance = new cDebugFile();
62: }
63: return self::$_instance;
64: }
65:
66: 67: 68: 69:
70: private function __construct() {
71: global $cfg;
72: $this->_sPathToLogs = $cfg['path']['contenido_logs'];
73: $this->_sFileName = 'debug.log';
74: $this->_sPathToFile = $this->_sPathToLogs . $this->_sFileName;
75: }
76:
77: 78: 79: 80: 81:
82: public function out($msg) {
83: if (cFileHandler::writeable($this->_sPathToFile)) {
84: $sDate = date('Y-m-d H:i:s');
85: cFileHandler::write($this->_sPathToFile, $sDate . ": " . $msg . "\n", true);
86: }
87: }
88:
89: 90: 91: 92: 93: 94: 95: 96:
97: public function show($mVariable, $sVariableDescription = '', $bExit = false) {
98: if (cFileHandler::writeable($this->_sPathToFile)) {
99: $sDate = date('Y-m-d H:i:s');
100: cFileHandler::write($this->_sPathToFile, '#################### ' . $sDate . ' ####################' . "\n", true);
101: cFileHandler::write($this->_sPathToFile, $sVariableDescription . "\n", true);
102: cFileHandler::write($this->_sPathToFile, print_r($mVariable, true) . "\n", true);
103: cFileHandler::write($this->_sPathToFile, '#################### /' . $sDate . ' ###################' . "\n\n", true);
104: }
105: }
106:
107: 108: 109: 110: 111: 112:
113: public function add($mVariable, $sVariableDescription = '') {
114: }
115:
116: 117: 118:
119: public function reset() {
120: }
121:
122: 123: 124:
125: public function showAll() {
126: }
127: }
128: