Improve comments

This commit is contained in:
Tim 2019-07-26 15:26:30 +02:00
parent 3f44caecda
commit b847b3fba4
1 changed files with 12 additions and 2 deletions

View File

@ -151,6 +151,7 @@ class LoggerService
$traces = 0;
foreach ($backtraces as $trace) {
$skip = false;
// Applying the filters, $skip if match is found
foreach ($classFilters as $class) {
if (strpos($trace['class'], $class)) {
$skip = true;
@ -159,6 +160,7 @@ class LoggerService
if ($skip) {
continue;
}
// Save the function and class of this level
$context[] = "function[$traces]: ".$trace['function'];
$context[] = "class[$traces]: ".$trace['class'];
++$traces;
@ -167,7 +169,15 @@ class LoggerService
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();
@ -177,7 +187,7 @@ class LoggerService
->where($qb->expr()->gte('l.level', '?1'))
->orderBy('l.createdAt', 'DESC')
->setParameter(1, $level)
->setMaxResults($amount);
->setMaxResults($limit);
return $qb->getQuery()->getResult();
}