1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 05:07:36 +02:00

Init IntrospectionProcessor with skip classes parameter with fixed array notation

Logger maybe use in other debug classes and I must be able to skip my debug classes.

For example: new IntrospectionProcessor(Logger::DEBUG, array('Monolog\\', 'Debug'))
This commit is contained in:
Artur Geraschenko
2013-12-12 21:27:31 +03:00
parent 5ad421d6a1
commit ff43ef9860

View File

@@ -28,9 +28,12 @@ class IntrospectionProcessor
{ {
private $level; private $level;
public function __construct($level = Logger::DEBUG) private $skipClassesPartials;
public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array('Monolog\\'))
{ {
$this->level = $level; $this->level = $level;
$this->skipClassesPartials = $skipClassesPartials;
} }
/** /**
@@ -52,8 +55,18 @@ class IntrospectionProcessor
array_shift($trace); array_shift($trace);
$i = 0; $i = 0;
while (isset($trace[$i]['class']) && false !== strpos($trace[$i]['class'], 'Monolog\\')) {
while (isset($trace[$i]['class']))
{
foreach ($this->skipClassesPartials as $part)
{
if (strpos($trace[$i]['class'], $part) !== false)
{
$i++; $i++;
continue 2;
}
}
break;
} }
// we should have the call source now // we should have the call source now