Skip to content

Firefly III: a personal finances manager

Add some debug info.

James Colec08d44ea48e6
diff --git a/app/Api/V2/Controllers/Chart/BudgetController.php b/app/Api/V2/Controllers/Chart/BudgetController.php
index 20d70cb1df..781bcbbf41 100644
--- a/app/Api/V2/Controllers/Chart/BudgetController.php
+++ b/app/Api/V2/Controllers/Chart/BudgetController.php
@@ -39,6 +39,7 @@ use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Log;
/**
* Class BudgetController
@@ -177,6 +178,7 @@ class BudgetController extends Controller
*/
private function processExpenses(int $budgetId, array $array, Carbon $start, Carbon $end): array
{
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$converter = new ExchangeRateConverter();
$return = [];
@@ -258,6 +260,7 @@ class BudgetController extends Controller
*/
private function processLimit(Budget $budget, BudgetLimit $limit): array
{
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$end = clone $limit->end_date;
$end->endOfDay();
$spent = $this->opsRepository->listExpenses($limit->start_date, $end, null, new Collection([$budget]));
diff --git a/app/Api/V2/Controllers/Chart/CategoryController.php b/app/Api/V2/Controllers/Chart/CategoryController.php
index 32e41992b6..029c1075c4 100644
--- a/app/Api/V2/Controllers/Chart/CategoryController.php
+++ b/app/Api/V2/Controllers/Chart/CategoryController.php
@@ -37,6 +37,7 @@ use FireflyIII\Support\Http\Api\CleansChartData;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use Illuminate\Http\JsonResponse;
+use Illuminate\Support\Facades\Log;
/**
* Class BudgetController
@@ -76,6 +77,7 @@ class CategoryController extends Controller
*/
public function dashboard(DateRequest $request): JsonResponse
{
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
/** @var Carbon $start */
$start = $this->parameters->get('start');
diff --git a/app/Api/V2/Controllers/Summary/BasicController.php b/app/Api/V2/Controllers/Summary/BasicController.php
index ef267b37a7..428c4e50a8 100644
--- a/app/Api/V2/Controllers/Summary/BasicController.php
+++ b/app/Api/V2/Controllers/Summary/BasicController.php
@@ -45,6 +45,7 @@ use FireflyIII\Support\Http\Api\SummaryBalanceGrouped;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
+use Illuminate\Support\Facades\Log;
/**
* Class BasicController
@@ -244,6 +245,7 @@ class BasicController extends Controller
*/
private function getLeftToSpendInfo(Carbon $start, Carbon $end): array
{
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
app('log')->debug('Now in getLeftToSpendInfo');
$return = [];
$today = today(config('app.timezone'));
diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php
index 58bbfdb671..0a49173885 100644
--- a/app/Console/Commands/Tools/Cron.php
+++ b/app/Console/Commands/Tools/Cron.php
@@ -32,6 +32,7 @@ use FireflyIII\Support\Cronjobs\BillWarningCronjob;
use FireflyIII\Support\Cronjobs\ExchangeRatesCronjob;
use FireflyIII\Support\Cronjobs\RecurringCronjob;
use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Log;
/**
* Class Cron
@@ -103,6 +104,7 @@ class Cron extends Command
private function exchangeRatesCronJob(bool $force, ?Carbon $date): void
{
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$exchangeRates = new ExchangeRatesCronjob();
$exchangeRates->setForce($force);
// set date in cron job:
diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php
index e4952b960e..e928fb27b6 100644
--- a/app/Handlers/Events/UserEventHandler.php
+++ b/app/Handlers/Events/UserEventHandler.php
@@ -220,7 +220,7 @@ class UserEventHandler
public function sendAdminRegistrationNotification(RegisteredUser $event): void
{
- $sendMail = (bool)app('fireflyconfig')->get('notification_admin_new_reg', true)->data;
+ $sendMail = (bool) app('fireflyconfig')->get('notification_admin_new_reg', true)->data;
if ($sendMail) {
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
@@ -285,7 +285,7 @@ class UserEventHandler
$oldEmail = $event->oldEmail;
$user = $event->user;
$token = app('preferences')->getForUser($user, 'email_change_undo_token', 'invalid');
- $hashed = hash('sha256', sprintf('%s%s', (string)config('app.key'), $oldEmail));
+ $hashed = hash('sha256', sprintf('%s%s', (string) config('app.key'), $oldEmail));
$url = route('profile.undo-email-change', [$token->data, $hashed]);
try {
@@ -347,7 +347,7 @@ class UserEventHandler
*/
public function sendRegistrationMail(RegisteredUser $event): void
{
- $sendMail = (bool)app('fireflyconfig')->get('notification_user_new_reg', true)->data;
+ $sendMail = (bool) app('fireflyconfig')->get('notification_user_new_reg', true)->data;
if ($sendMail) {
try {
Notification::send($event->user, new UserRegistrationNotification());
diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php
index 069043d961..f2c94e7856 100644
--- a/app/Helpers/Report/NetWorth.php
+++ b/app/Helpers/Report/NetWorth.php
@@ -36,6 +36,7 @@ use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\User;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Log;
/**
* This class can handle both request with and without a user group and will return the appropriate repository when
@@ -72,7 +73,7 @@ class NetWorth implements NetWorthInterface
return $cache->get();
}
app('log')->debug(sprintf('Now in byAccounts("%s", "%s")', $ids, $date->format('Y-m-d')));
-
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$default = app('amount')->getDefaultCurrency();
$converter = new ExchangeRateConverter();
diff --git a/app/Repositories/UserGroups/Bill/BillRepository.php b/app/Repositories/UserGroups/Bill/BillRepository.php
index af9c3b51cc..309fbf0ab2 100644
--- a/app/Repositories/UserGroups/Bill/BillRepository.php
+++ b/app/Repositories/UserGroups/Bill/BillRepository.php
@@ -32,6 +32,7 @@ use FireflyIII\Support\CacheProperties;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Log;
/**
* Class BillRepository
@@ -66,6 +67,7 @@ class BillRepository implements BillRepositoryInterface
public function sumPaidInRange(Carbon $start, Carbon $end): array
{
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$bills = $this->getActiveBills();
$default = app('amount')->getDefaultCurrency();
$return = [];
@@ -134,6 +136,7 @@ class BillRepository implements BillRepositoryInterface
public function sumUnpaidInRange(Carbon $start, Carbon $end): array
{
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$bills = $this->getActiveBills();
$return = [];
$default = app('amount')->getDefaultCurrency();
diff --git a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php
index 650b1c799f..171af1ae40 100644
--- a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php
+++ b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php
@@ -28,6 +28,7 @@ use Carbon\Carbon;
use FireflyIII\Models\AvailableBudget;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
+use Illuminate\Support\Facades\Log;
/**
* Class AvailableBudgetRepository
@@ -38,6 +39,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
public function getAvailableBudgetWithCurrency(Carbon $start, Carbon $end): array
{
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$return = [];
$converter = new ExchangeRateConverter();
$default = app('amount')->getDefaultCurrency();
diff --git a/app/Support/Http/Api/AccountBalanceGrouped.php b/app/Support/Http/Api/AccountBalanceGrouped.php
index 9cdd38b6b6..1b0d0ce364 100644
--- a/app/Support/Http/Api/AccountBalanceGrouped.php
+++ b/app/Support/Http/Api/AccountBalanceGrouped.php
@@ -28,6 +28,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionType;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Log;
/**
* Class AccountBalanceGrouped
@@ -117,6 +118,7 @@ class AccountBalanceGrouped
*/
public function groupByCurrencyAndPeriod(): void
{
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$converter = new ExchangeRateConverter();
// loop. group by currency and by period.
diff --git a/app/Support/Http/Api/SummaryBalanceGrouped.php b/app/Support/Http/Api/SummaryBalanceGrouped.php
index 29f8b1153b..f70f6428ed 100644
--- a/app/Support/Http/Api/SummaryBalanceGrouped.php
+++ b/app/Support/Http/Api/SummaryBalanceGrouped.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Support\Http\Api;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
+use Illuminate\Support\Facades\Log;
class SummaryBalanceGrouped
{
@@ -44,7 +45,8 @@ class SummaryBalanceGrouped
public function groupTransactions(string $key, array $journals): void
{
- \Log::debug(sprintf('Now in groupTransactions with key "%s" and %d journal(s)', $key, count($journals)));
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
+ Log::debug(sprintf('Now in groupTransactions with key "%s" and %d journal(s)', $key, count($journals)));
$converter = new ExchangeRateConverter();
$this->keys[] = $key;
$multiplier = 'income' === $key ? '-1' : '1';
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index a4dbd3405c..a55885e78d 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -239,7 +239,7 @@ class Steam
$balances[$formatted] = $startBalance;
app('log')->debug(sprintf('Start balance on %s is %s', $formatted, $startBalance));
-
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$converter = new ExchangeRateConverter();
// not sure why this is happening:
@@ -422,6 +422,7 @@ class Steam
// need to convert the others. All sets use the "amount" value as their base (that's easy)
// but we need to convert each transaction separately because the date difference may
// incur huge currency changes.
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$start = clone $date;
$end = clone $date;
$converter = new ExchangeRateConverter();
diff --git a/app/Transformers/V2/BillTransformer.php b/app/Transformers/V2/BillTransformer.php
index 274feedba9..2ee0417e18 100644
--- a/app/Transformers/V2/BillTransformer.php
+++ b/app/Transformers/V2/BillTransformer.php
@@ -34,6 +34,7 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Log;
/**
* Class BillTransformer
@@ -92,6 +93,7 @@ class BillTransformer extends AbstractTransformer
'object_group_order' => $order,
];
}
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$this->default = app('amount')->getDefaultCurrency();
$this->converter = new ExchangeRateConverter();
diff --git a/app/Transformers/V2/PiggyBankTransformer.php b/app/Transformers/V2/PiggyBankTransformer.php
index 1fa7428b73..9a74f6cdc4 100644
--- a/app/Transformers/V2/PiggyBankTransformer.php
+++ b/app/Transformers/V2/PiggyBankTransformer.php
@@ -36,6 +36,7 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Log;
/**
* Class PiggyBankTransformer
@@ -131,6 +132,7 @@ class PiggyBankTransformer extends AbstractTransformer
$this->notes[$id] = $note;
}
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$this->default = app('amount')->getDefaultCurrencyByUserGroup(auth()->user()->userGroup);
$this->converter = new ExchangeRateConverter();
}
diff --git a/app/Transformers/V2/TransactionGroupTransformer.php b/app/Transformers/V2/TransactionGroupTransformer.php
index a603a258c8..f26c10127d 100644
--- a/app/Transformers/V2/TransactionGroupTransformer.php
+++ b/app/Transformers/V2/TransactionGroupTransformer.php
@@ -35,6 +35,7 @@ use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\NullArrayObject;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Log;
/**
* Class TransactionGroupTransformer
@@ -102,6 +103,7 @@ class TransactionGroupTransformer extends AbstractTransformer
}
// create converter
+ Log::info(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$this->converter = new ExchangeRateConverter();
}