Commit | Line | Data |
---|---|---|
696f20d5 MS |
1 | <? |
2 | class Error { | |
3 | var $threshold; | |
4 | var $_levels; | |
5 | ||
6 | function Error() { | |
7 | log_message("[error] é instanciado."); | |
8 | ||
9 | $this->_levels = array("Notice", "Warning", "Error"); | |
10 | ||
11 | $this->threshold = 1; | |
12 | } | |
13 | ||
14 | function add($tmp_level, $tmp_message, $tmp_class = "", $tmp_function = "", $tmp_file = "", $tmp_line = 0) { | |
15 | if ($tmp_level >= $this->threshold) { | |
16 | echo "<div style='border: 1px solid #666666; font-family: Verdana; font-size: 10px; color: #333333; padding: 5px; line-height: 16px; margin: 5px;'>" . LF; | |
17 | ||
18 | echo "<h3 style='font-family: Arial; font-size: 18px; color: #990000; margin: 0 0 5 5px;'>" . $this->_levels[$tmp_level] . "</h3>" . LF; | |
19 | ||
20 | echo "<b>MESSAGE:</b> " . str_replace(DIR_ROOT, "/", $tmp_message) . "" . LF; | |
21 | ||
22 | if ($tmp_line > 0) { | |
23 | echo "<br><b>LINE:</b> " . $tmp_line . LF; | |
24 | } | |
25 | ||
26 | if ($tmp_file != "") { | |
27 | echo "<br><b>FILE:</b> " . str_replace(DIR_ROOT, "/", $tmp_file) . LF; | |
28 | } | |
29 | ||
30 | if ($tmp_class != "") { | |
31 | echo "<br><b>FUNCTION:</b> " . $tmp_class . "::" . $tmp_function . "()" . LF; | |
32 | } else if ($tmp_function != "") { | |
33 | echo "<br><b>FUNCTION:</b> " . $tmp_function . LF; | |
34 | } | |
35 | ||
36 | echo "</div>" . LF; | |
37 | ||
38 | if ($tmp_level == 2) { | |
39 | die(); | |
40 | } | |
41 | } | |
42 | } | |
43 | } | |
44 | $error = new Error(); | |
45 | ||
46 | function error($tmp_level, $tmp_message, $tmp_class = "", $tmp_function = "", $tmp_file = "", $tmp_line = 0) { | |
47 | global $error; | |
48 | ||
49 | $error->add($tmp_level, $tmp_message, $tmp_class, $tmp_function, $tmp_file, $tmp_line); | |
50 | } | |
51 | ?> |