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