From e65d0eef6e94ade37727f6f677f4b0f08639d21d Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 29 Oct 2023 06:31:27 +0100 Subject: [PATCH] Remove static references --- .../V1/Controllers/Data/DestroyController.php | 4 ++-- .../Correction/DeleteEmptyJournals.php | 4 ++-- app/Console/Commands/Export/ExportData.php | 2 +- app/Factory/TransactionJournalFactory.php | 2 +- .../Events/StoredGroupEventHandler.php | 4 ++-- .../Events/UpdatedGroupEventHandler.php | 4 ++-- app/Handlers/Events/UserEventHandler.php | 2 +- .../Auth/ForgotPasswordController.php | 2 +- app/Http/Controllers/Auth/LoginController.php | 2 +- .../Controllers/Auth/RegisterController.php | 2 +- app/Http/Controllers/DebugController.php | 2 +- app/Http/Controllers/ProfileController.php | 2 +- .../Recurring/TriggerController.php | 2 +- .../Controllers/System/InstallController.php | 2 +- app/Http/Middleware/Installer.php | 4 ++-- app/Http/Middleware/IsDemoUser.php | 2 +- app/Jobs/CreateAutoBudgetLimits.php | 18 +++++++++--------- app/Jobs/CreateRecurringTransactions.php | 16 ++++++++-------- app/Repositories/User/UserRepository.php | 2 +- .../FireflyIIIOrg/Update/UpdateRequest.php | 2 +- .../Internal/Support/AccountServiceTrait.php | 2 +- .../Internal/Update/JournalUpdateService.php | 4 ++-- app/Support/Binder/CLIToken.php | 2 +- app/Support/Cronjobs/AutoBudgetCronjob.php | 14 +++++++------- app/Support/Cronjobs/BillWarningCronjob.php | 16 ++++++++-------- app/Support/Cronjobs/ExchangeRatesCronjob.php | 14 +++++++------- app/Support/Cronjobs/RecurringCronjob.php | 16 ++++++++-------- app/Support/Search/OperatorQuerySearch.php | 4 ++-- app/Support/System/GeneratesInstallationId.php | 4 ++-- .../Actions/UpdatePiggybank.php | 4 ++-- 30 files changed, 80 insertions(+), 80 deletions(-) diff --git a/app/Api/V1/Controllers/Data/DestroyController.php b/app/Api/V1/Controllers/Data/DestroyController.php index 8b22e7c673..a359efc8d5 100644 --- a/app/Api/V1/Controllers/Data/DestroyController.php +++ b/app/Api/V1/Controllers/Data/DestroyController.php @@ -303,12 +303,12 @@ class DestroyController extends Controller foreach ($collection as $account) { $count = $account->transactions()->count(); if (true === $this->unused && 0 === $count) { - Log::info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name)); + app('log')->info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name)); $service->destroy($account, null); continue; } if (false === $this->unused) { - Log::info(sprintf('Deleting account #%d "%s"', $account->id, $account->name)); + app('log')->info(sprintf('Deleting account #%d "%s"', $account->id, $account->name)); $service->destroy($account, null); } } diff --git a/app/Console/Commands/Correction/DeleteEmptyJournals.php b/app/Console/Commands/Correction/DeleteEmptyJournals.php index 3ed726205c..6adb592f83 100644 --- a/app/Console/Commands/Correction/DeleteEmptyJournals.php +++ b/app/Console/Commands/Correction/DeleteEmptyJournals.php @@ -81,7 +81,7 @@ class DeleteEmptyJournals extends Command try { TransactionJournal::find((int)$row->transaction_journal_id)->delete(); } catch (QueryException $e) { - Log::info(sprintf('Could not delete journal: %s', $e->getMessage())); + app('log')->info(sprintf('Could not delete journal: %s', $e->getMessage())); Log::error($e->getTraceAsString()); } @@ -113,7 +113,7 @@ class DeleteEmptyJournals extends Command try { TransactionJournal::find($entry->id)->delete(); } catch (QueryException $e) { - Log::info(sprintf('Could not delete entry: %s', $e->getMessage())); + app('log')->info(sprintf('Could not delete entry: %s', $e->getMessage())); Log::error($e->getTraceAsString()); } diff --git a/app/Console/Commands/Export/ExportData.php b/app/Console/Commands/Export/ExportData.php index d3c03f1e8c..8f0a03c9ef 100644 --- a/app/Console/Commands/Export/ExportData.php +++ b/app/Console/Commands/Export/ExportData.php @@ -209,7 +209,7 @@ class ExportData extends Command } } if (null === $this->option($field)) { - Log::info(sprintf('No date given in field "%s"', $field)); + app('log')->info(sprintf('No date given in field "%s"', $field)); $error = true; } diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index 2c0c5756ac..3ddda25d0f 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -626,7 +626,7 @@ class TransactionJournalFactory { $this->errorOnHash = $errorOnHash; if (true === $errorOnHash) { - Log::info('Will trigger duplication alert for this journal.'); + app('log')->info('Will trigger duplication alert for this journal.'); } } } diff --git a/app/Handlers/Events/StoredGroupEventHandler.php b/app/Handlers/Events/StoredGroupEventHandler.php index 853f299fb2..2a367f1b2b 100644 --- a/app/Handlers/Events/StoredGroupEventHandler.php +++ b/app/Handlers/Events/StoredGroupEventHandler.php @@ -47,7 +47,7 @@ class StoredGroupEventHandler public function processRules(StoredTransactionGroup $storedGroupEvent): void { if (false === $storedGroupEvent->applyRules) { - Log::info(sprintf('Will not run rules on group #%d', $storedGroupEvent->transactionGroup->id)); + app('log')->info(sprintf('Will not run rules on group #%d', $storedGroupEvent->transactionGroup->id)); return; } @@ -100,7 +100,7 @@ class StoredGroupEventHandler Log::debug(__METHOD__); $group = $storedGroupEvent->transactionGroup; if (false === $storedGroupEvent->fireWebhooks) { - Log::info(sprintf('Will not fire webhooks for transaction group #%d', $group->id)); + app('log')->info(sprintf('Will not fire webhooks for transaction group #%d', $group->id)); return; } diff --git a/app/Handlers/Events/UpdatedGroupEventHandler.php b/app/Handlers/Events/UpdatedGroupEventHandler.php index 991edabd6d..12052673b9 100644 --- a/app/Handlers/Events/UpdatedGroupEventHandler.php +++ b/app/Handlers/Events/UpdatedGroupEventHandler.php @@ -50,7 +50,7 @@ class UpdatedGroupEventHandler public function processRules(UpdatedTransactionGroup $updatedGroupEvent): void { if (false === $updatedGroupEvent->applyRules) { - Log::info(sprintf('Will not run rules on group #%d', $updatedGroupEvent->transactionGroup->id)); + app('log')->info(sprintf('Will not run rules on group #%d', $updatedGroupEvent->transactionGroup->id)); return; } @@ -98,7 +98,7 @@ class UpdatedGroupEventHandler Log::debug(__METHOD__); $group = $updatedGroupEvent->transactionGroup; if (false === $updatedGroupEvent->fireWebhooks) { - Log::info(sprintf('Will not fire webhooks for transaction group #%d', $group->id)); + app('log')->info(sprintf('Will not fire webhooks for transaction group #%d', $group->id)); return; } diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index 79beb3405f..b3166c37ef 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -102,7 +102,7 @@ class UserEventHandler Log::error('Could not find role "owner". This is weird.'); } - Log::info(sprintf('Gave user #%d role #%d ("%s")', $user->id, $role->id, $role->name)); + app('log')->info(sprintf('Gave user #%d role #%d ("%s")', $user->id, $role->id, $role->name)); // give user the role $repository->attachRole($user, 'owner'); } diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 2dd3028ef2..ab3354b0e4 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -68,7 +68,7 @@ class ForgotPasswordController extends Controller */ public function sendResetLinkEmail(Request $request, UserRepositoryInterface $repository) { - Log::info('Start of sendResetLinkEmail()'); + app('log')->info('Start of sendResetLinkEmail()'); if ('web' !== config('firefly.authentication_guard')) { $message = sprintf('Cannot reset password when authenticating over "%s".', config('firefly.authentication_guard')); Log::error($message); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 7a1892799d..c06b0af31d 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -87,7 +87,7 @@ class LoginController extends Controller public function login(Request $request) { Log::channel('audit')->info(sprintf('User is trying to login using "%s"', $request->get($this->username()))); - Log::info('User is trying to login.'); + app('log')->info('User is trying to login.'); $this->validateLogin($request); Log::debug('Login data is present.'); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 331ecc66bc..1746c951d7 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -98,7 +98,7 @@ class RegisterController extends Controller $this->validator($request->all())->validate(); $user = $this->createUser($request->all()); - Log::info(sprintf('Registered new user %s', $user->email)); + app('log')->info(sprintf('Registered new user %s', $user->email)); event(new RegisteredUser($user)); $this->guard()->login($user); diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index ee03dab98e..775bae91fd 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -70,7 +70,7 @@ class DebugController extends Controller public function displayError(): void { Log::debug('This is a test message at the DEBUG level.'); - Log::info('This is a test message at the INFO level.'); + app('log')->info('This is a test message at the INFO level.'); Log::notice('This is a test message at the NOTICE level.'); app('log')->warning('This is a test message at the WARNING level.'); Log::error('This is a test message at the ERROR level.'); diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 59b624fac6..91af1bd5ac 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -595,7 +595,7 @@ class ProfileController extends Controller } /** @var User $user */ $user = auth()->user(); - Log::info(sprintf('User #%d has opted to delete their account', auth()->user()->id)); + app('log')->info(sprintf('User #%d has opted to delete their account', auth()->user()->id)); // make repository delete user: auth()->logout(); session()->flush(); diff --git a/app/Http/Controllers/Recurring/TriggerController.php b/app/Http/Controllers/Recurring/TriggerController.php index 173f9e5375..094bfbffc9 100644 --- a/app/Http/Controllers/Recurring/TriggerController.php +++ b/app/Http/Controllers/Recurring/TriggerController.php @@ -55,7 +55,7 @@ class TriggerController extends Controller $backupDate = $recurrence->latest_date; // fire the recurring cron job on the given date, then post-date the created transaction. - Log::info(sprintf('Trigger: will now fire recurring cron job task for date "%s".', $date->format('Y-m-d H:i:s'))); + app('log')->info(sprintf('Trigger: will now fire recurring cron job task for date "%s".', $date->format('Y-m-d H:i:s'))); /** @var CreateRecurringTransactions $job */ $job = app(CreateRecurringTransactions::class); $job->setRecurrences(new Collection([$recurrence])); diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php index 90479444c3..f9b30a0464 100644 --- a/app/Http/Controllers/System/InstallController.php +++ b/app/Http/Controllers/System/InstallController.php @@ -171,7 +171,7 @@ class InstallController extends Controller // switch on PHP version. $keys = []; // switch on class existence. - Log::info('Will run PHP8 code.'); + app('log')->info('Will run PHP8 code.'); $keys = RSA::createKey(4096); [$publicKey, $privateKey] = [ diff --git a/app/Http/Middleware/Installer.php b/app/Http/Middleware/Installer.php index feb97cad43..bcea75b6d5 100644 --- a/app/Http/Middleware/Installer.php +++ b/app/Http/Middleware/Installer.php @@ -160,7 +160,7 @@ class Installer return true; } - //Log::info(sprintf('Configured DB version (%d) equals expected DB version (%d)', $dbVersion, $configVersion)); + //app('log')->info(sprintf('Configured DB version (%d) equals expected DB version (%d)', $dbVersion, $configVersion)); return false; } @@ -187,7 +187,7 @@ class Installer return true; } - //Log::info(sprintf('Installed Firefly III version (%s) equals expected Firefly III version (%s)', $dbVersion, $configVersion)); + //app('log')->info(sprintf('Installed Firefly III version (%s) equals expected Firefly III version (%s)', $dbVersion, $configVersion)); return false; } diff --git a/app/Http/Middleware/IsDemoUser.php b/app/Http/Middleware/IsDemoUser.php index e174c8d95e..a32e8a62cc 100644 --- a/app/Http/Middleware/IsDemoUser.php +++ b/app/Http/Middleware/IsDemoUser.php @@ -53,7 +53,7 @@ class IsDemoUser /** @var UserRepositoryInterface $repository */ $repository = app(UserRepositoryInterface::class); if ($repository->hasRole($user, 'demo')) { - Log::info('User is a demo user.'); + app('log')->info('User is a demo user.'); $request->session()->flash('info', (string)trans('firefly.not_available_demo_user')); $current = $request->url(); $previous = $request->session()->previousUrl(); diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.php index 9c86241ea2..553604b920 100644 --- a/app/Jobs/CreateAutoBudgetLimits.php +++ b/app/Jobs/CreateAutoBudgetLimits.php @@ -89,18 +89,18 @@ class CreateAutoBudgetLimits implements ShouldQueue private function handleAutoBudget(AutoBudget $autoBudget): void { if (null === $autoBudget->budget) { - Log::info(sprintf('Auto budget #%d is associated with a deleted budget.', $autoBudget->id)); + app('log')->info(sprintf('Auto budget #%d is associated with a deleted budget.', $autoBudget->id)); $autoBudget->delete(); return; } if (false === $autoBudget->budget->active) { - Log::info(sprintf('Auto budget #%d is associated with an inactive budget.', $autoBudget->id)); + app('log')->info(sprintf('Auto budget #%d is associated with an inactive budget.', $autoBudget->id)); return; } if (!$this->isMagicDay($autoBudget)) { - Log::info( + app('log')->info( sprintf( 'Today (%s) is not a magic day for %s auto-budget #%d (part of budget #%d "%s")', $this->date->format('Y-m-d'), @@ -114,7 +114,7 @@ class CreateAutoBudgetLimits implements ShouldQueue return; } - Log::info( + app('log')->info( sprintf( 'Today (%s) is a magic day for %s auto-budget #%d (part of budget #%d "%s")', $this->date->format('Y-m-d'), @@ -300,11 +300,11 @@ class CreateAutoBudgetLimits implements ShouldQueue Log::debug(sprintf('Total amount left for previous budget period is %s', $budgetLeft)); if (-1 !== bccomp('0', $budgetLeft)) { - Log::info(sprintf('The amount left is negative, so it will be reset to %s.', $totalAmount)); + app('log')->info(sprintf('The amount left is negative, so it will be reset to %s.', $totalAmount)); } if (1 !== bccomp('0', $budgetLeft)) { $totalAmount = bcadd($budgetLeft, $totalAmount); - Log::info(sprintf('The amount left is positive, so the new amount will be %s.', $totalAmount)); + app('log')->info(sprintf('The amount left is positive, so the new amount will be %s.', $totalAmount)); } // create budget limit: @@ -366,17 +366,17 @@ class CreateAutoBudgetLimits implements ShouldQueue if (-1 !== bccomp($budgetAvailable, $totalAmount)) { - Log::info(sprintf('There is no overspending, no need to adjust. Budget limit amount will be %s.', $budgetAvailable)); + app('log')->info(sprintf('There is no overspending, no need to adjust. Budget limit amount will be %s.', $budgetAvailable)); // create budget limit: $this->createBudgetLimit($autoBudget, $start, $end, $budgetAvailable); } if (1 !== bccomp($budgetAvailable, $totalAmount) && 1 === bccomp($budgetAvailable, '0')) { - Log::info(sprintf('There was overspending, so the new amount will be %s.', $budgetAvailable)); + app('log')->info(sprintf('There was overspending, so the new amount will be %s.', $budgetAvailable)); // create budget limit: $this->createBudgetLimit($autoBudget, $start, $end, $budgetAvailable); } if (1 !== bccomp($budgetAvailable, $totalAmount) && -1 === bccomp($budgetAvailable, '0')) { - Log::info('There was overspending, but so much even this period cant fix that. Reset it to 1.'); + app('log')->info('There was overspending, but so much even this period cant fix that. Reset it to 1.'); // create budget limit: $this->createBudgetLimit($autoBudget, $start, $end, '1'); } diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.php index ec00f99e90..7ae831b0cc 100644 --- a/app/Jobs/CreateRecurringTransactions.php +++ b/app/Jobs/CreateRecurringTransactions.php @@ -186,7 +186,7 @@ class CreateRecurringTransactions implements ShouldQueue Log::debug(sprintf('Now filtering recurrence #%d, owned by user #%d', $recurrence->id, $recurrence->user_id)); // is not active. if (!$this->active($recurrence)) { - Log::info(sprintf('Recurrence #%d is not active. Skipped.', $recurrence->id)); + app('log')->info(sprintf('Recurrence #%d is not active. Skipped.', $recurrence->id)); return false; } @@ -194,14 +194,14 @@ class CreateRecurringTransactions implements ShouldQueue // has repeated X times. $journalCount = $this->repository->getJournalCount($recurrence); if (0 !== $recurrence->repetitions && $journalCount >= $recurrence->repetitions && false === $this->force) { - Log::info(sprintf('Recurrence #%d has run %d times, so will run no longer.', $recurrence->id, $recurrence->repetitions)); + app('log')->info(sprintf('Recurrence #%d has run %d times, so will run no longer.', $recurrence->id, $recurrence->repetitions)); return false; } // is no longer running if ($this->repeatUntilHasPassed($recurrence)) { - Log::info( + app('log')->info( sprintf( 'Recurrence #%d was set to run until %s, and today\'s date is %s. Skipped.', $recurrence->id, @@ -215,7 +215,7 @@ class CreateRecurringTransactions implements ShouldQueue // first_date is in the future if ($this->hasNotStartedYet($recurrence)) { - Log::info( + app('log')->info( sprintf( 'Recurrence #%d is set to run on %s, and today\'s date is %s. Skipped.', $recurrence->id, @@ -229,7 +229,7 @@ class CreateRecurringTransactions implements ShouldQueue // already fired today (with success): if (false === $this->force && $this->hasFiredToday($recurrence)) { - Log::info(sprintf('Recurrence #%d has already fired today. Skipped.', $recurrence->id)); + app('log')->info(sprintf('Recurrence #%d has already fired today. Skipped.', $recurrence->id)); return false; } @@ -391,13 +391,13 @@ class CreateRecurringTransactions implements ShouldQueue // count created journals on THIS day. $journalCount = $this->repository->getJournalCount($recurrence, $date, $date); if ($journalCount > 0 && false === $this->force) { - Log::info(sprintf('Already created %d journal(s) for date %s', $journalCount, $date->format('Y-m-d'))); + app('log')->info(sprintf('Already created %d journal(s) for date %s', $journalCount, $date->format('Y-m-d'))); return null; } if ($this->repository->createdPreviously($recurrence, $date) && false === $this->force) { - Log::info('There is a transaction already made for this date, so will not be created now'); + app('log')->info('There is a transaction already made for this date, so will not be created now'); return null; } @@ -431,7 +431,7 @@ class CreateRecurringTransactions implements ShouldQueue /** @var TransactionGroup $group */ $group = $this->groupRepository->store($array); $this->created++; - Log::info(sprintf('Created new transaction group #%d', $group->id)); + app('log')->info(sprintf('Created new transaction group #%d', $group->id)); // trigger event: event(new StoredTransactionGroup($group, $recurrence->apply_rules, true)); diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index 73b9c1edad..e35d99f13a 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -155,7 +155,7 @@ class UserRepository implements UserRepositoryInterface foreach ($groups as $group) { $count = $group->groupMemberships()->count(); if (0 === $count) { - Log::info(sprintf('Deleted empty group #%d ("%s")', $group->id, $group->title)); + app('log')->info(sprintf('Deleted empty group #%d ("%s")', $group->id, $group->title)); $group->delete(); } } diff --git a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php index 2f09340c09..f50408c2d3 100644 --- a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php +++ b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php @@ -128,7 +128,7 @@ class UpdateRequest implements UpdateRequestInterface $return['version'] = $response['version']; $return['level'] = 'success'; $return['date'] = Carbon::createFromFormat('Y-m-d', $response['date'])->startOfDay(); - Log::info('Response from update server', $response); + app('log')->info('Response from update server', $response); return $return; } diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index d7db07baab..ae5149b479 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -64,7 +64,7 @@ trait AccountServiceTrait $rules = ['iban' => 'required|iban']; $validator = Validator::make($data, $rules); if ($validator->fails()) { - Log::info(sprintf('Detected invalid IBAN ("%s"). Return NULL instead.', $iban)); + app('log')->info(sprintf('Detected invalid IBAN ("%s"). Return NULL instead.', $iban)); return null; } diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index e0f190f999..e37770cb7f 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -148,7 +148,7 @@ class JournalUpdateService // can we update account data using the new type? if ($this->hasValidAccounts()) { - Log::info('Account info is valid, now update.'); + app('log')->info('Account info is valid, now update.'); // update accounts: $this->updateAccounts(); @@ -805,7 +805,7 @@ class JournalUpdateService $dest->save(); Log::debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount)); } - Log::info('Not enough info to update foreign currency info.'); + app('log')->info('Not enough info to update foreign currency info.'); // refresh transactions. $this->sourceTransaction->refresh(); diff --git a/app/Support/Binder/CLIToken.php b/app/Support/Binder/CLIToken.php index 207224fb3c..f66b5005d4 100644 --- a/app/Support/Binder/CLIToken.php +++ b/app/Support/Binder/CLIToken.php @@ -55,7 +55,7 @@ class CLIToken implements BinderInterface foreach ($users as $user) { $accessToken = app('preferences')->getForUser($user, 'access_token'); if (null !== $accessToken && $accessToken->data === $value) { - Log::info(sprintf('Recognized user #%d (%s) from his acccess token.', $user->id, $user->email)); + app('log')->info(sprintf('Recognized user #%d (%s) from his acccess token.', $user->id, $user->email)); return $value; } diff --git a/app/Support/Cronjobs/AutoBudgetCronjob.php b/app/Support/Cronjobs/AutoBudgetCronjob.php index bc540fa8b2..bebb77e019 100644 --- a/app/Support/Cronjobs/AutoBudgetCronjob.php +++ b/app/Support/Cronjobs/AutoBudgetCronjob.php @@ -45,13 +45,13 @@ class AutoBudgetCronjob extends AbstractCronjob $diff = time() - $lastTime; $diffForHumans = today(config('app.timezone'))->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true); if (0 === $lastTime) { - Log::info('Auto budget cron-job has never fired before.'); + app('log')->info('Auto budget cron-job has never fired before.'); } // less than half a day ago: if ($lastTime > 0 && $diff <= 43200) { - Log::info(sprintf('It has been %s since the auto budget cron-job has fired.', $diffForHumans)); + app('log')->info(sprintf('It has been %s since the auto budget cron-job has fired.', $diffForHumans)); if (false === $this->force) { - Log::info('The auto budget cron-job will not fire now.'); + app('log')->info('The auto budget cron-job will not fire now.'); $this->message = sprintf('It has been %s since the auto budget cron-job has fired. It will not fire now.', $diffForHumans); return; @@ -59,12 +59,12 @@ class AutoBudgetCronjob extends AbstractCronjob // fire job regardless. if (true === $this->force) { - Log::info('Execution of the auto budget cron-job has been FORCED.'); + app('log')->info('Execution of the auto budget cron-job has been FORCED.'); } } if ($lastTime > 0 && $diff > 43200) { - Log::info(sprintf('It has been %s since the auto budget cron-job has fired. It will fire now!', $diffForHumans)); + app('log')->info(sprintf('It has been %s since the auto budget cron-job has fired. It will fire now!', $diffForHumans)); } $this->fireAutoBudget(); @@ -76,7 +76,7 @@ class AutoBudgetCronjob extends AbstractCronjob */ private function fireAutoBudget(): void { - Log::info(sprintf('Will now fire auto budget cron job task for date "%s".', $this->date->format('Y-m-d'))); + app('log')->info(sprintf('Will now fire auto budget cron job task for date "%s".', $this->date->format('Y-m-d'))); /** @var CreateAutoBudgetLimits $job */ $job = app(CreateAutoBudgetLimits::class, [$this->date]); $job->setDate($this->date); @@ -89,6 +89,6 @@ class AutoBudgetCronjob extends AbstractCronjob $this->message = 'Auto-budget cron job fired successfully.'; app('fireflyconfig')->set('last_ab_job', (int)$this->date->format('U')); - Log::info('Done with auto budget cron job task.'); + app('log')->info('Done with auto budget cron job task.'); } } diff --git a/app/Support/Cronjobs/BillWarningCronjob.php b/app/Support/Cronjobs/BillWarningCronjob.php index 2b3c03f512..34a44bcb05 100644 --- a/app/Support/Cronjobs/BillWarningCronjob.php +++ b/app/Support/Cronjobs/BillWarningCronjob.php @@ -51,13 +51,13 @@ class BillWarningCronjob extends AbstractCronjob $diffForHumans = today(config('app.timezone'))->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true); if (0 === $lastTime) { - Log::info('The bill warning cron-job has never fired before.'); + app('log')->info('The bill warning cron-job has never fired before.'); } // less than half a day ago: if ($lastTime > 0 && $diff <= 43200) { - Log::info(sprintf('It has been %s since the bill warning cron-job has fired.', $diffForHumans)); + app('log')->info(sprintf('It has been %s since the bill warning cron-job has fired.', $diffForHumans)); if (false === $this->force) { - Log::info('The cron-job will not fire now.'); + app('log')->info('The cron-job will not fire now.'); $this->message = sprintf('It has been %s since the bill warning cron-job has fired. It will not fire now.', $diffForHumans); $this->jobFired = false; $this->jobErrored = false; @@ -68,12 +68,12 @@ class BillWarningCronjob extends AbstractCronjob // fire job regardless. if (true === $this->force) { - Log::info('Execution of the bill warning cron-job has been FORCED.'); + app('log')->info('Execution of the bill warning cron-job has been FORCED.'); } } if ($lastTime > 0 && $diff > 43200) { - Log::info(sprintf('It has been %s since the bill warning cron-job has fired. It will fire now!', $diffForHumans)); + app('log')->info(sprintf('It has been %s since the bill warning cron-job has fired. It will fire now!', $diffForHumans)); } $this->fireWarnings(); @@ -86,7 +86,7 @@ class BillWarningCronjob extends AbstractCronjob */ private function fireWarnings(): void { - Log::info(sprintf('Will now fire bill warning job task for date "%s".', $this->date->format('Y-m-d H:i:s'))); + app('log')->info(sprintf('Will now fire bill warning job task for date "%s".', $this->date->format('Y-m-d H:i:s'))); /** @var WarnAboutBills $job */ $job = app(WarnAboutBills::class); $job->setDate($this->date); @@ -100,7 +100,7 @@ class BillWarningCronjob extends AbstractCronjob $this->message = 'Bill warning cron job fired successfully.'; app('fireflyconfig')->set('last_bw_job', (int)$this->date->format('U')); - Log::info(sprintf('Marked the last time this job has run as "%s" (%d)', $this->date->format('Y-m-d H:i:s'), (int)$this->date->format('U'))); - Log::info('Done with bill warning cron job task.'); + app('log')->info(sprintf('Marked the last time this job has run as "%s" (%d)', $this->date->format('Y-m-d H:i:s'), (int)$this->date->format('U'))); + app('log')->info('Done with bill warning cron job task.'); } } diff --git a/app/Support/Cronjobs/ExchangeRatesCronjob.php b/app/Support/Cronjobs/ExchangeRatesCronjob.php index c76131777a..568edaa592 100644 --- a/app/Support/Cronjobs/ExchangeRatesCronjob.php +++ b/app/Support/Cronjobs/ExchangeRatesCronjob.php @@ -45,13 +45,13 @@ class ExchangeRatesCronjob extends AbstractCronjob $diff = time() - $lastTime; $diffForHumans = today(config('app.timezone'))->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true); if (0 === $lastTime) { - Log::info('Exchange rates cron-job has never fired before.'); + app('log')->info('Exchange rates cron-job has never fired before.'); } // less than half a day ago: if ($lastTime > 0 && $diff <= 43200) { - Log::info(sprintf('It has been %s since the exchange rates cron-job has fired.', $diffForHumans)); + app('log')->info(sprintf('It has been %s since the exchange rates cron-job has fired.', $diffForHumans)); if (false === $this->force) { - Log::info('The exchange rates cron-job will not fire now.'); + app('log')->info('The exchange rates cron-job will not fire now.'); $this->message = sprintf('It has been %s since the exchange rates cron-job has fired. It will not fire now.', $diffForHumans); return; @@ -59,12 +59,12 @@ class ExchangeRatesCronjob extends AbstractCronjob // fire job regardless. if (true === $this->force) { - Log::info('Execution of the exchange rates cron-job has been FORCED.'); + app('log')->info('Execution of the exchange rates cron-job has been FORCED.'); } } if ($lastTime > 0 && $diff > 43200) { - Log::info(sprintf('It has been %s since the exchange rates cron-job has fired. It will fire now!', $diffForHumans)); + app('log')->info(sprintf('It has been %s since the exchange rates cron-job has fired. It will fire now!', $diffForHumans)); } $this->fireExchangeRateJob(); @@ -76,7 +76,7 @@ class ExchangeRatesCronjob extends AbstractCronjob */ private function fireExchangeRateJob(): void { - Log::info(sprintf('Will now fire exchange rates cron job task for date "%s".', $this->date->format('Y-m-d'))); + app('log')->info(sprintf('Will now fire exchange rates cron job task for date "%s".', $this->date->format('Y-m-d'))); /** @var DownloadExchangeRates $job */ $job = app(DownloadExchangeRates::class); $job->setDate($this->date); @@ -89,6 +89,6 @@ class ExchangeRatesCronjob extends AbstractCronjob $this->message = 'Exchange rates cron job fired successfully.'; app('fireflyconfig')->set('last_cer_job', (int)$this->date->format('U')); - Log::info('Done with exchange rates job task.'); + app('log')->info('Done with exchange rates job task.'); } } diff --git a/app/Support/Cronjobs/RecurringCronjob.php b/app/Support/Cronjobs/RecurringCronjob.php index cdb2b989ff..7bfbb811d4 100644 --- a/app/Support/Cronjobs/RecurringCronjob.php +++ b/app/Support/Cronjobs/RecurringCronjob.php @@ -51,13 +51,13 @@ class RecurringCronjob extends AbstractCronjob $diffForHumans = today(config('app.timezone'))->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true); if (0 === $lastTime) { - Log::info('Recurring transactions cron-job has never fired before.'); + app('log')->info('Recurring transactions cron-job has never fired before.'); } // less than half a day ago: if ($lastTime > 0 && $diff <= 43200) { - Log::info(sprintf('It has been %s since the recurring transactions cron-job has fired.', $diffForHumans)); + app('log')->info(sprintf('It has been %s since the recurring transactions cron-job has fired.', $diffForHumans)); if (false === $this->force) { - Log::info('The cron-job will not fire now.'); + app('log')->info('The cron-job will not fire now.'); $this->message = sprintf('It has been %s since the recurring transactions cron-job has fired. It will not fire now.', $diffForHumans); $this->jobFired = false; $this->jobErrored = false; @@ -68,12 +68,12 @@ class RecurringCronjob extends AbstractCronjob // fire job regardless. if (true === $this->force) { - Log::info('Execution of the recurring transaction cron-job has been FORCED.'); + app('log')->info('Execution of the recurring transaction cron-job has been FORCED.'); } } if ($lastTime > 0 && $diff > 43200) { - Log::info(sprintf('It has been %s since the recurring transactions cron-job has fired. It will fire now!', $diffForHumans)); + app('log')->info(sprintf('It has been %s since the recurring transactions cron-job has fired. It will fire now!', $diffForHumans)); } $this->fireRecurring(); @@ -86,7 +86,7 @@ class RecurringCronjob extends AbstractCronjob */ private function fireRecurring(): void { - Log::info(sprintf('Will now fire recurring cron job task for date "%s".', $this->date->format('Y-m-d H:i:s'))); + app('log')->info(sprintf('Will now fire recurring cron job task for date "%s".', $this->date->format('Y-m-d H:i:s'))); /** @var CreateRecurringTransactions $job */ $job = app(CreateRecurringTransactions::class); $job->setDate($this->date); @@ -100,7 +100,7 @@ class RecurringCronjob extends AbstractCronjob $this->message = 'Recurring transactions cron job fired successfully.'; app('fireflyconfig')->set('last_rt_job', (int)$this->date->format('U')); - Log::info(sprintf('Marked the last time this job has run as "%s" (%d)', $this->date->format('Y-m-d H:i:s'), (int)$this->date->format('U'))); - Log::info('Done with recurring cron job task.'); + app('log')->info(sprintf('Marked the last time this job has run as "%s" (%d)', $this->date->format('Y-m-d H:i:s'), (int)$this->date->format('U'))); + app('log')->info('Done with recurring cron job task.'); } } diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 470067caea..a7c7a1018c 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -261,7 +261,7 @@ class OperatorQuerySearch implements SearchInterface throw new FireflyException(sprintf('Unsupported search operator: "%s"', $operator)); // some search operators are ignored, basically: case 'user_action': - Log::info(sprintf('Ignore search operator "%s"', $operator)); + app('log')->info(sprintf('Ignore search operator "%s"', $operator)); return false; // @@ -863,7 +863,7 @@ class OperatorQuerySearch implements SearchInterface } // no tags found means search must result in nothing. if (null === $result) { - Log::info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator)); + app('log')->info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator)); $this->collector->findNothing(); } break; diff --git a/app/Support/System/GeneratesInstallationId.php b/app/Support/System/GeneratesInstallationId.php index beccdaafab..c350193802 100644 --- a/app/Support/System/GeneratesInstallationId.php +++ b/app/Support/System/GeneratesInstallationId.php @@ -41,7 +41,7 @@ trait GeneratesInstallationId try { $config = app('fireflyconfig')->get('installation_id'); } catch (FireflyException $e) { - Log::info('Could not create or generate installation ID. Do not continue.'); + app('log')->info('Could not create or generate installation ID. Do not continue.'); return; } @@ -54,7 +54,7 @@ trait GeneratesInstallationId if (null === $config) { $uuid4 = Uuid::uuid4(); $uniqueId = (string)$uuid4; - Log::info(sprintf('Created Firefly III installation ID %s', $uniqueId)); + app('log')->info(sprintf('Created Firefly III installation ID %s', $uniqueId)); app('fireflyconfig')->set('installation_id', $uniqueId); } } diff --git a/app/TransactionRules/Actions/UpdatePiggybank.php b/app/TransactionRules/Actions/UpdatePiggybank.php index c0699f258d..1d52c9c6ef 100644 --- a/app/TransactionRules/Actions/UpdatePiggybank.php +++ b/app/TransactionRules/Actions/UpdatePiggybank.php @@ -67,7 +67,7 @@ class UpdatePiggybank implements ActionInterface $piggyBank = $this->findPiggyBank($user); if (null === $piggyBank) { - Log::info( + app('log')->info( sprintf('No piggy bank named "%s", cant execute action #%d of rule #%d', $this->action->action_value, $this->action->id, $this->action->rule_id) ); event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_piggy', ['name' => $this->action->action_value]))); @@ -123,7 +123,7 @@ class UpdatePiggybank implements ActionInterface return true; } - Log::info( + app('log')->info( sprintf( 'Piggy bank is not linked to source ("#%d") or destination ("#%d"), so no action will be taken.', $source->account_id,