Skip to content

Commit 5ae2404

Browse files
committed
also search in app and level
1 parent fcfe79a commit 5ae2404

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

log/searchfilter.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,29 @@ class SearchFilter extends \FilterIterator {
2727
*/
2828
private $query;
2929

30+
/**
31+
* @var string[]
32+
*/
33+
private $levels;
34+
3035
/**
3136
* @param LogIterator $iterator
3237
* @param string $query
3338
*/
3439
public function __construct(LogIterator $iterator, $query) {
3540
parent::__construct($iterator);
3641
$this->query = strtolower($query);
42+
$this->levels = ['Debug', 'Info', 'Warning', 'Error', 'Fatal'];
43+
}
44+
45+
private function formatLevel($level) {
46+
return $this->levels[$level];
3747
}
3848

3949
public function accept() {
4050
$value = $this->getInnerIterator()->current();
41-
$value = strtolower($value->message);
42-
return strpos($value, $this->query) !== false;
51+
return stripos($value->message, $this->query) !== false
52+
|| stripos($value->app, $this->query) !== false
53+
|| stripos($this->formatLevel($value->level), $this->query) !== false;
4354
}
4455
}

0 commit comments

Comments
 (0)