@@ -69,8 +69,8 @@ |
||
69 | 69 | $this->fileName = isset($trace['file']) ? $trace['file'] : null; |
70 | 70 | $this->className = isset($trace['class']) ? $trace['class'] : null; |
71 | 71 | $this->methodName = isset($trace['function']) ? $trace['function'] : null; |
72 | - $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . |
|
73 | - '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')'; |
|
72 | + $this->fullInfo = $this->getClassName().'.'.$this->getMethodName(). |
|
73 | + '('.$this->getFileName().':'.$this->getLineNumber().')'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function getClassName() { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $l the level min to match |
91 | 91 | */ |
92 | 92 | public function setLevelMin($l) { |
93 | - if($l instanceof LoggerLevel) { |
|
93 | + if ($l instanceof LoggerLevel) { |
|
94 | 94 | $this->levelMin = $l; |
95 | 95 | } else { |
96 | 96 | $this->levelMin = LoggerOptionConverter::toLevel($l, null); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param string $l the level max to match |
102 | 102 | */ |
103 | 103 | public function setLevelMax($l) { |
104 | - if($l instanceof LoggerLevel) { |
|
104 | + if ($l instanceof LoggerLevel) { |
|
105 | 105 | $this->levelMax = $l; |
106 | 106 | } else { |
107 | 107 | $this->levelMax = LoggerOptionConverter::toLevel($l, null); |
@@ -117,15 +117,15 @@ discard block |
||
117 | 117 | public function decide(LoggerLoggingEvent $event) { |
118 | 118 | $level = $event->getLevel(); |
119 | 119 | |
120 | - if($this->levelMin !== null) { |
|
121 | - if($level->isGreaterOrEqual($this->levelMin) == false) { |
|
120 | + if ($this->levelMin !== null) { |
|
121 | + if ($level->isGreaterOrEqual($this->levelMin) == false) { |
|
122 | 122 | // level of event is less than minimum |
123 | 123 | return LoggerFilter::DENY; |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - if($this->levelMax !== null) { |
|
128 | - if($level->toInt() > $this->levelMax->toInt()) { |
|
127 | + if ($this->levelMax !== null) { |
|
128 | + if ($level->toInt() > $this->levelMax->toInt()) { |
|
129 | 129 | // level of event is greater than maximum |
130 | 130 | // Alas, there is no Level.isGreater method. and using |
131 | 131 | // a combo of isGreaterOrEqual && !Equal seems worse than |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - if($this->acceptOnMatch) { |
|
137 | + if ($this->acceptOnMatch) { |
|
138 | 138 | // this filter set up to bypass later filters and always return |
139 | 139 | // accept if level in range |
140 | 140 | return LoggerFilter::ACCEPT; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false') |
62 | 62 | */ |
63 | 63 | public function setAcceptOnMatch($acceptOnMatch) { |
64 | - $this->acceptOnMatch = is_bool($acceptOnMatch) ? $acceptOnMatch : (bool)(strtolower($acceptOnMatch) == 'true'); |
|
64 | + $this->acceptOnMatch = is_bool($acceptOnMatch) ? $acceptOnMatch : (bool) (strtolower($acceptOnMatch) == 'true'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | public function decide(LoggerLoggingEvent $event) { |
78 | 78 | $msg = $event->getRenderedMessage(); |
79 | 79 | |
80 | - if($msg === null or $this->stringToMatch === null) { |
|
80 | + if ($msg === null or $this->stringToMatch === null) { |
|
81 | 81 | return LoggerFilter::NEUTRAL; |
82 | 82 | } |
83 | 83 | |
84 | - if(strpos($msg, $this->stringToMatch) !== false ) { |
|
84 | + if (strpos($msg, $this->stringToMatch) !== false) { |
|
85 | 85 | return ($this->acceptOnMatch) ? LoggerFilter::ACCEPT : LoggerFilter::DENY; |
86 | 86 | } |
87 | 87 | return LoggerFilter::NEUTRAL; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $l the level to match |
71 | 71 | */ |
72 | 72 | public function setLevelToMatch($l) { |
73 | - if($l instanceof LoggerLevel) { |
|
73 | + if ($l instanceof LoggerLevel) { |
|
74 | 74 | $this->levelToMatch = $l; |
75 | 75 | } else { |
76 | 76 | $this->levelToMatch = LoggerOptionConverter::toLevel($l, null); |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | * @return integer |
92 | 92 | */ |
93 | 93 | public function decide(LoggerLoggingEvent $event) { |
94 | - if($this->levelToMatch === null) { |
|
94 | + if ($this->levelToMatch === null) { |
|
95 | 95 | return LoggerFilter::NEUTRAL; |
96 | 96 | } |
97 | 97 | |
98 | - if($this->levelToMatch->equals($event->getLevel())) { |
|
98 | + if ($this->levelToMatch->equals($event->getLevel())) { |
|
99 | 99 | return $this->acceptOnMatch ? LoggerFilter::ACCEPT : LoggerFilter::DENY; |
100 | 100 | } else { |
101 | 101 | return LoggerFilter::NEUTRAL; |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | * @return Logger |
112 | 112 | */ |
113 | 113 | public function getLogger($name) { |
114 | - if(!isset($this->ht[$name])) { |
|
115 | - $this->ht[$name] = new Logger($name);; |
|
114 | + if (!isset($this->ht[$name])) { |
|
115 | + $this->ht[$name] = new Logger($name); ; |
|
116 | 116 | // TODO: isn't necessary, access via singleton? |
117 | 117 | // $this->ht[$name]->setHierarchy($this); |
118 | 118 | $nodes = explode('.', $name); |
119 | 119 | $firstNode = array_shift($nodes); |
120 | 120 | |
121 | 121 | // if name is not a first node but another first node is their |
122 | - if($firstNode != $name and isset($this->ht[$firstNode])) { |
|
122 | + if ($firstNode != $name and isset($this->ht[$firstNode])) { |
|
123 | 123 | $this->ht[$name]->setParent($this->ht[$firstNode]); |
124 | 124 | } else { |
125 | 125 | // if there is no father, set root logger as father |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | // if there are more nodes than one |
130 | - if(count($nodes) > 0) { |
|
130 | + if (count($nodes) > 0) { |
|
131 | 131 | // find parent node |
132 | - foreach($nodes as $node) { |
|
132 | + foreach ($nodes as $node) { |
|
133 | 133 | $parentNode = "$firstNode.$node"; |
134 | - if(isset($this->ht[$parentNode]) and $parentNode != $name) { |
|
134 | + if (isset($this->ht[$parentNode]) and $parentNode != $name) { |
|
135 | 135 | |
136 | 136 | $this->ht[$name]->setParent($this->ht[$parentNode]); |
137 | 137 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @return LoggerRoot Get the root of this hierarchy. |
155 | 155 | */ |
156 | 156 | public function getRootLogger() { |
157 | - if(!isset($this->root) or $this->root == null) { |
|
157 | + if (!isset($this->root) or $this->root == null) { |
|
158 | 158 | $this->root = new LoggerRoot(); |
159 | 159 | } |
160 | 160 | return $this->root; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $this->shutDown(); |
200 | 200 | $loggers = $this->getCurrentLoggers(); |
201 | 201 | $enumLoggers = count($loggers); |
202 | - for($i = 0; $i < $enumLoggers; $i++) { |
|
202 | + for ($i = 0; $i < $enumLoggers; $i++) { |
|
203 | 203 | $loggers[$i]->setLevel(null); |
204 | 204 | $loggers[$i]->setAdditivity(true); |
205 | 205 | $loggers[$i]->removeAllAppenders(); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param LoggerLevel $l |
214 | 214 | */ |
215 | 215 | public function setThreshold(LoggerLevel $l) { |
216 | - if($l !== null) { |
|
216 | + if ($l !== null) { |
|
217 | 217 | $this->threshold = $l; |
218 | 218 | } |
219 | 219 | } |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | $this->root->removeAllAppenders(); |
237 | 237 | $cats = $this->getCurrentLoggers(); |
238 | 238 | $enumCats = count($cats); |
239 | - if($enumCats > 0) { |
|
240 | - for($i = 0; $i < $enumCats; $i++) { |
|
239 | + if ($enumCats > 0) { |
|
240 | + for ($i = 0; $i < $enumCats; $i++) { |
|
241 | 241 | $cats[$i]->removeAllAppenders(); |
242 | 242 | } |
243 | 243 | } |
@@ -47,33 +47,33 @@ discard block |
||
47 | 47 | $config = require $url; |
48 | 48 | |
49 | 49 | // set threshold |
50 | - if(isset($config['threshold'])) { |
|
50 | + if (isset($config['threshold'])) { |
|
51 | 51 | $hierarchy->setThreshold(LoggerOptionConverter::toLevel($config['threshold'], LoggerLevel::getLevelAll())); |
52 | 52 | } |
53 | 53 | |
54 | 54 | // parse and create appenders |
55 | - if(isset($config['appenders'])) { |
|
55 | + if (isset($config['appenders'])) { |
|
56 | 56 | |
57 | - foreach($config['appenders'] as $appenderName => $appenderProperties) { |
|
57 | + foreach ($config['appenders'] as $appenderName => $appenderProperties) { |
|
58 | 58 | |
59 | 59 | $appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderProperties['class']); |
60 | 60 | |
61 | - if($appender->requiresLayout()) { |
|
61 | + if ($appender->requiresLayout()) { |
|
62 | 62 | |
63 | - if(isset($appenderProperties['layout'])) { |
|
63 | + if (isset($appenderProperties['layout'])) { |
|
64 | 64 | |
65 | - if(isset($appenderProperties['layout']['class']) and !empty($appenderProperties['layout']['class'])) { |
|
65 | + if (isset($appenderProperties['layout']['class']) and !empty($appenderProperties['layout']['class'])) { |
|
66 | 66 | $layoutClass = $appenderProperties['layout']['class']; |
67 | 67 | } else { |
68 | 68 | $layoutClass = 'LoggerLayoutSimple'; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $layout = LoggerReflectionUtils::createObject($layoutClass); |
72 | - if($layout === null) { |
|
72 | + if ($layout === null) { |
|
73 | 73 | $layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple'); |
74 | 74 | } |
75 | 75 | |
76 | - if($layout instanceof LoggerLayoutPattern) { |
|
76 | + if ($layout instanceof LoggerLayoutPattern) { |
|
77 | 77 | $layout->setConversionPattern($appenderProperties['layout']['conversionPattern']); |
78 | 78 | } |
79 | 79 | |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | // parse and create root logger |
93 | - if(isset($config['rootLogger'])) { |
|
93 | + if (isset($config['rootLogger'])) { |
|
94 | 94 | $rootLogger = $hierarchy->getRootLogger(); |
95 | - if(isset($config['rootLogger']['level'])) { |
|
95 | + if (isset($config['rootLogger']['level'])) { |
|
96 | 96 | $rootLogger->setLevel(LoggerOptionConverter::toLevel($config['rootLogger']['level'], LoggerLevel::getLevelDebug())); |
97 | - if(isset($config['rootLogger']['appenders'])) { |
|
98 | - foreach($config['rootLogger']['appenders'] as $appenderName) { |
|
97 | + if (isset($config['rootLogger']['appenders'])) { |
|
98 | + foreach ($config['rootLogger']['appenders'] as $appenderName) { |
|
99 | 99 | $appender = LoggerAppenderPool::getAppenderFromPool($appenderName); |
100 | - if($appender !== null) { |
|
100 | + if ($appender !== null) { |
|
101 | 101 | $rootLogger->addAppender($appender); |
102 | 102 | } |
103 | 103 | } |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | // parse and create loggers |
109 | - if(isset($config['loggers'])) { |
|
110 | - foreach($config['loggers'] as $loggerName => $loggerProperties) { |
|
111 | - if(is_string($loggerName)) { |
|
109 | + if (isset($config['loggers'])) { |
|
110 | + foreach ($config['loggers'] as $loggerName => $loggerProperties) { |
|
111 | + if (is_string($loggerName)) { |
|
112 | 112 | $logger = $hierarchy->getLogger($loggerName); |
113 | 113 | |
114 | - if(isset($loggerProperties['level'])) { |
|
114 | + if (isset($loggerProperties['level'])) { |
|
115 | 115 | $logger->setLevel(LoggerOptionConverter::toLevel($loggerProperties['level'], LoggerLevel::getLevelDebug())); |
116 | - if(isset($loggerProperties['appenders'])) { |
|
117 | - foreach($loggerProperties['appenders'] as $appenderName) { |
|
116 | + if (isset($loggerProperties['appenders'])) { |
|
117 | + foreach ($loggerProperties['appenders'] as $appenderName) { |
|
118 | 118 | $appender = LoggerAppenderPool::getAppenderFromPool($appenderName); |
119 | - if($appender !== null) { |
|
119 | + if ($appender !== null) { |
|
120 | 120 | $logger->addAppender($appender); |
121 | 121 | } |
122 | 122 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | public function configure(LoggerHierarchy $hierarchy, $url = null) { |
41 | 41 | $root = $hierarchy->getRootLogger(); |
42 | 42 | $appender = new LoggerAppenderConsole('A1'); |
43 | - $appender->setLayout( new LoggerLayoutTTCC() ); |
|
43 | + $appender->setLayout(new LoggerLayoutTTCC()); |
|
44 | 44 | $appender->activateOptions(); |
45 | 45 | $root->addAppender($appender); |
46 | 46 | } |
@@ -313,16 +313,16 @@ discard block |
||
313 | 313 | $effectivePrefix = self::ROOT_LOGGER_PREFIX; |
314 | 314 | $value = @$props[self::ROOT_LOGGER_PREFIX]; |
315 | 315 | |
316 | - if(empty($value)) { |
|
316 | + if (empty($value)) { |
|
317 | 317 | $value = @$props[self::ROOT_CATEGORY_PREFIX]; |
318 | 318 | $effectivePrefix = self::ROOT_CATEGORY_PREFIX; |
319 | 319 | } |
320 | 320 | |
321 | - if(empty($value)) { |
|
321 | + if (empty($value)) { |
|
322 | 322 | // TODO "Could not find root logger information. Is this OK?" |
323 | 323 | } else { |
324 | 324 | $root = $hierarchy->getRootLogger(); |
325 | - $this->parseCategory($props, $root, $effectivePrefix, self::INTERNAL_ROOT_NAME, $value); |
|
325 | + $this->parseCategory($props, $root, $effectivePrefix, self::INTERNAL_ROOT_NAME, $value); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
@@ -333,19 +333,19 @@ discard block |
||
333 | 333 | * @param LoggerHierarchy $hierarchy |
334 | 334 | */ |
335 | 335 | private function parseCatsAndRenderers($props, LoggerHierarchy $hierarchy) { |
336 | - while(list($key,$value) = each($props)) { |
|
337 | - if(strpos($key, self::CATEGORY_PREFIX) === 0 or |
|
336 | + while (list($key, $value) = each($props)) { |
|
337 | + if (strpos($key, self::CATEGORY_PREFIX) === 0 or |
|
338 | 338 | strpos($key, self::LOGGER_PREFIX) === 0) { |
339 | - if(strpos($key, self::CATEGORY_PREFIX) === 0) { |
|
339 | + if (strpos($key, self::CATEGORY_PREFIX) === 0) { |
|
340 | 340 | $loggerName = substr($key, strlen(self::CATEGORY_PREFIX)); |
341 | - } else if(strpos($key, self::LOGGER_PREFIX) === 0) { |
|
341 | + } else if (strpos($key, self::LOGGER_PREFIX) === 0) { |
|
342 | 342 | $loggerName = substr($key, strlen(self::LOGGER_PREFIX)); |
343 | 343 | } |
344 | 344 | |
345 | 345 | $logger = $hierarchy->getLogger($loggerName); |
346 | 346 | $this->parseCategory($props, $logger, $key, $loggerName, $value); |
347 | 347 | $this->parseAdditivityForLogger($props, $logger, $loggerName); |
348 | - } else if(strpos($key, self::RENDERER_PREFIX) === 0) { |
|
348 | + } else if (strpos($key, self::RENDERER_PREFIX) === 0) { |
|
349 | 349 | $renderedClass = substr($key, strlen(self::RENDERER_PREFIX)); |
350 | 350 | $renderingClass = $value; |
351 | 351 | $hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClass); |
@@ -361,10 +361,10 @@ discard block |
||
361 | 361 | * @param string $loggerName |
362 | 362 | */ |
363 | 363 | private function parseAdditivityForLogger($props, Logger $cat, $loggerName) { |
364 | - $value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX . $loggerName, $props); |
|
364 | + $value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX.$loggerName, $props); |
|
365 | 365 | |
366 | 366 | // touch additivity only if necessary |
367 | - if(!empty($value)) { |
|
367 | + if (!empty($value)) { |
|
368 | 368 | $additivity = LoggerOptionConverter::toBoolean($value, true); |
369 | 369 | $cat->setAdditivity($additivity); |
370 | 370 | } |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | // If value is not in the form ", appender.." or "", then we should set |
388 | 388 | // the level of the loggeregory. |
389 | 389 | |
390 | - if(!(empty($value) || @$value[0] == ',')) { |
|
390 | + if (!(empty($value) || @$value[0] == ',')) { |
|
391 | 391 | // just to be on the safe side... |
392 | - if(count($st) == 0) { |
|
392 | + if (count($st) == 0) { |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | $levelStr = current($st); |
@@ -397,8 +397,8 @@ discard block |
||
397 | 397 | // If the level value is inherited, set category level value to |
398 | 398 | // null. We also check that the user has not specified inherited for the |
399 | 399 | // root category. |
400 | - if('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) { |
|
401 | - if($loggerName == self::INTERNAL_ROOT_NAME) { |
|
400 | + if ('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) { |
|
401 | + if ($loggerName == self::INTERNAL_ROOT_NAME) { |
|
402 | 402 | // TODO: throw exception? "The root logger cannot be set to null." |
403 | 403 | } else { |
404 | 404 | $logger->setLevel(null); |
@@ -410,14 +410,14 @@ discard block |
||
410 | 410 | |
411 | 411 | // TODO: removing should be done by the logger, if necessary and wanted |
412 | 412 | // $logger->removeAllAppenders(); |
413 | - while($appenderName = next($st)) { |
|
413 | + while ($appenderName = next($st)) { |
|
414 | 414 | $appenderName = trim($appenderName); |
415 | - if(empty($appenderName)) { |
|
415 | + if (empty($appenderName)) { |
|
416 | 416 | continue; |
417 | 417 | } |
418 | 418 | |
419 | 419 | $appender = $this->parseAppender($props, $appenderName); |
420 | - if($appender !== null) { |
|
420 | + if ($appender !== null) { |
|
421 | 421 | $logger->addAppender($appender); |
422 | 422 | } |
423 | 423 | } |
@@ -430,34 +430,34 @@ discard block |
||
430 | 430 | */ |
431 | 431 | private function parseAppender($props, $appenderName) { |
432 | 432 | $appender = LoggerAppenderPool::getAppenderFromPool($appenderName); |
433 | - $prefix = self::APPENDER_PREFIX . $appenderName; |
|
434 | - if($appender === null) { |
|
433 | + $prefix = self::APPENDER_PREFIX.$appenderName; |
|
434 | + if ($appender === null) { |
|
435 | 435 | // Appender was not previously initialized. |
436 | 436 | $appenderClass = @$props[$prefix]; |
437 | 437 | $appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderClass); |
438 | - if($appender === null) { |
|
438 | + if ($appender === null) { |
|
439 | 439 | return null; |
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
443 | - if($appender->requiresLayout() ) { |
|
444 | - $layoutPrefix = $prefix . ".layout"; |
|
443 | + if ($appender->requiresLayout()) { |
|
444 | + $layoutPrefix = $prefix.".layout"; |
|
445 | 445 | $layoutClass = @$props[$layoutPrefix]; |
446 | 446 | $layoutClass = LoggerOptionConverter::substVars($layoutClass, $props); |
447 | - if(empty($layoutClass)) { |
|
447 | + if (empty($layoutClass)) { |
|
448 | 448 | $layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple'); |
449 | 449 | } else { |
450 | 450 | $layout = LoggerReflectionUtils::createObject($layoutClass); |
451 | - if($layout === null) { |
|
451 | + if ($layout === null) { |
|
452 | 452 | $layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple'); |
453 | 453 | } |
454 | 454 | } |
455 | 455 | |
456 | - LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix . "."); |
|
456 | + LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix."."); |
|
457 | 457 | $appender->setLayout($layout); |
458 | 458 | |
459 | 459 | } |
460 | - LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix . "."); |
|
460 | + LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix."."); |
|
461 | 461 | return $appender; |
462 | 462 | } |
463 | 463 | } |
@@ -285,7 +285,7 @@ |
||
285 | 285 | $this->logger->setAdditivity($additivity); |
286 | 286 | } |
287 | 287 | } |
288 | - $this->state[] = self::LOGGER_STATE;; |
|
288 | + $this->state[] = self::LOGGER_STATE; ; |
|
289 | 289 | break; |
290 | 290 | |
291 | 291 | case 'LEVEL': |