Logger

__construct($environment = “development”)

16: 	function __construct($environment = "development") {
17: 		$this->_file = DIR_LOG . $environment . '.log';
19: 		$this->_fh = fopen($this->_file, 'a');
20: 	}

File: lib/support/Logger.php, #line 16

__destruct()

27: 	function __destruct() {
29: 		if ($this->_fh) {
30: 			fclose($this->_fh);
31: 		}
33: 	}

File: lib/support/Logger.php, #line 27

log($msg, $type = ‘INFO’)

41: 	function log($msg, $type = 'INFO') {
42: 		$this->info($msg,$type);
43: 	}

File: lib/support/Logger.php, #line 41

info($msg, $type = “INFO”)

51: 	function info($msg, $type = "INFO") {
52: 		$this->write_to_log($msg,chr(27)."[0;32m".strtoupper($type).chr(27)."[0m");
53: 	}

File: lib/support/Logger.php, #line 51

debug($msg)

61: 	function debug($msg) {
62: 		$this->write_to_log($msg,"DEBUG");
63: 	}

File: lib/support/Logger.php, #line 61

warn($msg)

71: 	function warn($msg) {
72: 		$this->write_to_log($msg,"WARN");
73: 	}

File: lib/support/Logger.php, #line 71

error($msg,$type = “ERROR”)

81: 	function error($msg,$type = "ERROR") {
82: 		$this->write_to_log($msg,chr(27)."[0;31m".strtoupper($type).chr(27)."[0m");
83: 	}

File: lib/support/Logger.php, #line 81

write_to_log($msg,$type = ‘INFO’)

92: 	function write_to_log($msg,$type = 'INFO') {
93: 		fwrite($this->_fh, $this->timestamp() . ' ' . $type . ': ' . $msg . "n");
94: 	}

File: lib/support/Logger.php, #line 92

timestamp()

101: 	function timestamp() {
102: 		return date('Y-m-d H:i:s (T)');
103: 	}

File: lib/support/Logger.php, #line 101

red($message)

105: 	function red($message) {
106: 		return chr(27)."[0;31m".$message.chr(27)."[0m";
107: 	}

File: lib/support/Logger.php, #line 105

green($message)

109: 	function green($message) {
110: 		return chr(27)."[0;32m".$message.chr(27)."[0m";
111:
112: 	}

File: lib/support/Logger.php, #line 109

gray($message)

114: 	function gray($message) {
115: 		return chr(27)."[0;37m".$message.chr(27)."[0m";
116: 	}

File: lib/support/Logger.php, #line 114

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>