@@ -176,85 +176,85 @@ |
||
176 | 176 | |
177 | 177 | var $timezone; |
178 | 178 | |
179 | - /** |
|
180 | - * Constructs a PatternLayout using the |
|
181 | - * {@link LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_LAYOUT_PATTERN}. |
|
182 | - * The default pattern just produces the application supplied message. |
|
183 | - */ |
|
184 | - public function LoggerPatternLayout($pattern = null) |
|
185 | - { |
|
186 | - if ($pattern === null) { |
|
187 | - $this->LoggerPatternLayout(LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_CONVERSION_PATTERN); |
|
188 | - } else { |
|
189 | - $this->pattern = $pattern; |
|
190 | - } |
|
191 | - } |
|
179 | + /** |
|
180 | + * Constructs a PatternLayout using the |
|
181 | + * {@link LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_LAYOUT_PATTERN}. |
|
182 | + * The default pattern just produces the application supplied message. |
|
183 | + */ |
|
184 | + public function LoggerPatternLayout($pattern = null) |
|
185 | + { |
|
186 | + if ($pattern === null) { |
|
187 | + $this->LoggerPatternLayout(LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_CONVERSION_PATTERN); |
|
188 | + } else { |
|
189 | + $this->pattern = $pattern; |
|
190 | + } |
|
191 | + } |
|
192 | 192 | |
193 | - /** |
|
194 | - * Set the <b>ConversionPattern</b> option. This is the string which |
|
195 | - * controls formatting and consists of a mix of literal content and |
|
196 | - * conversion specifiers. |
|
197 | - */ |
|
198 | - public function setConversionPattern($conversionPattern) |
|
199 | - { |
|
200 | - $this->pattern = $conversionPattern; |
|
201 | - $patternParser = $this->createPatternParser($this->pattern); |
|
202 | - $this->head = $patternParser->parse(); |
|
203 | - } |
|
193 | + /** |
|
194 | + * Set the <b>ConversionPattern</b> option. This is the string which |
|
195 | + * controls formatting and consists of a mix of literal content and |
|
196 | + * conversion specifiers. |
|
197 | + */ |
|
198 | + public function setConversionPattern($conversionPattern) |
|
199 | + { |
|
200 | + $this->pattern = $conversionPattern; |
|
201 | + $patternParser = $this->createPatternParser($this->pattern); |
|
202 | + $this->head = $patternParser->parse(); |
|
203 | + } |
|
204 | 204 | |
205 | - /** |
|
206 | - * @return string Returns the value of the <b>ConversionPattern</b> option. |
|
207 | - */ |
|
208 | - public function getConversionPattern() |
|
209 | - { |
|
210 | - return $this->pattern; |
|
211 | - } |
|
205 | + /** |
|
206 | + * @return string Returns the value of the <b>ConversionPattern</b> option. |
|
207 | + */ |
|
208 | + public function getConversionPattern() |
|
209 | + { |
|
210 | + return $this->pattern; |
|
211 | + } |
|
212 | 212 | |
213 | - /** |
|
214 | - * Does not do anything as options become effective |
|
215 | - */ |
|
216 | - public function activateOptions() |
|
217 | - { |
|
218 | - // nothing to do. |
|
219 | - } |
|
213 | + /** |
|
214 | + * Does not do anything as options become effective |
|
215 | + */ |
|
216 | + public function activateOptions() |
|
217 | + { |
|
218 | + // nothing to do. |
|
219 | + } |
|
220 | 220 | |
221 | - public function ignoresThrowable() |
|
222 | - { |
|
223 | - return true; |
|
224 | - } |
|
221 | + public function ignoresThrowable() |
|
222 | + { |
|
223 | + return true; |
|
224 | + } |
|
225 | 225 | |
226 | - /** |
|
227 | - * Returns LoggerPatternParser used to parse the conversion string. Subclasses |
|
228 | - * may override this to return a subclass of PatternParser which recognize |
|
229 | - * custom conversion characters. |
|
230 | - * |
|
231 | - * @param string $pattern |
|
232 | - * @return LoggerPatternParser |
|
233 | - */ |
|
234 | - public function createPatternParser($pattern) |
|
235 | - { |
|
236 | - return new LoggerPatternParser($pattern); |
|
237 | - } |
|
226 | + /** |
|
227 | + * Returns LoggerPatternParser used to parse the conversion string. Subclasses |
|
228 | + * may override this to return a subclass of PatternParser which recognize |
|
229 | + * custom conversion characters. |
|
230 | + * |
|
231 | + * @param string $pattern |
|
232 | + * @return LoggerPatternParser |
|
233 | + */ |
|
234 | + public function createPatternParser($pattern) |
|
235 | + { |
|
236 | + return new LoggerPatternParser($pattern); |
|
237 | + } |
|
238 | 238 | |
239 | - /** |
|
240 | - * Produces a formatted string as specified by the conversion pattern. |
|
241 | - * |
|
242 | - * @param LoggerLoggingEvent $event |
|
243 | - * @return string |
|
244 | - */ |
|
245 | - public function format($event) |
|
246 | - { |
|
247 | - LoggerLog::debug("LoggerPatternLayout::format()"); |
|
239 | + /** |
|
240 | + * Produces a formatted string as specified by the conversion pattern. |
|
241 | + * |
|
242 | + * @param LoggerLoggingEvent $event |
|
243 | + * @return string |
|
244 | + */ |
|
245 | + public function format($event) |
|
246 | + { |
|
247 | + LoggerLog::debug("LoggerPatternLayout::format()"); |
|
248 | 248 | |
249 | - // Reset working stringbuffer |
|
250 | - $this->sbuf = ''; |
|
251 | - $c = $this->head; |
|
252 | - while($c !== null) { |
|
253 | - $c->format($this->sbuf, $event); |
|
254 | - $c = $c->next; |
|
255 | - } |
|
256 | - return $this->sbuf; |
|
257 | - } |
|
249 | + // Reset working stringbuffer |
|
250 | + $this->sbuf = ''; |
|
251 | + $c = $this->head; |
|
252 | + while($c !== null) { |
|
253 | + $c->format($this->sbuf, $event); |
|
254 | + $c = $c->next; |
|
255 | + } |
|
256 | + return $this->sbuf; |
|
257 | + } |
|
258 | 258 | |
259 | 259 | } |
260 | 260 | ?> |
261 | 261 | \ No newline at end of file |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..'); |
24 | 24 | |
25 | 25 | if (!defined('LOG4PHP_LINE_SEP')) { |
26 | - if (substr(php_uname(), 0, 7) == "Windows") { |
|
27 | - /** |
|
28 | - * @ignore |
|
29 | - */ |
|
30 | - define('LOG4PHP_LINE_SEP', "\r\n"); |
|
31 | - } else { |
|
32 | - /** |
|
33 | - * @ignore |
|
34 | - */ |
|
35 | - define('LOG4PHP_LINE_SEP', "\n"); |
|
36 | - } |
|
26 | + if (substr(php_uname(), 0, 7) == "Windows") { |
|
27 | + /** |
|
28 | + * @ignore |
|
29 | + */ |
|
30 | + define('LOG4PHP_LINE_SEP', "\r\n"); |
|
31 | + } else { |
|
32 | + /** |
|
33 | + * @ignore |
|
34 | + */ |
|
35 | + define('LOG4PHP_LINE_SEP', "\n"); |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -76,165 +76,165 @@ discard block |
||
76 | 76 | */ |
77 | 77 | class LoggerLayoutTTCC extends LoggerLayout { |
78 | 78 | |
79 | - // Internal representation of options |
|
80 | - var $threadPrinting = true; |
|
81 | - var $categoryPrefixing = true; |
|
82 | - var $contextPrinting = true; |
|
83 | - var $microSecondsPrinting = true; |
|
79 | + // Internal representation of options |
|
80 | + var $threadPrinting = true; |
|
81 | + var $categoryPrefixing = true; |
|
82 | + var $contextPrinting = true; |
|
83 | + var $microSecondsPrinting = true; |
|
84 | 84 | |
85 | - /** |
|
86 | - * @var string date format. See {@link PHP_MANUAL#strftime} for details |
|
87 | - */ |
|
88 | - var $dateFormat = '%c'; |
|
85 | + /** |
|
86 | + * @var string date format. See {@link PHP_MANUAL#strftime} for details |
|
87 | + */ |
|
88 | + var $dateFormat = '%c'; |
|
89 | 89 | |
90 | - /** |
|
91 | - * Constructor |
|
92 | - * |
|
93 | - * @param string date format |
|
94 | - * @see dateFormat |
|
95 | - */ |
|
96 | - public function LoggerLayoutTTCC($dateFormat = '') |
|
97 | - { |
|
98 | - if (!empty($dateFormat)) |
|
99 | - $this->dateFormat = $dateFormat; |
|
100 | - return; |
|
101 | - } |
|
90 | + /** |
|
91 | + * Constructor |
|
92 | + * |
|
93 | + * @param string date format |
|
94 | + * @see dateFormat |
|
95 | + */ |
|
96 | + public function LoggerLayoutTTCC($dateFormat = '') |
|
97 | + { |
|
98 | + if (!empty($dateFormat)) |
|
99 | + $this->dateFormat = $dateFormat; |
|
100 | + return; |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * The <b>ThreadPrinting</b> option specifies whether the name of the |
|
105 | - * current thread is part of log output or not. This is true by default. |
|
106 | - */ |
|
107 | - public function setThreadPrinting($threadPrinting) |
|
108 | - { |
|
103 | + /** |
|
104 | + * The <b>ThreadPrinting</b> option specifies whether the name of the |
|
105 | + * current thread is part of log output or not. This is true by default. |
|
106 | + */ |
|
107 | + public function setThreadPrinting($threadPrinting) |
|
108 | + { |
|
109 | 109 | |
110 | - $this->threadPrinting = is_bool($threadPrinting) ? |
|
111 | - $threadPrinting : |
|
112 | - (bool)(strtolower($threadPrinting) == 'true'); |
|
113 | - } |
|
110 | + $this->threadPrinting = is_bool($threadPrinting) ? |
|
111 | + $threadPrinting : |
|
112 | + (bool)(strtolower($threadPrinting) == 'true'); |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * @return boolean Returns value of the <b>ThreadPrinting</b> option. |
|
117 | - */ |
|
118 | - public function getThreadPrinting() { |
|
119 | - return $this->threadPrinting; |
|
120 | - } |
|
115 | + /** |
|
116 | + * @return boolean Returns value of the <b>ThreadPrinting</b> option. |
|
117 | + */ |
|
118 | + public function getThreadPrinting() { |
|
119 | + return $this->threadPrinting; |
|
120 | + } |
|
121 | 121 | |
122 | - /** |
|
123 | - * The <b>CategoryPrefixing</b> option specifies whether {@link Category} |
|
124 | - * name is part of log output or not. This is true by default. |
|
125 | - */ |
|
126 | - public function setCategoryPrefixing($categoryPrefixing) |
|
127 | - { |
|
128 | - $this->categoryPrefixing = is_bool($categoryPrefixing) ? |
|
129 | - $categoryPrefixing : |
|
130 | - (bool)(strtolower($categoryPrefixing) == 'true'); |
|
131 | - } |
|
122 | + /** |
|
123 | + * The <b>CategoryPrefixing</b> option specifies whether {@link Category} |
|
124 | + * name is part of log output or not. This is true by default. |
|
125 | + */ |
|
126 | + public function setCategoryPrefixing($categoryPrefixing) |
|
127 | + { |
|
128 | + $this->categoryPrefixing = is_bool($categoryPrefixing) ? |
|
129 | + $categoryPrefixing : |
|
130 | + (bool)(strtolower($categoryPrefixing) == 'true'); |
|
131 | + } |
|
132 | 132 | |
133 | - /** |
|
134 | - * @return boolean Returns value of the <b>CategoryPrefixing</b> option. |
|
135 | - */ |
|
136 | - public function getCategoryPrefixing() { |
|
137 | - return $this->categoryPrefixing; |
|
138 | - } |
|
133 | + /** |
|
134 | + * @return boolean Returns value of the <b>CategoryPrefixing</b> option. |
|
135 | + */ |
|
136 | + public function getCategoryPrefixing() { |
|
137 | + return $this->categoryPrefixing; |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * The <b>ContextPrinting</b> option specifies log output will include |
|
142 | - * the nested context information belonging to the current thread. |
|
143 | - * This is true by default. |
|
144 | - */ |
|
145 | - public function setContextPrinting($contextPrinting) { |
|
146 | - $this->contextPrinting = is_bool($contextPrinting) ? |
|
147 | - $contextPrinting : |
|
148 | - (bool)(strtolower($contextPrinting) == 'true'); |
|
149 | - } |
|
140 | + /** |
|
141 | + * The <b>ContextPrinting</b> option specifies log output will include |
|
142 | + * the nested context information belonging to the current thread. |
|
143 | + * This is true by default. |
|
144 | + */ |
|
145 | + public function setContextPrinting($contextPrinting) { |
|
146 | + $this->contextPrinting = is_bool($contextPrinting) ? |
|
147 | + $contextPrinting : |
|
148 | + (bool)(strtolower($contextPrinting) == 'true'); |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * @return boolean Returns value of the <b>ContextPrinting</b> option. |
|
153 | - */ |
|
154 | - public function getContextPrinting() |
|
155 | - { |
|
156 | - return $this->contextPrinting; |
|
157 | - } |
|
151 | + /** |
|
152 | + * @return boolean Returns value of the <b>ContextPrinting</b> option. |
|
153 | + */ |
|
154 | + public function getContextPrinting() |
|
155 | + { |
|
156 | + return $this->contextPrinting; |
|
157 | + } |
|
158 | 158 | |
159 | - /** |
|
160 | - * The <b>MicroSecondsPrinting</b> option specifies if microseconds infos |
|
161 | - * should be printed at the end of timestamp. |
|
162 | - * This is true by default. |
|
163 | - */ |
|
164 | - public function setMicroSecondsPrinting($microSecondsPrinting) { |
|
165 | - $this->microSecondsPrinting = is_bool($microSecondsPrinting) ? |
|
166 | - $microSecondsPrinting : |
|
167 | - (bool)(strtolower($microSecondsPrinting) == 'true'); |
|
168 | - } |
|
159 | + /** |
|
160 | + * The <b>MicroSecondsPrinting</b> option specifies if microseconds infos |
|
161 | + * should be printed at the end of timestamp. |
|
162 | + * This is true by default. |
|
163 | + */ |
|
164 | + public function setMicroSecondsPrinting($microSecondsPrinting) { |
|
165 | + $this->microSecondsPrinting = is_bool($microSecondsPrinting) ? |
|
166 | + $microSecondsPrinting : |
|
167 | + (bool)(strtolower($microSecondsPrinting) == 'true'); |
|
168 | + } |
|
169 | 169 | |
170 | - /** |
|
171 | - * @return boolean Returns value of the <b>MicroSecondsPrinting</b> option. |
|
172 | - */ |
|
173 | - public function getMicroSecondsPrinting() |
|
174 | - { |
|
175 | - return $this->microSecondsPrinting; |
|
176 | - } |
|
170 | + /** |
|
171 | + * @return boolean Returns value of the <b>MicroSecondsPrinting</b> option. |
|
172 | + */ |
|
173 | + public function getMicroSecondsPrinting() |
|
174 | + { |
|
175 | + return $this->microSecondsPrinting; |
|
176 | + } |
|
177 | 177 | |
178 | 178 | |
179 | - public function setDateFormat($dateFormat) |
|
180 | - { |
|
181 | - $this->dateFormat = $dateFormat; |
|
182 | - } |
|
179 | + public function setDateFormat($dateFormat) |
|
180 | + { |
|
181 | + $this->dateFormat = $dateFormat; |
|
182 | + } |
|
183 | 183 | |
184 | - /** |
|
185 | - * @return string |
|
186 | - */ |
|
187 | - public function getDateFormat() |
|
188 | - { |
|
189 | - return $this->dateFormat; |
|
190 | - } |
|
184 | + /** |
|
185 | + * @return string |
|
186 | + */ |
|
187 | + public function getDateFormat() |
|
188 | + { |
|
189 | + return $this->dateFormat; |
|
190 | + } |
|
191 | 191 | |
192 | - /** |
|
193 | - * In addition to the level of the statement and message, the |
|
194 | - * returned string includes time, thread, category. |
|
195 | - * <p>Time, thread, category are printed depending on options. |
|
196 | - * |
|
197 | - * @param LoggerLoggingEvent $event |
|
198 | - * @return string |
|
199 | - */ |
|
200 | - public function format($event) |
|
201 | - { |
|
202 | - $timeStamp = (float)$event->getTimeStamp(); |
|
203 | - $format = strftime($this->dateFormat, (int)$timeStamp); |
|
192 | + /** |
|
193 | + * In addition to the level of the statement and message, the |
|
194 | + * returned string includes time, thread, category. |
|
195 | + * <p>Time, thread, category are printed depending on options. |
|
196 | + * |
|
197 | + * @param LoggerLoggingEvent $event |
|
198 | + * @return string |
|
199 | + */ |
|
200 | + public function format($event) |
|
201 | + { |
|
202 | + $timeStamp = (float)$event->getTimeStamp(); |
|
203 | + $format = strftime($this->dateFormat, (int)$timeStamp); |
|
204 | 204 | |
205 | - if ($this->microSecondsPrinting) { |
|
206 | - $usecs = round(($timeStamp - (int)$timeStamp) * 1000); |
|
207 | - $format .= sprintf(',%03d', $usecs); |
|
208 | - } |
|
205 | + if ($this->microSecondsPrinting) { |
|
206 | + $usecs = round(($timeStamp - (int)$timeStamp) * 1000); |
|
207 | + $format .= sprintf(',%03d', $usecs); |
|
208 | + } |
|
209 | 209 | |
210 | - $format .= ' '; |
|
210 | + $format .= ' '; |
|
211 | 211 | |
212 | - if ($this->threadPrinting) |
|
213 | - $format .= '['.getmypid().'] '; |
|
212 | + if ($this->threadPrinting) |
|
213 | + $format .= '['.getmypid().'] '; |
|
214 | 214 | |
215 | - $level = $event->getLevel(); |
|
216 | - $format .= $level->toString().' '; |
|
215 | + $level = $event->getLevel(); |
|
216 | + $format .= $level->toString().' '; |
|
217 | 217 | |
218 | - if($this->categoryPrefixing) { |
|
219 | - $format .= $event->getLoggerName().' '; |
|
220 | - } |
|
218 | + if($this->categoryPrefixing) { |
|
219 | + $format .= $event->getLoggerName().' '; |
|
220 | + } |
|
221 | 221 | |
222 | - if($this->contextPrinting) { |
|
223 | - $ndc = $event->getNDC(); |
|
224 | - if($ndc != null) { |
|
225 | - $format .= $ndc.' '; |
|
226 | - } |
|
227 | - } |
|
222 | + if($this->contextPrinting) { |
|
223 | + $ndc = $event->getNDC(); |
|
224 | + if($ndc != null) { |
|
225 | + $format .= $ndc.' '; |
|
226 | + } |
|
227 | + } |
|
228 | 228 | |
229 | - $format .= '- '.$event->getRenderedMessage(); |
|
230 | - $format .= LOG4PHP_LINE_SEP; |
|
229 | + $format .= '- '.$event->getRenderedMessage(); |
|
230 | + $format .= LOG4PHP_LINE_SEP; |
|
231 | 231 | |
232 | - return $format; |
|
233 | - } |
|
232 | + return $format; |
|
233 | + } |
|
234 | 234 | |
235 | - public function ignoresThrowable() |
|
236 | - { |
|
237 | - return true; |
|
238 | - } |
|
235 | + public function ignoresThrowable() |
|
236 | + { |
|
237 | + return true; |
|
238 | + } |
|
239 | 239 | } |
240 | 240 | ?> |
241 | 241 | \ No newline at end of file |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..'); |
24 | 24 | |
25 | 25 | if (!defined('LOG4PHP_LINE_SEP')) { |
26 | - if (substr(php_uname(), 0, 7) == "Windows") { |
|
27 | - /** |
|
28 | - * @ignore |
|
29 | - */ |
|
30 | - define('LOG4PHP_LINE_SEP', "\r\n"); |
|
31 | - } else { |
|
32 | - /** |
|
33 | - * @ignore |
|
34 | - */ |
|
35 | - define('LOG4PHP_LINE_SEP', "\n"); |
|
36 | - } |
|
26 | + if (substr(php_uname(), 0, 7) == "Windows") { |
|
27 | + /** |
|
28 | + * @ignore |
|
29 | + */ |
|
30 | + define('LOG4PHP_LINE_SEP', "\r\n"); |
|
31 | + } else { |
|
32 | + /** |
|
33 | + * @ignore |
|
34 | + */ |
|
35 | + define('LOG4PHP_LINE_SEP', "\n"); |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -53,204 +53,204 @@ discard block |
||
53 | 53 | */ |
54 | 54 | class LoggerLayoutHtml extends LoggerLayout { |
55 | 55 | |
56 | - /** |
|
57 | - * The <b>LocationInfo</b> option takes a boolean value. By |
|
58 | - * default, it is set to false which means there will be no location |
|
59 | - * information output by this layout. If the the option is set to |
|
60 | - * true, then the file name and line number of the statement |
|
61 | - * at the origin of the log statement will be output. |
|
62 | - * |
|
63 | - * <p>If you are embedding this layout within a {@link LoggerAppenderMail} |
|
64 | - * or a {@link LoggerAppenderMailEvent} then make sure to set the |
|
65 | - * <b>LocationInfo</b> option of that appender as well. |
|
66 | - * @var boolean |
|
67 | - */ |
|
68 | - var $locationInfo = false; |
|
56 | + /** |
|
57 | + * The <b>LocationInfo</b> option takes a boolean value. By |
|
58 | + * default, it is set to false which means there will be no location |
|
59 | + * information output by this layout. If the the option is set to |
|
60 | + * true, then the file name and line number of the statement |
|
61 | + * at the origin of the log statement will be output. |
|
62 | + * |
|
63 | + * <p>If you are embedding this layout within a {@link LoggerAppenderMail} |
|
64 | + * or a {@link LoggerAppenderMailEvent} then make sure to set the |
|
65 | + * <b>LocationInfo</b> option of that appender as well. |
|
66 | + * @var boolean |
|
67 | + */ |
|
68 | + var $locationInfo = false; |
|
69 | 69 | |
70 | - /** |
|
71 | - * The <b>Title</b> option takes a String value. This option sets the |
|
72 | - * document title of the generated HTML document. |
|
73 | - * Defaults to 'Log4php Log Messages'. |
|
74 | - * @var string |
|
75 | - */ |
|
76 | - var $title = "Log4php Log Messages"; |
|
70 | + /** |
|
71 | + * The <b>Title</b> option takes a String value. This option sets the |
|
72 | + * document title of the generated HTML document. |
|
73 | + * Defaults to 'Log4php Log Messages'. |
|
74 | + * @var string |
|
75 | + */ |
|
76 | + var $title = "Log4php Log Messages"; |
|
77 | 77 | |
78 | - /** |
|
79 | - * Constructor |
|
80 | - */ |
|
81 | - public function LoggerLayoutHtml() |
|
82 | - { |
|
83 | - return; |
|
84 | - } |
|
78 | + /** |
|
79 | + * Constructor |
|
80 | + */ |
|
81 | + public function LoggerLayoutHtml() |
|
82 | + { |
|
83 | + return; |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * The <b>LocationInfo</b> option takes a boolean value. By |
|
88 | - * default, it is set to false which means there will be no location |
|
89 | - * information output by this layout. If the the option is set to |
|
90 | - * true, then the file name and line number of the statement |
|
91 | - * at the origin of the log statement will be output. |
|
92 | - * |
|
93 | - * <p>If you are embedding this layout within a {@link LoggerAppenderMail} |
|
94 | - * or a {@link LoggerAppenderMailEvent} then make sure to set the |
|
95 | - * <b>LocationInfo</b> option of that appender as well. |
|
96 | - */ |
|
97 | - public function setLocationInfo($flag) |
|
98 | - { |
|
99 | - if (is_bool($flag)) { |
|
100 | - $this->locationInfo = $flag; |
|
101 | - } else { |
|
102 | - $this->locationInfo = (bool)(strtolower($flag) == 'true'); |
|
103 | - } |
|
104 | - } |
|
86 | + /** |
|
87 | + * The <b>LocationInfo</b> option takes a boolean value. By |
|
88 | + * default, it is set to false which means there will be no location |
|
89 | + * information output by this layout. If the the option is set to |
|
90 | + * true, then the file name and line number of the statement |
|
91 | + * at the origin of the log statement will be output. |
|
92 | + * |
|
93 | + * <p>If you are embedding this layout within a {@link LoggerAppenderMail} |
|
94 | + * or a {@link LoggerAppenderMailEvent} then make sure to set the |
|
95 | + * <b>LocationInfo</b> option of that appender as well. |
|
96 | + */ |
|
97 | + public function setLocationInfo($flag) |
|
98 | + { |
|
99 | + if (is_bool($flag)) { |
|
100 | + $this->locationInfo = $flag; |
|
101 | + } else { |
|
102 | + $this->locationInfo = (bool)(strtolower($flag) == 'true'); |
|
103 | + } |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * Returns the current value of the <b>LocationInfo</b> option. |
|
108 | - */ |
|
109 | - public function getLocationInfo() |
|
110 | - { |
|
111 | - return $this->locationInfo; |
|
112 | - } |
|
106 | + /** |
|
107 | + * Returns the current value of the <b>LocationInfo</b> option. |
|
108 | + */ |
|
109 | + public function getLocationInfo() |
|
110 | + { |
|
111 | + return $this->locationInfo; |
|
112 | + } |
|
113 | 113 | |
114 | - /** |
|
115 | - * The <b>Title</b> option takes a String value. This option sets the |
|
116 | - * document title of the generated HTML document. |
|
117 | - * Defaults to 'Log4php Log Messages'. |
|
118 | - */ |
|
119 | - public function setTitle($title) |
|
120 | - { |
|
121 | - $this->title = $title; |
|
122 | - } |
|
114 | + /** |
|
115 | + * The <b>Title</b> option takes a String value. This option sets the |
|
116 | + * document title of the generated HTML document. |
|
117 | + * Defaults to 'Log4php Log Messages'. |
|
118 | + */ |
|
119 | + public function setTitle($title) |
|
120 | + { |
|
121 | + $this->title = $title; |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * @return string Returns the current value of the <b>Title</b> option. |
|
126 | - */ |
|
127 | - public function getTitle() |
|
128 | - { |
|
129 | - return $this->title; |
|
130 | - } |
|
124 | + /** |
|
125 | + * @return string Returns the current value of the <b>Title</b> option. |
|
126 | + */ |
|
127 | + public function getTitle() |
|
128 | + { |
|
129 | + return $this->title; |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * @return string Returns the content type output by this layout, i.e "text/html". |
|
134 | - */ |
|
135 | - public function getContentType() |
|
136 | - { |
|
137 | - return "text/html"; |
|
138 | - } |
|
132 | + /** |
|
133 | + * @return string Returns the content type output by this layout, i.e "text/html". |
|
134 | + */ |
|
135 | + public function getContentType() |
|
136 | + { |
|
137 | + return "text/html"; |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * No options to activate. |
|
142 | - */ |
|
143 | - public function activateOptions() |
|
144 | - { |
|
145 | - return true; |
|
146 | - } |
|
140 | + /** |
|
141 | + * No options to activate. |
|
142 | + */ |
|
143 | + public function activateOptions() |
|
144 | + { |
|
145 | + return true; |
|
146 | + } |
|
147 | 147 | |
148 | - /** |
|
149 | - * @param LoggerLoggingEvent $event |
|
150 | - * @return string |
|
151 | - */ |
|
152 | - public function format($event) |
|
153 | - { |
|
154 | - $sbuf = LOG4PHP_LINE_SEP . "<tr>" . LOG4PHP_LINE_SEP; |
|
148 | + /** |
|
149 | + * @param LoggerLoggingEvent $event |
|
150 | + * @return string |
|
151 | + */ |
|
152 | + public function format($event) |
|
153 | + { |
|
154 | + $sbuf = LOG4PHP_LINE_SEP . "<tr>" . LOG4PHP_LINE_SEP; |
|
155 | 155 | |
156 | - $sbuf .= "<td>"; |
|
156 | + $sbuf .= "<td>"; |
|
157 | 157 | |
158 | - $eventTime = (float)$event->getTimeStamp(); |
|
159 | - $eventStartTime = (float)LoggerLoggingEvent::getStartTime(); |
|
160 | - $sbuf .= number_format(($eventTime - $eventStartTime) * 1000, 0, '', ''); |
|
161 | - $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
158 | + $eventTime = (float)$event->getTimeStamp(); |
|
159 | + $eventStartTime = (float)LoggerLoggingEvent::getStartTime(); |
|
160 | + $sbuf .= number_format(($eventTime - $eventStartTime) * 1000, 0, '', ''); |
|
161 | + $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
162 | 162 | |
163 | - $sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">"; |
|
164 | - $sbuf .= $event->getThreadName(); |
|
165 | - $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
163 | + $sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">"; |
|
164 | + $sbuf .= $event->getThreadName(); |
|
165 | + $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
166 | 166 | |
167 | - $sbuf .= "<td title=\"Level\">"; |
|
167 | + $sbuf .= "<td title=\"Level\">"; |
|
168 | 168 | |
169 | - $level = $event->getLevel(); |
|
169 | + $level = $event->getLevel(); |
|
170 | 170 | |
171 | - if ($level->equals(LoggerLevel::getLevelDebug())) { |
|
172 | - $sbuf .= "<font color=\"#339933\">"; |
|
173 | - $sbuf .= $level->toString(); |
|
174 | - $sbuf .= "</font>"; |
|
175 | - }elseif($level->equals(LoggerLevel::getLevelWarn())) { |
|
176 | - $sbuf .= "<font color=\"#993300\"><strong>"; |
|
177 | - $sbuf .= $level->toString(); |
|
178 | - $sbuf .= "</strong></font>"; |
|
179 | - } else { |
|
180 | - $sbuf .= $level->toString(); |
|
181 | - } |
|
182 | - $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
171 | + if ($level->equals(LoggerLevel::getLevelDebug())) { |
|
172 | + $sbuf .= "<font color=\"#339933\">"; |
|
173 | + $sbuf .= $level->toString(); |
|
174 | + $sbuf .= "</font>"; |
|
175 | + }elseif($level->equals(LoggerLevel::getLevelWarn())) { |
|
176 | + $sbuf .= "<font color=\"#993300\"><strong>"; |
|
177 | + $sbuf .= $level->toString(); |
|
178 | + $sbuf .= "</strong></font>"; |
|
179 | + } else { |
|
180 | + $sbuf .= $level->toString(); |
|
181 | + } |
|
182 | + $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
183 | 183 | |
184 | - $sbuf .= "<td title=\"" . htmlentities($event->getLoggerName(), ENT_QUOTES) . " category\">"; |
|
185 | - $sbuf .= htmlentities($event->getLoggerName(), ENT_QUOTES); |
|
186 | - $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
184 | + $sbuf .= "<td title=\"" . htmlentities($event->getLoggerName(), ENT_QUOTES) . " category\">"; |
|
185 | + $sbuf .= htmlentities($event->getLoggerName(), ENT_QUOTES); |
|
186 | + $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
187 | 187 | |
188 | - if ($this->locationInfo) { |
|
189 | - $locInfo = $event->getLocationInformation(); |
|
190 | - $sbuf .= "<td>"; |
|
191 | - $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES). ':' . $locInfo->getLineNumber(); |
|
192 | - $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
193 | - } |
|
188 | + if ($this->locationInfo) { |
|
189 | + $locInfo = $event->getLocationInformation(); |
|
190 | + $sbuf .= "<td>"; |
|
191 | + $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES). ':' . $locInfo->getLineNumber(); |
|
192 | + $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
193 | + } |
|
194 | 194 | |
195 | - $sbuf .= "<td title=\"Message\">"; |
|
196 | - $sbuf .= htmlentities($event->getRenderedMessage(), ENT_QUOTES); |
|
197 | - $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
195 | + $sbuf .= "<td title=\"Message\">"; |
|
196 | + $sbuf .= htmlentities($event->getRenderedMessage(), ENT_QUOTES); |
|
197 | + $sbuf .= "</td>" . LOG4PHP_LINE_SEP; |
|
198 | 198 | |
199 | - $sbuf .= "</tr>" . LOG4PHP_LINE_SEP; |
|
199 | + $sbuf .= "</tr>" . LOG4PHP_LINE_SEP; |
|
200 | 200 | |
201 | - if ($event->getNDC() != null) { |
|
202 | - $sbuf .= "<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">"; |
|
203 | - $sbuf .= "NDC: " . htmlentities($event->getNDC(), ENT_QUOTES); |
|
204 | - $sbuf .= "</td></tr>" . LOG4PHP_LINE_SEP; |
|
205 | - } |
|
201 | + if ($event->getNDC() != null) { |
|
202 | + $sbuf .= "<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">"; |
|
203 | + $sbuf .= "NDC: " . htmlentities($event->getNDC(), ENT_QUOTES); |
|
204 | + $sbuf .= "</td></tr>" . LOG4PHP_LINE_SEP; |
|
205 | + } |
|
206 | 206 | |
207 | - return $sbuf; |
|
208 | - } |
|
207 | + return $sbuf; |
|
208 | + } |
|
209 | 209 | |
210 | - /** |
|
211 | - * @return string Returns appropriate HTML headers. |
|
212 | - */ |
|
213 | - public function getHeader() |
|
214 | - { |
|
215 | - $sbuf = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . LOG4PHP_LINE_SEP; |
|
216 | - $sbuf .= "<html>" . LOG4PHP_LINE_SEP; |
|
217 | - $sbuf .= "<head>" . LOG4PHP_LINE_SEP; |
|
218 | - $sbuf .= "<title>" . $this->title . "</title>" . LOG4PHP_LINE_SEP; |
|
219 | - $sbuf .= "<style type=\"text/css\">" . LOG4PHP_LINE_SEP; |
|
220 | - $sbuf .= "<!--" . LOG4PHP_LINE_SEP; |
|
221 | - $sbuf .= "body, table {font-family: arial,sans-serif; font-size: x-small;}" . LOG4PHP_LINE_SEP; |
|
222 | - $sbuf .= "th {background: #336699; color: #FFFFFF; text-align: left;}" . LOG4PHP_LINE_SEP; |
|
223 | - $sbuf .= "-->" . LOG4PHP_LINE_SEP; |
|
224 | - $sbuf .= "</style>" . LOG4PHP_LINE_SEP; |
|
225 | - $sbuf .= "</head>" . LOG4PHP_LINE_SEP; |
|
226 | - $sbuf .= "<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">" . LOG4PHP_LINE_SEP; |
|
227 | - $sbuf .= "<hr size=\"1\" noshade>" . LOG4PHP_LINE_SEP; |
|
228 | - $sbuf .= "Log session start time " . strftime('%c', time()) . "<br>" . LOG4PHP_LINE_SEP; |
|
229 | - $sbuf .= "<br>" . LOG4PHP_LINE_SEP; |
|
230 | - $sbuf .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" bordercolor=\"#224466\" width=\"100%\">" . LOG4PHP_LINE_SEP; |
|
231 | - $sbuf .= "<tr>" . LOG4PHP_LINE_SEP; |
|
232 | - $sbuf .= "<th>Time</th>" . LOG4PHP_LINE_SEP; |
|
233 | - $sbuf .= "<th>Thread</th>" . LOG4PHP_LINE_SEP; |
|
234 | - $sbuf .= "<th>Level</th>" . LOG4PHP_LINE_SEP; |
|
235 | - $sbuf .= "<th>Category</th>" . LOG4PHP_LINE_SEP; |
|
236 | - if ($this->locationInfo) |
|
237 | - $sbuf .= "<th>File:Line</th>" . LOG4PHP_LINE_SEP; |
|
238 | - $sbuf .= "<th>Message</th>" . LOG4PHP_LINE_SEP; |
|
239 | - $sbuf .= "</tr>" . LOG4PHP_LINE_SEP; |
|
210 | + /** |
|
211 | + * @return string Returns appropriate HTML headers. |
|
212 | + */ |
|
213 | + public function getHeader() |
|
214 | + { |
|
215 | + $sbuf = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . LOG4PHP_LINE_SEP; |
|
216 | + $sbuf .= "<html>" . LOG4PHP_LINE_SEP; |
|
217 | + $sbuf .= "<head>" . LOG4PHP_LINE_SEP; |
|
218 | + $sbuf .= "<title>" . $this->title . "</title>" . LOG4PHP_LINE_SEP; |
|
219 | + $sbuf .= "<style type=\"text/css\">" . LOG4PHP_LINE_SEP; |
|
220 | + $sbuf .= "<!--" . LOG4PHP_LINE_SEP; |
|
221 | + $sbuf .= "body, table {font-family: arial,sans-serif; font-size: x-small;}" . LOG4PHP_LINE_SEP; |
|
222 | + $sbuf .= "th {background: #336699; color: #FFFFFF; text-align: left;}" . LOG4PHP_LINE_SEP; |
|
223 | + $sbuf .= "-->" . LOG4PHP_LINE_SEP; |
|
224 | + $sbuf .= "</style>" . LOG4PHP_LINE_SEP; |
|
225 | + $sbuf .= "</head>" . LOG4PHP_LINE_SEP; |
|
226 | + $sbuf .= "<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">" . LOG4PHP_LINE_SEP; |
|
227 | + $sbuf .= "<hr size=\"1\" noshade>" . LOG4PHP_LINE_SEP; |
|
228 | + $sbuf .= "Log session start time " . strftime('%c', time()) . "<br>" . LOG4PHP_LINE_SEP; |
|
229 | + $sbuf .= "<br>" . LOG4PHP_LINE_SEP; |
|
230 | + $sbuf .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" bordercolor=\"#224466\" width=\"100%\">" . LOG4PHP_LINE_SEP; |
|
231 | + $sbuf .= "<tr>" . LOG4PHP_LINE_SEP; |
|
232 | + $sbuf .= "<th>Time</th>" . LOG4PHP_LINE_SEP; |
|
233 | + $sbuf .= "<th>Thread</th>" . LOG4PHP_LINE_SEP; |
|
234 | + $sbuf .= "<th>Level</th>" . LOG4PHP_LINE_SEP; |
|
235 | + $sbuf .= "<th>Category</th>" . LOG4PHP_LINE_SEP; |
|
236 | + if ($this->locationInfo) |
|
237 | + $sbuf .= "<th>File:Line</th>" . LOG4PHP_LINE_SEP; |
|
238 | + $sbuf .= "<th>Message</th>" . LOG4PHP_LINE_SEP; |
|
239 | + $sbuf .= "</tr>" . LOG4PHP_LINE_SEP; |
|
240 | 240 | |
241 | - return $sbuf; |
|
242 | - } |
|
241 | + return $sbuf; |
|
242 | + } |
|
243 | 243 | |
244 | - /** |
|
245 | - * @return string Returns the appropriate HTML footers. |
|
246 | - */ |
|
247 | - public function getFooter() |
|
248 | - { |
|
249 | - $sbuf = "</table>" . LOG4PHP_LINE_SEP; |
|
250 | - $sbuf .= "<br>" . LOG4PHP_LINE_SEP; |
|
251 | - $sbuf .= "</body></html>"; |
|
244 | + /** |
|
245 | + * @return string Returns the appropriate HTML footers. |
|
246 | + */ |
|
247 | + public function getFooter() |
|
248 | + { |
|
249 | + $sbuf = "</table>" . LOG4PHP_LINE_SEP; |
|
250 | + $sbuf .= "<br>" . LOG4PHP_LINE_SEP; |
|
251 | + $sbuf .= "</body></html>"; |
|
252 | 252 | |
253 | - return $sbuf; |
|
254 | - } |
|
253 | + return $sbuf; |
|
254 | + } |
|
255 | 255 | } |
256 | 256 | ?> |
257 | 257 | \ No newline at end of file |
@@ -34,19 +34,19 @@ |
||
34 | 34 | */ |
35 | 35 | class LoggerDefaultCategoryFactory extends LoggerFactory { |
36 | 36 | |
37 | - public function LoggerDefaultCategoryFactory() |
|
38 | - { |
|
39 | - return; |
|
40 | - } |
|
37 | + public function LoggerDefaultCategoryFactory() |
|
38 | + { |
|
39 | + return; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param string $name |
|
44 | - * @return Logger |
|
45 | - */ |
|
46 | - public function makeNewLoggerInstance($name) |
|
47 | - { |
|
48 | - return new Logger($name); |
|
49 | - } |
|
42 | + /** |
|
43 | + * @param string $name |
|
44 | + * @return Logger |
|
45 | + */ |
|
46 | + public function makeNewLoggerInstance($name) |
|
47 | + { |
|
48 | + return new Logger($name); |
|
49 | + } |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | ?> |
53 | 53 | \ No newline at end of file |
@@ -49,216 +49,216 @@ |
||
49 | 49 | */ |
50 | 50 | class LoggerLevel { |
51 | 51 | |
52 | - /** |
|
53 | - * @var integer |
|
54 | - */ |
|
55 | - var $level; |
|
52 | + /** |
|
53 | + * @var integer |
|
54 | + */ |
|
55 | + var $level; |
|
56 | 56 | |
57 | - /** |
|
58 | - * @var string |
|
59 | - */ |
|
60 | - var $levelStr; |
|
57 | + /** |
|
58 | + * @var string |
|
59 | + */ |
|
60 | + var $levelStr; |
|
61 | 61 | |
62 | - /** |
|
63 | - * @var integer |
|
64 | - */ |
|
65 | - var $syslogEquivalent; |
|
62 | + /** |
|
63 | + * @var integer |
|
64 | + */ |
|
65 | + var $syslogEquivalent; |
|
66 | 66 | |
67 | - /** |
|
68 | - * Constructor |
|
69 | - * |
|
70 | - * @param integer $level |
|
71 | - * @param string $levelStr |
|
72 | - * @param integer $syslogEquivalent |
|
73 | - */ |
|
74 | - public function LoggerLevel($level, $levelStr, $syslogEquivalent) |
|
75 | - { |
|
76 | - $this->level = $level; |
|
77 | - $this->levelStr = $levelStr; |
|
78 | - $this->syslogEquivalent = $syslogEquivalent; |
|
79 | - } |
|
67 | + /** |
|
68 | + * Constructor |
|
69 | + * |
|
70 | + * @param integer $level |
|
71 | + * @param string $levelStr |
|
72 | + * @param integer $syslogEquivalent |
|
73 | + */ |
|
74 | + public function LoggerLevel($level, $levelStr, $syslogEquivalent) |
|
75 | + { |
|
76 | + $this->level = $level; |
|
77 | + $this->levelStr = $levelStr; |
|
78 | + $this->syslogEquivalent = $syslogEquivalent; |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Two priorities are equal if their level fields are equal. |
|
83 | - * |
|
84 | - * @param object $o |
|
85 | - * @return boolean |
|
86 | - */ |
|
87 | - public function equals($o) |
|
88 | - { |
|
89 | - if (is_a($o, 'loggerlevel')) { |
|
90 | - return ($this->level == $o->level); |
|
91 | - } else { |
|
92 | - return false; |
|
93 | - } |
|
94 | - } |
|
81 | + /** |
|
82 | + * Two priorities are equal if their level fields are equal. |
|
83 | + * |
|
84 | + * @param object $o |
|
85 | + * @return boolean |
|
86 | + */ |
|
87 | + public function equals($o) |
|
88 | + { |
|
89 | + if (is_a($o, 'loggerlevel')) { |
|
90 | + return ($this->level == $o->level); |
|
91 | + } else { |
|
92 | + return false; |
|
93 | + } |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Returns an Off Level |
|
98 | - * @static |
|
99 | - * @return LoggerLevel |
|
100 | - */ |
|
101 | - public function &getLevelOff() |
|
102 | - { |
|
103 | - static $level; |
|
104 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_OFF_INT, 'OFF', 0); |
|
105 | - return $level; |
|
106 | - } |
|
96 | + /** |
|
97 | + * Returns an Off Level |
|
98 | + * @static |
|
99 | + * @return LoggerLevel |
|
100 | + */ |
|
101 | + public function &getLevelOff() |
|
102 | + { |
|
103 | + static $level; |
|
104 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_OFF_INT, 'OFF', 0); |
|
105 | + return $level; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Returns a Fatal Level |
|
110 | - * @static |
|
111 | - * @return LoggerLevel |
|
112 | - */ |
|
113 | - public function &getLevelFatal() |
|
114 | - { |
|
115 | - static $level; |
|
116 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_FATAL_INT, 'FATAL', 0); |
|
117 | - return $level; |
|
118 | - } |
|
108 | + /** |
|
109 | + * Returns a Fatal Level |
|
110 | + * @static |
|
111 | + * @return LoggerLevel |
|
112 | + */ |
|
113 | + public function &getLevelFatal() |
|
114 | + { |
|
115 | + static $level; |
|
116 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_FATAL_INT, 'FATAL', 0); |
|
117 | + return $level; |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Returns an Error Level |
|
122 | - * @static |
|
123 | - * @return LoggerLevel |
|
124 | - */ |
|
125 | - public function &getLevelError() |
|
126 | - { |
|
127 | - static $level; |
|
128 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3); |
|
129 | - return $level; |
|
130 | - } |
|
120 | + /** |
|
121 | + * Returns an Error Level |
|
122 | + * @static |
|
123 | + * @return LoggerLevel |
|
124 | + */ |
|
125 | + public function &getLevelError() |
|
126 | + { |
|
127 | + static $level; |
|
128 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3); |
|
129 | + return $level; |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Returns a Warn Level |
|
134 | - * @static |
|
135 | - * @return LoggerLevel |
|
136 | - */ |
|
137 | - public function &getLevelWarn() |
|
138 | - { |
|
139 | - static $level; |
|
140 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_WARN_INT, 'WARN', 4); |
|
141 | - return $level; |
|
142 | - } |
|
132 | + /** |
|
133 | + * Returns a Warn Level |
|
134 | + * @static |
|
135 | + * @return LoggerLevel |
|
136 | + */ |
|
137 | + public function &getLevelWarn() |
|
138 | + { |
|
139 | + static $level; |
|
140 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_WARN_INT, 'WARN', 4); |
|
141 | + return $level; |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * Returns an Info Level |
|
146 | - * @static |
|
147 | - * @return LoggerLevel |
|
148 | - */ |
|
149 | - public function &getLevelInfo() |
|
150 | - { |
|
151 | - static $level; |
|
152 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_INFO_INT, 'INFO', 6); |
|
153 | - return $level; |
|
154 | - } |
|
144 | + /** |
|
145 | + * Returns an Info Level |
|
146 | + * @static |
|
147 | + * @return LoggerLevel |
|
148 | + */ |
|
149 | + public function &getLevelInfo() |
|
150 | + { |
|
151 | + static $level; |
|
152 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_INFO_INT, 'INFO', 6); |
|
153 | + return $level; |
|
154 | + } |
|
155 | 155 | |
156 | - /** |
|
157 | - * Returns a Debug Level |
|
158 | - * @static |
|
159 | - * @return LoggerLevel |
|
160 | - */ |
|
161 | - public function &getLevelDebug() |
|
162 | - { |
|
163 | - static $level; |
|
164 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7); |
|
165 | - return $level; |
|
166 | - } |
|
156 | + /** |
|
157 | + * Returns a Debug Level |
|
158 | + * @static |
|
159 | + * @return LoggerLevel |
|
160 | + */ |
|
161 | + public function &getLevelDebug() |
|
162 | + { |
|
163 | + static $level; |
|
164 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7); |
|
165 | + return $level; |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * Returns an All Level |
|
170 | - * @static |
|
171 | - * @return LoggerLevel |
|
172 | - */ |
|
173 | - public function &getLevelAll() |
|
174 | - { |
|
175 | - static $level; |
|
176 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ALL_INT, 'ALL', 7); |
|
177 | - return $level; |
|
178 | - } |
|
168 | + /** |
|
169 | + * Returns an All Level |
|
170 | + * @static |
|
171 | + * @return LoggerLevel |
|
172 | + */ |
|
173 | + public function &getLevelAll() |
|
174 | + { |
|
175 | + static $level; |
|
176 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ALL_INT, 'ALL', 7); |
|
177 | + return $level; |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
181 | - * Return the syslog equivalent of this priority as an integer. |
|
182 | - * @final |
|
183 | - * @return integer |
|
184 | - */ |
|
185 | - public function getSyslogEquivalent() |
|
186 | - { |
|
187 | - return $this->syslogEquivalent; |
|
188 | - } |
|
180 | + /** |
|
181 | + * Return the syslog equivalent of this priority as an integer. |
|
182 | + * @final |
|
183 | + * @return integer |
|
184 | + */ |
|
185 | + public function getSyslogEquivalent() |
|
186 | + { |
|
187 | + return $this->syslogEquivalent; |
|
188 | + } |
|
189 | 189 | |
190 | - /** |
|
191 | - * Returns <i>true</i> if this level has a higher or equal |
|
192 | - * level than the level passed as argument, <i>false</i> |
|
193 | - * otherwise. |
|
194 | - * |
|
195 | - * <p>You should think twice before overriding the default |
|
196 | - * implementation of <i>isGreaterOrEqual</i> method. |
|
197 | - * |
|
198 | - * @param LoggerLevel $r |
|
199 | - * @return boolean |
|
200 | - */ |
|
201 | - public function isGreaterOrEqual($r) |
|
202 | - { |
|
203 | - return $this->level >= $r->level; |
|
204 | - } |
|
190 | + /** |
|
191 | + * Returns <i>true</i> if this level has a higher or equal |
|
192 | + * level than the level passed as argument, <i>false</i> |
|
193 | + * otherwise. |
|
194 | + * |
|
195 | + * <p>You should think twice before overriding the default |
|
196 | + * implementation of <i>isGreaterOrEqual</i> method. |
|
197 | + * |
|
198 | + * @param LoggerLevel $r |
|
199 | + * @return boolean |
|
200 | + */ |
|
201 | + public function isGreaterOrEqual($r) |
|
202 | + { |
|
203 | + return $this->level >= $r->level; |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * Returns the string representation of this priority. |
|
208 | - * @return string |
|
209 | - * @final |
|
210 | - */ |
|
211 | - public function toString() |
|
212 | - { |
|
213 | - return $this->levelStr; |
|
214 | - } |
|
206 | + /** |
|
207 | + * Returns the string representation of this priority. |
|
208 | + * @return string |
|
209 | + * @final |
|
210 | + */ |
|
211 | + public function toString() |
|
212 | + { |
|
213 | + return $this->levelStr; |
|
214 | + } |
|
215 | 215 | |
216 | - /** |
|
217 | - * Returns the integer representation of this level. |
|
218 | - * @return integer |
|
219 | - */ |
|
220 | - public function toInt() |
|
221 | - { |
|
222 | - return $this->level; |
|
223 | - } |
|
216 | + /** |
|
217 | + * Returns the integer representation of this level. |
|
218 | + * @return integer |
|
219 | + */ |
|
220 | + public function toInt() |
|
221 | + { |
|
222 | + return $this->level; |
|
223 | + } |
|
224 | 224 | |
225 | - /** |
|
226 | - * Convert the string passed as argument to a level. If the |
|
227 | - * conversion fails, then this method returns a DEBUG Level. |
|
228 | - * |
|
229 | - * @param mixed $arg |
|
230 | - * @param LoggerLevel $default |
|
231 | - * @static |
|
232 | - */ |
|
233 | - public function &toLevel($arg, $defaultLevel = null) |
|
234 | - { |
|
235 | - if ($defaultLevel === null) { |
|
236 | - return LoggerLevel::toLevel($arg, LoggerLevel::getLevelDebug()); |
|
237 | - } else { |
|
238 | - if (is_int($arg)) { |
|
239 | - switch($arg) { |
|
240 | - case LOG4PHP_LEVEL_ALL_INT: return LoggerLevel::getLevelAll(); |
|
241 | - case LOG4PHP_LEVEL_DEBUG_INT: return LoggerLevel::getLevelDebug(); |
|
242 | - case LOG4PHP_LEVEL_INFO_INT: return LoggerLevel::getLevelInfo(); |
|
243 | - case LOG4PHP_LEVEL_WARN_INT: return LoggerLevel::getLevelWarn(); |
|
244 | - case LOG4PHP_LEVEL_ERROR_INT: return LoggerLevel::getLevelError(); |
|
245 | - case LOG4PHP_LEVEL_FATAL_INT: return LoggerLevel::getLevelFatal(); |
|
246 | - case LOG4PHP_LEVEL_OFF_INT: return LoggerLevel::getLevelOff(); |
|
247 | - default: return $defaultLevel; |
|
248 | - } |
|
249 | - } else { |
|
250 | - switch(strtoupper($arg)) { |
|
251 | - case 'ALL': return LoggerLevel::getLevelAll(); |
|
252 | - case 'DEBUG': return LoggerLevel::getLevelDebug(); |
|
253 | - case 'INFO': return LoggerLevel::getLevelInfo(); |
|
254 | - case 'WARN': return LoggerLevel::getLevelWarn(); |
|
255 | - case 'ERROR': return LoggerLevel::getLevelError(); |
|
256 | - case 'FATAL': return LoggerLevel::getLevelFatal(); |
|
257 | - case 'OFF': return LoggerLevel::getLevelOff(); |
|
258 | - default: return $defaultLevel; |
|
259 | - } |
|
260 | - } |
|
261 | - } |
|
262 | - } |
|
225 | + /** |
|
226 | + * Convert the string passed as argument to a level. If the |
|
227 | + * conversion fails, then this method returns a DEBUG Level. |
|
228 | + * |
|
229 | + * @param mixed $arg |
|
230 | + * @param LoggerLevel $default |
|
231 | + * @static |
|
232 | + */ |
|
233 | + public function &toLevel($arg, $defaultLevel = null) |
|
234 | + { |
|
235 | + if ($defaultLevel === null) { |
|
236 | + return LoggerLevel::toLevel($arg, LoggerLevel::getLevelDebug()); |
|
237 | + } else { |
|
238 | + if (is_int($arg)) { |
|
239 | + switch($arg) { |
|
240 | + case LOG4PHP_LEVEL_ALL_INT: return LoggerLevel::getLevelAll(); |
|
241 | + case LOG4PHP_LEVEL_DEBUG_INT: return LoggerLevel::getLevelDebug(); |
|
242 | + case LOG4PHP_LEVEL_INFO_INT: return LoggerLevel::getLevelInfo(); |
|
243 | + case LOG4PHP_LEVEL_WARN_INT: return LoggerLevel::getLevelWarn(); |
|
244 | + case LOG4PHP_LEVEL_ERROR_INT: return LoggerLevel::getLevelError(); |
|
245 | + case LOG4PHP_LEVEL_FATAL_INT: return LoggerLevel::getLevelFatal(); |
|
246 | + case LOG4PHP_LEVEL_OFF_INT: return LoggerLevel::getLevelOff(); |
|
247 | + default: return $defaultLevel; |
|
248 | + } |
|
249 | + } else { |
|
250 | + switch(strtoupper($arg)) { |
|
251 | + case 'ALL': return LoggerLevel::getLevelAll(); |
|
252 | + case 'DEBUG': return LoggerLevel::getLevelDebug(); |
|
253 | + case 'INFO': return LoggerLevel::getLevelInfo(); |
|
254 | + case 'WARN': return LoggerLevel::getLevelWarn(); |
|
255 | + case 'ERROR': return LoggerLevel::getLevelError(); |
|
256 | + case 'FATAL': return LoggerLevel::getLevelFatal(); |
|
257 | + case 'OFF': return LoggerLevel::getLevelOff(); |
|
258 | + default: return $defaultLevel; |
|
259 | + } |
|
260 | + } |
|
261 | + } |
|
262 | + } |
|
263 | 263 | } |
264 | 264 | ?> |
265 | 265 | \ No newline at end of file |
@@ -40,77 +40,77 @@ |
||
40 | 40 | */ |
41 | 41 | class LoggerLocationInfo { |
42 | 42 | |
43 | - /** |
|
44 | - * @var string Caller's line number. |
|
45 | - */ |
|
46 | - var $lineNumber = null; |
|
43 | + /** |
|
44 | + * @var string Caller's line number. |
|
45 | + */ |
|
46 | + var $lineNumber = null; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @var string Caller's file name. |
|
50 | - */ |
|
51 | - var $fileName = null; |
|
48 | + /** |
|
49 | + * @var string Caller's file name. |
|
50 | + */ |
|
51 | + var $fileName = null; |
|
52 | 52 | |
53 | - /** |
|
54 | - * @var string Caller's fully qualified class name. |
|
55 | - */ |
|
56 | - var $className = null; |
|
53 | + /** |
|
54 | + * @var string Caller's fully qualified class name. |
|
55 | + */ |
|
56 | + var $className = null; |
|
57 | 57 | |
58 | - /** |
|
59 | - * @var string Caller's method name. |
|
60 | - */ |
|
61 | - var $methodName = null; |
|
58 | + /** |
|
59 | + * @var string Caller's method name. |
|
60 | + */ |
|
61 | + var $methodName = null; |
|
62 | 62 | |
63 | - /** |
|
64 | - * @var string |
|
65 | - */ |
|
66 | - var $fullInfo = null; |
|
63 | + /** |
|
64 | + * @var string |
|
65 | + */ |
|
66 | + var $fullInfo = null; |
|
67 | 67 | |
68 | - /** |
|
69 | - * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}. |
|
70 | - * |
|
71 | - * @param array $trace |
|
72 | - * @param mixed $caller |
|
73 | - */ |
|
74 | - public function LoggerLocationInfo($trace, $fqcn = null) |
|
75 | - { |
|
76 | - $this->lineNumber = isset($trace['line']) ? $trace['line'] : null; |
|
77 | - $this->fileName = isset($trace['file']) ? $trace['file'] : null; |
|
78 | - $this->className = isset($trace['class']) ? $trace['class'] : null; |
|
79 | - $this->methodName = isset($trace['function']) ? $trace['function'] : null; |
|
68 | + /** |
|
69 | + * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}. |
|
70 | + * |
|
71 | + * @param array $trace |
|
72 | + * @param mixed $caller |
|
73 | + */ |
|
74 | + public function LoggerLocationInfo($trace, $fqcn = null) |
|
75 | + { |
|
76 | + $this->lineNumber = isset($trace['line']) ? $trace['line'] : null; |
|
77 | + $this->fileName = isset($trace['file']) ? $trace['file'] : null; |
|
78 | + $this->className = isset($trace['class']) ? $trace['class'] : null; |
|
79 | + $this->methodName = isset($trace['function']) ? $trace['function'] : null; |
|
80 | 80 | |
81 | - $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . |
|
82 | - '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')'; |
|
83 | - } |
|
81 | + $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . |
|
82 | + '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')'; |
|
83 | + } |
|
84 | 84 | |
85 | - public function getClassName() |
|
86 | - { |
|
87 | - return ($this->className === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->className; |
|
88 | - } |
|
85 | + public function getClassName() |
|
86 | + { |
|
87 | + return ($this->className === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->className; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Return the file name of the caller. |
|
92 | - * <p>This information is not always available. |
|
93 | - */ |
|
94 | - public function getFileName() |
|
95 | - { |
|
96 | - return ($this->fileName === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->fileName; |
|
97 | - } |
|
90 | + /** |
|
91 | + * Return the file name of the caller. |
|
92 | + * <p>This information is not always available. |
|
93 | + */ |
|
94 | + public function getFileName() |
|
95 | + { |
|
96 | + return ($this->fileName === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->fileName; |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Returns the line number of the caller. |
|
101 | - * <p>This information is not always available. |
|
102 | - */ |
|
103 | - public function getLineNumber() |
|
104 | - { |
|
105 | - return ($this->lineNumber === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->lineNumber; |
|
106 | - } |
|
99 | + /** |
|
100 | + * Returns the line number of the caller. |
|
101 | + * <p>This information is not always available. |
|
102 | + */ |
|
103 | + public function getLineNumber() |
|
104 | + { |
|
105 | + return ($this->lineNumber === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->lineNumber; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Returns the method name of the caller. |
|
110 | - */ |
|
111 | - public function getMethodName() |
|
112 | - { |
|
113 | - return ($this->methodName === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->methodName; |
|
114 | - } |
|
108 | + /** |
|
109 | + * Returns the method name of the caller. |
|
110 | + */ |
|
111 | + public function getMethodName() |
|
112 | + { |
|
113 | + return ($this->methodName === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->methodName; |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | ?> |
117 | 117 | \ No newline at end of file |
@@ -57,9 +57,9 @@ |
||
57 | 57 | * @param string $url The URL to parse |
58 | 58 | * @param LoggerHierarchy &$repository The hierarchy to operation upon. |
59 | 59 | */ |
60 | - public function doConfigure($url, &$repository) |
|
61 | - { |
|
62 | - return; |
|
63 | - } |
|
60 | + public function doConfigure($url, &$repository) |
|
61 | + { |
|
62 | + return; |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | ?> |
66 | 66 | \ No newline at end of file |
@@ -37,16 +37,16 @@ |
||
37 | 37 | */ |
38 | 38 | class LoggerFactory { |
39 | 39 | |
40 | - /** |
|
41 | - * @abstract |
|
42 | - * @param string $name |
|
43 | - * @return Logger |
|
44 | - */ |
|
45 | - public function makeNewLoggerInstance($name) |
|
46 | - { |
|
47 | - LoggerLog::warn("LoggerFactory:: makeNewLoggerInstance() is abstract."); |
|
48 | - return null; |
|
49 | - } |
|
40 | + /** |
|
41 | + * @abstract |
|
42 | + * @param string $name |
|
43 | + * @return Logger |
|
44 | + */ |
|
45 | + public function makeNewLoggerInstance($name) |
|
46 | + { |
|
47 | + LoggerLog::warn("LoggerFactory:: makeNewLoggerInstance() is abstract."); |
|
48 | + return null; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | ?> |
53 | 53 | \ No newline at end of file |
@@ -79,35 +79,35 @@ |
||
79 | 79 | */ |
80 | 80 | class LoggerFilter { |
81 | 81 | |
82 | - /** |
|
83 | - * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain. |
|
84 | - */ |
|
85 | - var $next; |
|
82 | + /** |
|
83 | + * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain. |
|
84 | + */ |
|
85 | + var $next; |
|
86 | 86 | |
87 | - /** |
|
88 | - * Usually filters options become active when set. We provide a |
|
89 | - * default do-nothing implementation for convenience. |
|
90 | - */ |
|
91 | - public function activateOptions() |
|
92 | - { |
|
93 | - return; |
|
94 | - } |
|
87 | + /** |
|
88 | + * Usually filters options become active when set. We provide a |
|
89 | + * default do-nothing implementation for convenience. |
|
90 | + */ |
|
91 | + public function activateOptions() |
|
92 | + { |
|
93 | + return; |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Decide what to do. |
|
98 | - * <p>If the decision is {@link LOG4PHP_LOGGER_FILTER_DENY}, then the event will be |
|
99 | - * dropped. If the decision is {@link LOG4PHP_LOGGER_FILTER_NEUTRAL}, then the next |
|
100 | - * filter, if any, will be invoked. If the decision is {@link LOG4PHP_LOGGER_FILTER_ACCEPT} then |
|
101 | - * the event will be logged without consulting with other filters in |
|
102 | - * the chain. |
|
103 | - * |
|
104 | - * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon. |
|
105 | - * @return integer {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} or {@link LOG4PHP_LOGGER_FILTER_DENY}|{@link LOG4PHP_LOGGER_FILTER_ACCEPT} |
|
106 | - */ |
|
107 | - public function decide($event) |
|
108 | - { |
|
109 | - return LOG4PHP_LOGGER_FILTER_NEUTRAL; |
|
110 | - } |
|
96 | + /** |
|
97 | + * Decide what to do. |
|
98 | + * <p>If the decision is {@link LOG4PHP_LOGGER_FILTER_DENY}, then the event will be |
|
99 | + * dropped. If the decision is {@link LOG4PHP_LOGGER_FILTER_NEUTRAL}, then the next |
|
100 | + * filter, if any, will be invoked. If the decision is {@link LOG4PHP_LOGGER_FILTER_ACCEPT} then |
|
101 | + * the event will be logged without consulting with other filters in |
|
102 | + * the chain. |
|
103 | + * |
|
104 | + * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon. |
|
105 | + * @return integer {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} or {@link LOG4PHP_LOGGER_FILTER_DENY}|{@link LOG4PHP_LOGGER_FILTER_ACCEPT} |
|
106 | + */ |
|
107 | + public function decide($event) |
|
108 | + { |
|
109 | + return LOG4PHP_LOGGER_FILTER_NEUTRAL; |
|
110 | + } |
|
111 | 111 | |
112 | 112 | } |
113 | 113 | ?> |
114 | 114 | \ No newline at end of file |