Improve comments
This commit is contained in:
parent
3f44caecda
commit
b847b3fba4
@ -151,6 +151,7 @@ class LoggerService
|
|||||||
$traces = 0;
|
$traces = 0;
|
||||||
foreach ($backtraces as $trace) {
|
foreach ($backtraces as $trace) {
|
||||||
$skip = false;
|
$skip = false;
|
||||||
|
// Applying the filters, $skip if match is found
|
||||||
foreach ($classFilters as $class) {
|
foreach ($classFilters as $class) {
|
||||||
if (strpos($trace['class'], $class)) {
|
if (strpos($trace['class'], $class)) {
|
||||||
$skip = true;
|
$skip = true;
|
||||||
@ -159,6 +160,7 @@ class LoggerService
|
|||||||
if ($skip) {
|
if ($skip) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Save the function and class of this level
|
||||||
$context[] = "function[$traces]: ".$trace['function'];
|
$context[] = "function[$traces]: ".$trace['function'];
|
||||||
$context[] = "class[$traces]: ".$trace['class'];
|
$context[] = "class[$traces]: ".$trace['class'];
|
||||||
++$traces;
|
++$traces;
|
||||||
@ -167,7 +169,15 @@ class LoggerService
|
|||||||
return $context;
|
return $context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLatest($amount = 1, $level = self::DEBUG)
|
/**
|
||||||
|
* Get the latest log entry limited by $limit and of at least log level $level.
|
||||||
|
*
|
||||||
|
* @param int $limit The maximum amount of entries
|
||||||
|
* @param int $level The minimum log level for the entries
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getLatest($limit = 1, $level = self::DEBUG)
|
||||||
{
|
{
|
||||||
$qb = $this->em->createQueryBuilder();
|
$qb = $this->em->createQueryBuilder();
|
||||||
|
|
||||||
@ -177,7 +187,7 @@ class LoggerService
|
|||||||
->where($qb->expr()->gte('l.level', '?1'))
|
->where($qb->expr()->gte('l.level', '?1'))
|
||||||
->orderBy('l.createdAt', 'DESC')
|
->orderBy('l.createdAt', 'DESC')
|
||||||
->setParameter(1, $level)
|
->setParameter(1, $level)
|
||||||
->setMaxResults($amount);
|
->setMaxResults($limit);
|
||||||
|
|
||||||
return $qb->getQuery()->getResult();
|
return $qb->getQuery()->getResult();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user