Even more debug

This commit is contained in:
James Cole 2023-12-29 08:30:50 +01:00
parent c16f7d214f
commit 7aa3aef508
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -54,7 +54,7 @@ class ExchangeRateConverter
{
$start->startOfDay();
$end->endOfDay();
Log::debug(sprintf('Preparing for %s to %s between %s and %s', $from->code, $to->code, $start->format('Y-m-d'), $end->format('Y-m-d')));
Log::info(sprintf('Preparing for %s to %s between %s and %s', $from->code, $to->code, $start->format('Y-m-d'), $end->format('Y-m-d')));
$set = auth()->user()
->currencyExchangeRates()
->where('from_currency_id', $from->id)
@ -66,7 +66,7 @@ class ExchangeRateConverter
$fallback = $this->getRate($from, $to, $start);
++$this->queryCount;
if (0 === $set->count()) {
Log::debug('No rates found in this period.');
Log::info('No rates found in this period.');
return;
}
@ -86,7 +86,7 @@ class ExchangeRateConverter
];
++$count;
}
Log::debug(sprintf('Found %d rates in this period.', $count));
Log::info(sprintf('Found %d rates in this period.', $count));
$currentStart = clone $start;
while ($currentStart->lte($end)) {
$currentDate = $currentStart->format('Y-m-d');
@ -157,6 +157,7 @@ class ExchangeRateConverter
// perhaps the rate has been cached during this particular run
$preparedRate = $this->prepared[$date][$from][$to] ?? null;
if (null !== $preparedRate && 0 !== bccomp('0', $preparedRate)) {
Log::info(sprintf('Found prepared rate from #%d to #%d on %s.', $from, $to, $date));
return $preparedRate;
}
@ -167,10 +168,11 @@ class ExchangeRateConverter
if ('' === $rate) {
return null;
}
Log::info(sprintf('Found cached rate from #%d to #%d on %s.', $from, $to, $date));
return $rate;
}
app('log')->debug(sprintf('Going to get rate #%d->#%d (%s) from DB.', $from, $to, $date));
app('log')->info(sprintf('Going to get rate #%d->#%d (%s) from DB.', $from, $to, $date));
/** @var null|CurrencyExchangeRate $result */
$result = auth()->user()