Skip to content

Firefly III: a personal finances manager

Remove static references

James Cole4f2159b54ded
diff --git a/app/Api/V1/Controllers/Models/Account/UpdateController.php b/app/Api/V1/Controllers/Models/Account/UpdateController.php
index de97df921a..cc0c550529 100644
--- a/app/Api/V1/Controllers/Models/Account/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/Account/UpdateController.php
@@ -73,7 +73,7 @@ class UpdateController extends Controller
*/
public function update(UpdateRequest $request, Account $account): JsonResponse
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$data = $request->getUpdateData();
$data['type'] = config('firefly.shortNamesByFullName.' . $account->accountType->type);
$account = $this->repository->update($account, $data);
diff --git a/app/Api/V1/Controllers/Models/Attachment/StoreController.php b/app/Api/V1/Controllers/Models/Attachment/StoreController.php
index 646d5d606e..7098aa2ac9 100644
--- a/app/Api/V1/Controllers/Models/Attachment/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Attachment/StoreController.php
@@ -78,7 +78,7 @@ class StoreController extends Controller
*/
public function store(StoreRequest $request): JsonResponse
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$data = $request->getAll();
$attachment = $this->repository->store($data);
$manager = $this->getManager();
diff --git a/app/Api/V1/Controllers/Models/Transaction/DestroyController.php b/app/Api/V1/Controllers/Models/Transaction/DestroyController.php
index a15a24ff33..e43550c263 100644
--- a/app/Api/V1/Controllers/Models/Transaction/DestroyController.php
+++ b/app/Api/V1/Controllers/Models/Transaction/DestroyController.php
@@ -79,7 +79,7 @@ class DestroyController extends Controller
*/
public function destroy(TransactionGroup $transactionGroup): JsonResponse
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
// grab asset account(s) from group:
$accounts = [];
/** @var TransactionJournal $journal */
@@ -100,7 +100,7 @@ class DestroyController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
- Log::debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
+ app('log')->debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
event(new UpdatedAccount($account));
}
diff --git a/app/Api/V1/Controllers/Models/Transaction/StoreController.php b/app/Api/V1/Controllers/Models/Transaction/StoreController.php
index b6a9054d4a..13f900e8b9 100644
--- a/app/Api/V1/Controllers/Models/Transaction/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Transaction/StoreController.php
@@ -83,7 +83,7 @@ class StoreController extends Controller
*/
public function store(StoreRequest $request): JsonResponse
{
- Log::debug('Now in API StoreController::store()');
+ app('log')->debug('Now in API StoreController::store()');
$data = $request->getAll();
$data['user'] = auth()->user()->id;
diff --git a/app/Api/V1/Controllers/Models/Transaction/UpdateController.php b/app/Api/V1/Controllers/Models/Transaction/UpdateController.php
index 8da2d15204..085287fa3c 100644
--- a/app/Api/V1/Controllers/Models/Transaction/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/Transaction/UpdateController.php
@@ -77,7 +77,7 @@ class UpdateController extends Controller
*/
public function update(UpdateRequest $request, TransactionGroup $transactionGroup): JsonResponse
{
- Log::debug('Now in update routine for transaction group!');
+ app('log')->debug('Now in update routine for transaction group!');
$data = $request->getAll();
$transactionGroup = $this->groupRepository->update($transactionGroup, $data);
diff --git a/app/Api/V1/Controllers/Search/AccountController.php b/app/Api/V1/Controllers/Search/AccountController.php
index 2da3d3a254..abeac116a5 100644
--- a/app/Api/V1/Controllers/Search/AccountController.php
+++ b/app/Api/V1/Controllers/Search/AccountController.php
@@ -67,7 +67,7 @@ class AccountController extends Controller
*/
public function search(Request $request): JsonResponse | Response
{
- Log::debug('Now in account search()');
+ app('log')->debug('Now in account search()');
$manager = $this->getManager();
$query = trim((string)$request->get('query'));
$field = trim((string)$request->get('field'));
diff --git a/app/Api/V1/Controllers/System/CronController.php b/app/Api/V1/Controllers/System/CronController.php
index da110e13b8..c2dd5ba2f1 100644
--- a/app/Api/V1/Controllers/System/CronController.php
+++ b/app/Api/V1/Controllers/System/CronController.php
@@ -53,8 +53,8 @@ class CronController extends Controller
{
$config = $request->getAll();
- Log::debug(sprintf('Now in %s', __METHOD__));
- Log::debug(sprintf('Date is %s', $config['date']->toIsoString()));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Date is %s', $config['date']->toIsoString()));
$return = [];
$return['recurring_transactions'] = $this->runRecurring($config['force'], $config['date']);
$return['auto_budgets'] = $this->runAutoBudget($config['force'], $config['date']);
diff --git a/app/Api/V1/Controllers/System/UserController.php b/app/Api/V1/Controllers/System/UserController.php
index b0c6e519bc..1be7081741 100644
--- a/app/Api/V1/Controllers/System/UserController.php
+++ b/app/Api/V1/Controllers/System/UserController.php
@@ -192,7 +192,7 @@ class UserController extends Controller
// can only update 'blocked' when user is admin.
if (!$this->repository->hasRole(auth()->user(), 'owner')) {
- Log::debug('Quietly drop fields "blocked" and "blocked_code" from request.');
+ app('log')->debug('Quietly drop fields "blocked" and "blocked_code" from request.');
unset($data['blocked'], $data['blocked_code']);
}
diff --git a/app/Api/V1/Requests/Models/Bill/StoreRequest.php b/app/Api/V1/Requests/Models/Bill/StoreRequest.php
index 416d73ac99..fdae2cce94 100644
--- a/app/Api/V1/Requests/Models/Bill/StoreRequest.php
+++ b/app/Api/V1/Requests/Models/Bill/StoreRequest.php
@@ -48,7 +48,7 @@ class StoreRequest extends FormRequest
*/
public function getAll(): array
{
- Log::debug('Raw fields in Bill StoreRequest', $this->all());
+ app('log')->debug('Raw fields in Bill StoreRequest', $this->all());
$fields = [
'name' => ['name', 'convertString'],
'amount_min' => ['amount_min', 'convertString'],
diff --git a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php
index 3b26c259c3..006ee5a8d2 100644
--- a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php
+++ b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php
@@ -57,7 +57,7 @@ class StoreRequest extends FormRequest
*/
public function getAll(): array
{
- Log::debug('get all data in TransactionStoreRequest');
+ app('log')->debug('get all data in TransactionStoreRequest');
return [
'group_title' => $this->convertString('group_title'),
@@ -173,7 +173,7 @@ class StoreRequest extends FormRequest
*/
public function rules(): array
{
- Log::debug('Collect rules of TransactionStoreRequest');
+ app('log')->debug('Collect rules of TransactionStoreRequest');
$validProtocols = config('firefly.valid_url_protocols');
return [
// basic fields for group:
@@ -270,9 +270,9 @@ class StoreRequest extends FormRequest
$this->validateTransactionArray($validator);
// must submit at least one transaction.
- Log::debug('Now going to validateOneTransaction');
+ app('log')->debug('Now going to validateOneTransaction');
$this->validateOneTransaction($validator);
- Log::debug('Now done with validateOneTransaction');
+ app('log')->debug('Now done with validateOneTransaction');
// all journals must have a description
$this->validateDescriptions($validator);
diff --git a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php
index d8b19ab5d0..dd5a249a0d 100644
--- a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php
+++ b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php
@@ -63,7 +63,7 @@ class UpdateRequest extends FormRequest
*/
public function getAll(): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$this->integerFields = [
'order',
'currency_id',
@@ -157,7 +157,7 @@ class UpdateRequest extends FormRequest
*/
private function getTransactionData(): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$return = [];
if (!is_countable($this->get('transactions'))) {
@@ -246,9 +246,9 @@ class UpdateRequest extends FormRequest
private function getDateData(array $current, array $transaction): array
{
foreach ($this->dateFields as $fieldName) {
- Log::debug(sprintf('Now at date field %s', $fieldName));
+ app('log')->debug(sprintf('Now at date field %s', $fieldName));
if (array_key_exists($fieldName, $transaction)) {
- Log::debug(sprintf('New value: "%s"', (string)$transaction[$fieldName]));
+ app('log')->debug(sprintf('New value: "%s"', (string)$transaction[$fieldName]));
$current[$fieldName] = $this->dateFromValue((string)$transaction[$fieldName]);
}
}
@@ -320,7 +320,7 @@ class UpdateRequest extends FormRequest
*/
public function rules(): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$validProtocols = config('firefly.valid_url_protocols');
return [
// basic fields for group:
@@ -406,7 +406,7 @@ class UpdateRequest extends FormRequest
*/
public function withValidator(Validator $validator): void
{
- Log::debug('Now in withValidator');
+ app('log')->debug('Now in withValidator');
/** @var TransactionGroup $transactionGroup */
$transactionGroup = $this->route()->parameter('transactionGroup');
$validator->after(
diff --git a/app/Console/Commands/Correction/TransferBudgets.php b/app/Console/Commands/Correction/TransferBudgets.php
index 12372a57ef..2b5d1aa46e 100644
--- a/app/Console/Commands/Correction/TransferBudgets.php
+++ b/app/Console/Commands/Correction/TransferBudgets.php
@@ -56,7 +56,7 @@ class TransferBudgets extends Command
foreach ($set as $entry) {
$message = sprintf('Transaction journal #%d is a %s, so has no longer a budget.', $entry->id, $entry->transactionType->type);
$this->friendlyInfo($message);
- Log::debug($message);
+ app('log')->debug($message);
$entry->budgets()->sync([]);
$count++;
}
@@ -66,7 +66,7 @@ class TransferBudgets extends Command
}
if (0 !== $count) {
$message = sprintf('Corrected %d invalid budget/journal entries (entry).', $count);
- Log::debug($message);
+ app('log')->debug($message);
$this->friendlyInfo($message);
}
return 0;
diff --git a/app/Console/Commands/System/ForceDecimalSize.php b/app/Console/Commands/System/ForceDecimalSize.php
index 70b2e7384d..47092611ba 100644
--- a/app/Console/Commands/System/ForceDecimalSize.php
+++ b/app/Console/Commands/System/ForceDecimalSize.php
@@ -95,7 +95,7 @@ class ForceDecimalSize extends Command
*/
public function handle(): int
{
- Log::debug('Now in ForceDecimalSize::handle()');
+ app('log')->debug('Now in ForceDecimalSize::handle()');
$this->determineDatabaseType();
$this->friendlyError('Running this command is dangerous and can cause data loss.');
diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php
index 09c4f3f110..8b2f52e4bd 100644
--- a/app/Console/Commands/System/VerifySecurityAlerts.php
+++ b/app/Console/Commands/System/VerifySecurityAlerts.php
@@ -66,7 +66,7 @@ class VerifySecurityAlerts extends Command
$disk = Storage::disk('resources');
// Next line is ignored because it's a Laravel Facade.
if (!$disk->has('alerts.json')) {
- Log::debug('No alerts.json file present.');
+ app('log')->debug('No alerts.json file present.');
return 0;
}
@@ -76,19 +76,19 @@ class VerifySecurityAlerts extends Command
/** @var array $array */
foreach ($json as $array) {
if ($version === $array['version'] && true === $array['advisory']) {
- Log::debug(sprintf('Version %s has an alert!', $array['version']));
+ app('log')->debug(sprintf('Version %s has an alert!', $array['version']));
// add advisory to configuration.
$this->saveSecurityAdvisory($array);
// depends on level
if ('info' === $array['level']) {
- Log::debug('INFO level alert');
+ app('log')->debug('INFO level alert');
$this->friendlyInfo($array['message']);
return 0;
}
if ('warning' === $array['level']) {
- Log::debug('WARNING level alert');
+ app('log')->debug('WARNING level alert');
$this->friendlyWarning('------------------------ :o');
$this->friendlyWarning($array['message']);
$this->friendlyWarning('------------------------ :o');
@@ -96,7 +96,7 @@ class VerifySecurityAlerts extends Command
return 0;
}
if ('danger' === $array['level']) {
- Log::debug('DANGER level alert');
+ app('log')->debug('DANGER level alert');
$this->friendlyError('------------------------ :-(');
$this->friendlyError($array['message']);
$this->friendlyError('------------------------ :-(');
@@ -107,7 +107,7 @@ class VerifySecurityAlerts extends Command
return 0;
}
}
- Log::debug(sprintf('No security alerts for version %s', $version));
+ app('log')->debug(sprintf('No security alerts for version %s', $version));
$this->friendlyPositive(sprintf('No security alerts for version %s', $version));
return 0;
}
@@ -121,7 +121,7 @@ class VerifySecurityAlerts extends Command
app('fireflyconfig')->delete('upgrade_security_message');
app('fireflyconfig')->delete('upgrade_security_level');
} catch (QueryException $e) {
- Log::debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage()));
}
}
@@ -136,7 +136,7 @@ class VerifySecurityAlerts extends Command
app('fireflyconfig')->set('upgrade_security_message', $array['message']);
app('fireflyconfig')->set('upgrade_security_level', $array['level']);
} catch (QueryException $e) {
- Log::debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage()));
}
}
}
diff --git a/app/Console/Commands/Tools/ApplyRules.php b/app/Console/Commands/Tools/ApplyRules.php
index 97b8b526b1..748f1df673 100644
--- a/app/Console/Commands/Tools/ApplyRules.php
+++ b/app/Console/Commands/Tools/ApplyRules.php
@@ -335,7 +335,7 @@ class ApplyRules extends Command
// if in rule selection, or group in selection or all rules, it's included.
$test = $this->includeRule($rule, $group);
if (true === $test) {
- Log::debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
+ app('log')->debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
$rulesToApply->push($rule);
}
}
diff --git a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php
index 12961e4843..c043d4a000 100644
--- a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php
+++ b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php
@@ -125,7 +125,7 @@ class AppendBudgetLimitPeriods extends Command
$limit->end_date->format('Y-m-d'),
$period
);
- Log::debug($msg);
+ app('log')->debug($msg);
}
/**
diff --git a/app/Console/Commands/Upgrade/MigrateAttachments.php b/app/Console/Commands/Upgrade/MigrateAttachments.php
index db0e4dedb0..239def54cc 100644
--- a/app/Console/Commands/Upgrade/MigrateAttachments.php
+++ b/app/Console/Commands/Upgrade/MigrateAttachments.php
@@ -92,7 +92,7 @@ class MigrateAttachments extends Command
$att->description = '';
$att->save();
- Log::debug(sprintf('Migrated attachment #%s description to note #%d.', $att->id, $note->id));
+ app('log')->debug(sprintf('Migrated attachment #%s description to note #%d.', $att->id, $note->id));
$count++;
}
}
diff --git a/app/Console/Commands/Upgrade/MigrateJournalNotes.php b/app/Console/Commands/Upgrade/MigrateJournalNotes.php
index 293ce3738c..29a8cd641d 100644
--- a/app/Console/Commands/Upgrade/MigrateJournalNotes.php
+++ b/app/Console/Commands/Upgrade/MigrateJournalNotes.php
@@ -82,7 +82,7 @@ class MigrateJournalNotes extends Command
$note->text = $meta->data;
$note->save();
- Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
+ app('log')->debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
$meta->delete();
$count++;
diff --git a/app/Console/Commands/Upgrade/MigrateToGroups.php b/app/Console/Commands/Upgrade/MigrateToGroups.php
index 78a364b4a9..d23d055003 100644
--- a/app/Console/Commands/Upgrade/MigrateToGroups.php
+++ b/app/Console/Commands/Upgrade/MigrateToGroups.php
@@ -151,11 +151,11 @@ class MigrateToGroups extends Command
{
// double check transaction count.
if ($journal->transactions->count() <= 2) {
- Log::debug(sprintf('Will not try to convert journal #%d because it has 2 or less transactions.', $journal->id));
+ app('log')->debug(sprintf('Will not try to convert journal #%d because it has 2 or less transactions.', $journal->id));
return;
}
- Log::debug(sprintf('Will now try to convert journal #%d', $journal->id));
+ app('log')->debug(sprintf('Will now try to convert journal #%d', $journal->id));
$this->journalRepository->setUser($journal->user);
$this->groupFactory->setUser($journal->user);
@@ -193,11 +193,11 @@ class MigrateToGroups extends Command
$paymentDate = $this->cliRepository->getMetaDate($journal, 'payment_date');
$invoiceDate = $this->cliRepository->getMetaDate($journal, 'invoice_date');
- Log::debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));
+ app('log')->debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));
/** @var Transaction $transaction */
foreach ($destTransactions as $transaction) {
- Log::debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
+ app('log')->debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
$opposingTr = $this->findOpposingTransaction($journal, $transaction);
if (null === $opposingTr) {
@@ -256,9 +256,9 @@ class MigrateToGroups extends Command
$data['transactions'][] = $tArray;
}
- Log::debug(sprintf('Now calling transaction journal factory (%d transactions in array)', count($data['transactions'])));
+ app('log')->debug(sprintf('Now calling transaction journal factory (%d transactions in array)', count($data['transactions'])));
$group = $this->groupFactory->create($data);
- Log::debug('Done calling transaction journal factory');
+ app('log')->debug('Done calling transaction journal factory');
// delete the old transaction journal.
$this->service->destroy($journal);
@@ -266,7 +266,7 @@ class MigrateToGroups extends Command
$this->count++;
// report on result:
- Log::debug(
+ app('log')->debug(
sprintf(
'Migrated journal #%d into group #%d with these journals: #%s',
$journal->id,
@@ -310,8 +310,8 @@ class MigrateToGroups extends Command
static function (Transaction $subject) use ($transaction) {
$amount = (float)$transaction->amount * -1 === (float)$subject->amount; // intentional float
$identifier = $transaction->identifier === $subject->identifier;
- Log::debug(sprintf('Amount the same? %s', var_export($amount, true)));
- Log::debug(sprintf('ID the same? %s', var_export($identifier, true)));
+ app('log')->debug(sprintf('Amount the same? %s', var_export($amount, true)));
+ app('log')->debug(sprintf('ID the same? %s', var_export($identifier, true)));
return $amount && $identifier;
}
@@ -328,13 +328,13 @@ class MigrateToGroups extends Command
*/
private function getTransactionBudget(Transaction $left, Transaction $right): ?int
{
- Log::debug('Now in getTransactionBudget()');
+ app('log')->debug('Now in getTransactionBudget()');
// try to get a budget ID from the left transaction:
/** @var Budget|null $budget */
$budget = $left->budgets()->first();
if (null !== $budget) {
- Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
+ app('log')->debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
return (int)$budget->id;
}
@@ -343,11 +343,11 @@ class MigrateToGroups extends Command
/** @var Budget|null $budget */
$budget = $right->budgets()->first();
if (null !== $budget) {
- Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
+ app('log')->debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
return (int)$budget->id;
}
- Log::debug('Neither left or right have a budget, return NULL');
+ app('log')->debug('Neither left or right have a budget, return NULL');
// if all fails, return NULL.
return null;
@@ -361,13 +361,13 @@ class MigrateToGroups extends Command
*/
private function getTransactionCategory(Transaction $left, Transaction $right): ?int
{
- Log::debug('Now in getTransactionCategory()');
+ app('log')->debug('Now in getTransactionCategory()');
// try to get a category ID from the left transaction:
/** @var Category|null $category */
$category = $left->categories()->first();
if (null !== $category) {
- Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
+ app('log')->debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
return (int)$category->id;
}
@@ -376,11 +376,11 @@ class MigrateToGroups extends Command
/** @var Category|null $category */
$category = $right->categories()->first();
if (null !== $category) {
- Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
+ app('log')->debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
return (int)$category->id;
}
- Log::debug('Neither left or right have a category, return NULL');
+ app('log')->debug('Neither left or right have a category, return NULL');
// if all fails, return NULL.
return null;
@@ -394,7 +394,7 @@ class MigrateToGroups extends Command
$orphanedJournals = $this->cliRepository->getJournalsWithoutGroup();
$total = count($orphanedJournals);
if ($total > 0) {
- Log::debug(sprintf('Going to convert %d transaction journals. Please hold..', $total));
+ app('log')->debug(sprintf('Going to convert %d transaction journals. Please hold..', $total));
$this->friendlyInfo(sprintf('Going to convert %d transaction journals. Please hold..', $total));
/** @var array $array */
foreach ($orphanedJournals as $array) {
diff --git a/app/Events/AdminRequestedTestMessage.php b/app/Events/AdminRequestedTestMessage.php
index 1c8d0fa1de..2666b1d668 100644
--- a/app/Events/AdminRequestedTestMessage.php
+++ b/app/Events/AdminRequestedTestMessage.php
@@ -46,7 +46,7 @@ class AdminRequestedTestMessage extends Event
*/
public function __construct(User $user)
{
- Log::debug(sprintf('Triggered AdminRequestedTestMessage for user #%d (%s)', $user->id, $user->email));
+ app('log')->debug(sprintf('Triggered AdminRequestedTestMessage for user #%d (%s)', $user->id, $user->email));
$this->user = $user;
}
}
diff --git a/app/Events/DestroyedTransactionGroup.php b/app/Events/DestroyedTransactionGroup.php
index febad99260..d834828e13 100644
--- a/app/Events/DestroyedTransactionGroup.php
+++ b/app/Events/DestroyedTransactionGroup.php
@@ -46,7 +46,7 @@ class DestroyedTransactionGroup extends Event
*/
public function __construct(TransactionGroup $transactionGroup)
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$this->transactionGroup = $transactionGroup;
}
}
diff --git a/app/Events/Model/PiggyBank/ChangedAmount.php b/app/Events/Model/PiggyBank/ChangedAmount.php
index 79d2068c30..515848d414 100644
--- a/app/Events/Model/PiggyBank/ChangedAmount.php
+++ b/app/Events/Model/PiggyBank/ChangedAmount.php
@@ -53,7 +53,7 @@ class ChangedAmount extends Event
*/
public function __construct(PiggyBank $piggyBank, string $amount, ?TransactionJournal $transactionJournal, ?TransactionGroup $transactionGroup)
{
- Log::debug(sprintf('Created piggy bank event for piggy bank #%d with amount %s', $piggyBank->id, $amount));
+ app('log')->debug(sprintf('Created piggy bank event for piggy bank #%d with amount %s', $piggyBank->id, $amount));
$this->piggyBank = $piggyBank;
$this->transactionJournal = $transactionJournal;
$this->transactionGroup = $transactionGroup;
diff --git a/app/Events/RequestedReportOnJournals.php b/app/Events/RequestedReportOnJournals.php
index 8b9edbd7eb..aa1f3278e5 100644
--- a/app/Events/RequestedReportOnJournals.php
+++ b/app/Events/RequestedReportOnJournals.php
@@ -53,7 +53,7 @@ class RequestedReportOnJournals
*/
public function __construct(int $userId, Collection $groups)
{
- Log::debug('In event RequestedReportOnJournals.');
+ app('log')->debug('In event RequestedReportOnJournals.');
$this->userId = $userId;
$this->groups = $groups;
}
diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php
index 2187ede071..a08bbf76eb 100644
--- a/app/Exceptions/GracefulNotFoundHandler.php
+++ b/app/Exceptions/GracefulNotFoundHandler.php
@@ -143,7 +143,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
*/
private function handleAccount(Request $request, Throwable $exception)
{
- Log::debug('404 page is probably a deleted account. Redirect to overview of account types.');
+ app('log')->debug('404 page is probably a deleted account. Redirect to overview of account types.');
/** @var User $user */
$user = auth()->user();
$route = $request->route();
@@ -177,7 +177,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
*/
private function handleGroup(Request $request, Throwable $exception)
{
- Log::debug('404 page is probably a deleted group. Redirect to overview of group types.');
+ app('log')->debug('404 page is probably a deleted group. Redirect to overview of group types.');
/** @var User $user */
$user = auth()->user();
$route = $request->route();
@@ -216,7 +216,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
*/
private function handleAttachment(Request $request, Throwable $exception)
{
- Log::debug('404 page is probably a deleted attachment. Redirect to parent object.');
+ app('log')->debug('404 page is probably a deleted attachment. Redirect to parent object.');
/** @var User $user */
$user = auth()->user();
$route = $request->route();
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index b9bf1e6a36..132efd6a6f 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -83,41 +83,41 @@ class Handler extends ExceptionHandler
$expectsJson = $request->expectsJson();
// if the user requests anything /api/, assume the user wants to see JSON.
if (str_starts_with($request->getRequestUri(), '/api/')) {
- Log::debug('API endpoint, always assume user wants JSON.');
+ app('log')->debug('API endpoint, always assume user wants JSON.');
$expectsJson = true;
}
- Log::debug('Now in Handler::render()');
+ app('log')->debug('Now in Handler::render()');
if ($e instanceof LaravelValidationException && $expectsJson) {
// ignore it: controller will handle it.
- Log::debug(sprintf('Return to parent to handle LaravelValidationException(%d)', $e->status));
+ app('log')->debug(sprintf('Return to parent to handle LaravelValidationException(%d)', $e->status));
return parent::render($request, $e);
}
if ($e instanceof NotFoundHttpException && $expectsJson) {
// JSON error:
- Log::debug('Return JSON not found error.');
+ app('log')->debug('Return JSON not found error.');
return response()->json(['message' => 'Resource not found', 'exception' => 'NotFoundHttpException'], 404);
}
if ($e instanceof AuthenticationException && $expectsJson) {
// somehow Laravel handler does not catch this:
- Log::debug('Return JSON unauthenticated error.');
+ app('log')->debug('Return JSON unauthenticated error.');
return response()->json(['message' => 'Unauthenticated', 'exception' => 'AuthenticationException'], 401);
}
if ($e instanceof OAuthServerException && $expectsJson) {
- Log::debug('Return JSON OAuthServerException.');
+ app('log')->debug('Return JSON OAuthServerException.');
// somehow Laravel handler does not catch this:
return response()->json(['message' => $e->getMessage(), 'exception' => 'OAuthServerException'], 401);
}
if ($e instanceof BadRequestHttpException) {
- Log::debug('Return JSON BadRequestHttpException.');
+ app('log')->debug('Return JSON BadRequestHttpException.');
return response()->json(['message' => $e->getMessage(), 'exception' => 'BadRequestHttpException'], 400);
}
if ($e instanceof BadHttpHeaderException) {
// is always API exception.
- Log::debug('Return JSON BadHttpHeaderException.');
+ app('log')->debug('Return JSON BadHttpHeaderException.');
return response()->json(['message' => $e->getMessage(), 'exception' => 'BadHttpHeaderException'], $e->statusCode);
}
@@ -127,7 +127,7 @@ class Handler extends ExceptionHandler
$isDebug = config('app.debug', false);
if ($isDebug) {
- Log::debug(sprintf('Return JSON %s with debug.', get_class($e)));
+ app('log')->debug(sprintf('Return JSON %s with debug.', get_class($e)));
return response()->json(
[
'message' => $e->getMessage(),
@@ -139,7 +139,7 @@ class Handler extends ExceptionHandler
$errorCode
);
}
- Log::debug(sprintf('Return JSON %s.', get_class($e)));
+ app('log')->debug(sprintf('Return JSON %s.', get_class($e)));
return response()->json(
['message' => sprintf('Internal Firefly III Exception: %s', $e->getMessage()), 'exception' => get_class($e)],
$errorCode
@@ -147,7 +147,7 @@ class Handler extends ExceptionHandler
}
if ($e instanceof NotFoundHttpException) {
- Log::debug('Refer to GracefulNotFoundHandler');
+ app('log')->debug('Refer to GracefulNotFoundHandler');
$handler = app(GracefulNotFoundHandler::class);
return $handler->render($request, $e);
@@ -155,20 +155,20 @@ class Handler extends ExceptionHandler
// special view for database errors with extra instructions
if ($e instanceof QueryException) {
- Log::debug('Return Firefly III database exception view.');
+ app('log')->debug('Return Firefly III database exception view.');
$isDebug = config('app.debug');
return response()->view('errors.DatabaseException', ['exception' => $e, 'debug' => $isDebug], 500);
}
if ($e instanceof FireflyException || $e instanceof ErrorException || $e instanceof OAuthServerException) {
- Log::debug('Return Firefly III error view.');
+ app('log')->debug('Return Firefly III error view.');
$isDebug = config('app.debug');
return response()->view('errors.FireflyException', ['exception' => $e, 'debug' => $isDebug], 500);
}
- Log::debug(sprintf('Error "%s" has no Firefly III treatment, parent will handle.', get_class($e)));
+ app('log')->debug(sprintf('Error "%s" has no Firefly III treatment, parent will handle.', get_class($e)));
return parent::render($request, $e);
}
diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php
index ad8ed0944a..09165897fd 100644
--- a/app/Factory/AccountFactory.php
+++ b/app/Factory/AccountFactory.php
@@ -79,7 +79,7 @@ class AccountFactory
*/
public function findOrCreate(string $accountName, string $accountType): Account
{
- Log::debug(sprintf('findOrCreate("%s", "%s")', $accountName, $accountType));
+ app('log')->debug(sprintf('findOrCreate("%s", "%s")', $accountName, $accountType));
$type = $this->accountRepository->getAccountTypeByType($accountType);
if (null === $type) {
@@ -88,7 +88,7 @@ class AccountFactory
$return = $this->user->accounts->where('account_type_id', $type->id)->where('name', $accountName)->first();
if (null === $return) {
- Log::debug('Found nothing. Will create a new one.');
+ app('log')->debug('Found nothing. Will create a new one.');
$return = $this->create(
[
'user_id' => $this->user->id,
@@ -115,7 +115,7 @@ class AccountFactory
*/
public function create(array $data): Account
{
- Log::debug('Now in AccountFactory::create()');
+ app('log')->debug('Now in AccountFactory::create()');
$type = $this->getAccountType($data);
$data['iban'] = $this->filterIban($data['iban'] ?? null);
@@ -163,7 +163,7 @@ class AccountFactory
app('log')->warning(sprintf('Found NO account type based on %d and "%s"', $accountTypeId, $accountTypeName));
throw new FireflyException(sprintf('AccountFactory::create() was unable to find account type #%d ("%s").', $accountTypeId, $accountTypeName));
}
- Log::debug(sprintf('Found account type based on %d and "%s": "%s"', $accountTypeId, $accountTypeName, $result->type));
+ app('log')->debug(sprintf('Found account type based on %d and "%s": "%s"', $accountTypeId, $accountTypeName, $result->type));
return $result;
}
@@ -176,7 +176,7 @@ class AccountFactory
*/
public function find(string $accountName, string $accountType): ?Account
{
- Log::debug(sprintf('Now in AccountFactory::find("%s", "%s")', $accountName, $accountType));
+ app('log')->debug(sprintf('Now in AccountFactory::find("%s", "%s")', $accountName, $accountType));
$type = AccountType::whereType($accountType)->first();
/** @var Account|null */
@@ -358,22 +358,22 @@ class AccountFactory
*/
private function storeCreditLiability(Account $account, array $data): void
{
- Log::debug('storeCreditLiability');
+ app('log')->debug('storeCreditLiability');
$account->refresh();
$accountType = $account->accountType->type;
$direction = $this->accountRepository->getMetaValue($account, 'liability_direction');
$valid = config('firefly.valid_liabilities');
if (in_array($accountType, $valid, true)) {
- Log::debug('Is a liability with credit ("i am owed") direction.');
+ app('log')->debug('Is a liability with credit ("i am owed") direction.');
if ($this->validOBData($data)) {
- Log::debug('Has valid CL data.');
+ app('log')->debug('Has valid CL data.');
$openingBalance = $data['opening_balance'];
$openingBalanceDate = $data['opening_balance_date'];
// store credit transaction.
$this->updateCreditTransaction($account, $direction, $openingBalance, $openingBalanceDate);
}
if (!$this->validOBData($data)) {
- Log::debug('Does NOT have valid CL data, deletr any CL transaction.');
+ app('log')->debug('Does NOT have valid CL data, deletr any CL transaction.');
$this->deleteCreditTransaction($account);
}
}
diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php
index 265aa1b77c..f8e550ee5f 100644
--- a/app/Factory/BillFactory.php
+++ b/app/Factory/BillFactory.php
@@ -52,7 +52,7 @@ class BillFactory
*/
public function create(array $data): ?Bill
{
- Log::debug(sprintf('Now in %s', __METHOD__), $data);
+ app('log')->debug(sprintf('Now in %s', __METHOD__), $data);
$factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null)) ??
app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
diff --git a/app/Factory/CategoryFactory.php b/app/Factory/CategoryFactory.php
index b3097be29c..f6e03f6a0e 100644
--- a/app/Factory/CategoryFactory.php
+++ b/app/Factory/CategoryFactory.php
@@ -48,7 +48,7 @@ class CategoryFactory
$categoryId = (int)$categoryId;
$categoryName = (string)$categoryName;
- Log::debug(sprintf('Going to find category with ID %d and name "%s"', $categoryId, $categoryName));
+ app('log')->debug(sprintf('Going to find category with ID %d and name "%s"', $categoryId, $categoryName));
if ('' === $categoryName && 0 === $categoryId) {
return null;
diff --git a/app/Factory/PiggyBankEventFactory.php b/app/Factory/PiggyBankEventFactory.php
index 55dcdff4fe..38d023cdc9 100644
--- a/app/Factory/PiggyBankEventFactory.php
+++ b/app/Factory/PiggyBankEventFactory.php
@@ -41,9 +41,9 @@ class PiggyBankEventFactory
*/
public function create(TransactionJournal $journal, ?PiggyBank $piggyBank): void
{
- Log::debug(sprintf('Now in PiggyBankEventCreate for a %s', $journal->transactionType->type));
+ app('log')->debug(sprintf('Now in PiggyBankEventCreate for a %s', $journal->transactionType->type));
if (null === $piggyBank) {
- Log::debug('Piggy bank is null');
+ app('log')->debug('Piggy bank is null');
return;
}
@@ -58,10 +58,10 @@ class PiggyBankEventFactory
return;
}
- Log::debug('Found repetition');
+ app('log')->debug('Found repetition');
$amount = $piggyRepos->getExactAmount($piggyBank, $repetition, $journal);
if (0 === bccomp($amount, '0')) {
- Log::debug('Amount is zero, will not create event.');
+ app('log')->debug('Amount is zero, will not create event.');
return;
}
diff --git a/app/Factory/TagFactory.php b/app/Factory/TagFactory.php
index 9261ac0de8..4ca15089ae 100644
--- a/app/Factory/TagFactory.php
+++ b/app/Factory/TagFactory.php
@@ -43,12 +43,12 @@ class TagFactory
public function findOrCreate(string $tag): ?Tag
{
$tag = trim($tag);
- Log::debug(sprintf('Now in TagFactory::findOrCreate("%s")', $tag));
+ app('log')->debug(sprintf('Now in TagFactory::findOrCreate("%s")', $tag));
/** @var Tag|null $dbTag */
$dbTag = $this->user->tags()->where('tag', $tag)->first();
if (null !== $dbTag) {
- Log::debug(sprintf('Tag exists (#%d), return it.', $dbTag->id));
+ app('log')->debug(sprintf('Tag exists (#%d), return it.', $dbTag->id));
return $dbTag;
}
@@ -67,7 +67,7 @@ class TagFactory
return null;
}
- Log::debug(sprintf('Created new tag #%d ("%s")', $newTag->id, $newTag->tag));
+ app('log')->debug(sprintf('Created new tag #%d ("%s")', $newTag->id, $newTag->tag));
return $newTag;
}
diff --git a/app/Factory/TransactionCurrencyFactory.php b/app/Factory/TransactionCurrencyFactory.php
index 28b2d9e2e5..ffbc99cdc0 100644
--- a/app/Factory/TransactionCurrencyFactory.php
+++ b/app/Factory/TransactionCurrencyFactory.php
@@ -87,7 +87,7 @@ class TransactionCurrencyFactory
$currencyId = (int)$currencyId;
if ('' === $currencyCode && 0 === $currencyId) {
- Log::debug('Cannot find anything on empty currency code and empty currency ID!');
+ app('log')->debug('Cannot find anything on empty currency code and empty currency ID!');
return null;
}
diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.php
index ca22f9dc39..600e6c21cc 100644
--- a/app/Factory/TransactionFactory.php
+++ b/app/Factory/TransactionFactory.php
@@ -116,7 +116,7 @@ class TransactionFactory
throw new FireflyException('Transaction is NULL.');
}
- Log::debug(
+ app('log')->debug(
sprintf(
'Created transaction #%d (%s %s, account %s), part of journal #%d',
$result->id,
@@ -147,15 +147,15 @@ class TransactionFactory
private function updateAccountInformation(): void
{
if (!array_key_exists('iban', $this->accountInformation)) {
- Log::debug('No IBAN information in array, will not update.');
+ app('log')->debug('No IBAN information in array, will not update.');
return;
}
if ('' !== (string)$this->account->iban) {
- Log::debug('Account already has IBAN information, will not update.');
+ app('log')->debug('Account already has IBAN information, will not update.');
return;
}
if ($this->account->iban === $this->accountInformation['iban']) {
- Log::debug('Account already has this IBAN, will not update.');
+ app('log')->debug('Account already has this IBAN, will not update.');
return;
}
// validate info:
@@ -163,11 +163,11 @@ class TransactionFactory
'iban' => ['required', new UniqueIban($this->account, $this->account->accountType->type)],
]);
if ($validator->fails()) {
- Log::debug('Invalid or non-unique IBAN, will not update.');
+ app('log')->debug('Invalid or non-unique IBAN, will not update.');
return;
}
- Log::debug('Will update account with IBAN information.');
+ app('log')->debug('Will update account with IBAN information.');
$service = app(AccountUpdateService::class);
$service->update($this->account, ['iban' => $this->accountInformation['iban']]);
}
diff --git a/app/Factory/TransactionGroupFactory.php b/app/Factory/TransactionGroupFactory.php
index 9304a24650..a10ed92df5 100644
--- a/app/Factory/TransactionGroupFactory.php
+++ b/app/Factory/TransactionGroupFactory.php
@@ -60,7 +60,7 @@ class TransactionGroupFactory
*/
public function create(array $data): TransactionGroup
{
- Log::debug('Now in TransactionGroupFactory::create()');
+ app('log')->debug('Now in TransactionGroupFactory::create()');
$this->journalFactory->setUser($this->user);
$this->journalFactory->setErrorOnHash($data['error_if_duplicate_hash'] ?? false);
try {
diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php
index 5d0cd72159..f5cad859cb 100644
--- a/app/Factory/TransactionJournalFactory.php
+++ b/app/Factory/TransactionJournalFactory.php
@@ -102,11 +102,11 @@ class TransactionJournalFactory
*/
public function create(array $data): Collection
{
- Log::debug('Now in TransactionJournalFactory::create()');
+ app('log')->debug('Now in TransactionJournalFactory::create()');
// convert to special object.
$dataObject = new NullArrayObject($data);
- Log::debug('Start of TransactionJournalFactory::create()');
+ app('log')->debug('Start of TransactionJournalFactory::create()');
$collection = new Collection();
$transactions = $dataObject['transactions'] ?? [];
if (0 === count($transactions)) {
@@ -117,7 +117,7 @@ class TransactionJournalFactory
try {
/** @var array $row */
foreach ($transactions as $index => $row) {
- Log::debug(sprintf('Now creating journal %d/%d', $index + 1, count($transactions)));
+ app('log')->debug(sprintf('Now creating journal %d/%d', $index + 1, count($transactions)));
$journal = $this->createJournal(new NullArrayObject($row));
if (null !== $journal) {
$collection->push($journal);
@@ -201,13 +201,13 @@ class TransactionJournalFactory
'bic' => $row['destination_bic'],
'currency_id' => $currency->id,
];
- Log::debug('Source info:', $sourceInfo);
- Log::debug('Destination info:', $destInfo);
- Log::debug('Now calling getAccount for the source.');
+ app('log')->debug('Source info:', $sourceInfo);
+ app('log')->debug('Destination info:', $destInfo);
+ app('log')->debug('Now calling getAccount for the source.');
$sourceAccount = $this->getAccount($type->type, 'source', $sourceInfo);
- Log::debug('Now calling getAccount for the destination.');
+ app('log')->debug('Now calling getAccount for the destination.');
$destinationAccount = $this->getAccount($type->type, 'destination', $destInfo);
- Log::debug('Done with getAccount(2x)');
+ app('log')->debug('Done with getAccount(2x)');
// this is the moment for a reconciliation sanity check (again).
if (TransactionType::RECONCILIATION === $type->type) {
@@ -219,7 +219,7 @@ class TransactionJournalFactory
$foreignCurrency = $this->getForeignByAccount($type->type, $foreignCurrency, $destinationAccount);
$description = $this->getDescription($description);
- Log::debug(sprintf('Date: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()->getName()));
+ app('log')->debug(sprintf('Date: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()->getName()));
/** Create a basic journal. */
$journal = TransactionJournal::create(
@@ -236,7 +236,7 @@ class TransactionJournalFactory
'completed' => 0,
]
);
- Log::debug(sprintf('Created new journal #%d: "%s"', $journal->id, $journal->description));
+ app('log')->debug(sprintf('Created new journal #%d: "%s"', $journal->id, $journal->description));
/** Create two transactions. */
$transactionFactory = app(TransactionFactory::class);
@@ -318,7 +318,7 @@ class TransactionJournalFactory
unset($dataRow['import_hash_v2'], $dataRow['original_source']);
$json = json_encode($dataRow, JSON_THROW_ON_ERROR);
$hash = hash('sha256', $json);
- Log::debug(sprintf('The hash is: %s', $hash), $dataRow);
+ app('log')->debug(sprintf('The hash is: %s', $hash), $dataRow);
return $hash;
}
@@ -333,11 +333,11 @@ class TransactionJournalFactory
*/
private function errorIfDuplicate(string $hash): void
{
- Log::debug(sprintf('In errorIfDuplicate(%s)', $hash));
+ app('log')->debug(sprintf('In errorIfDuplicate(%s)', $hash));
if (false === $this->errorOnHash) {
return;
}
- Log::debug('Will verify duplicate!');
+ app('log')->debug('Will verify duplicate!');
/** @var TransactionJournalMeta|null $result */
$result = TransactionJournalMeta::withTrashed()
->where('data', json_encode($hash, JSON_THROW_ON_ERROR))
@@ -362,7 +362,7 @@ class TransactionJournalFactory
*/
private function validateAccounts(NullArrayObject $data): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$transactionType = $data['type'] ?? 'invalid';
$this->accountValidator->setUser($this->user);
$this->accountValidator->setTransactionType($transactionType);
@@ -380,7 +380,7 @@ class TransactionJournalFactory
if (false === $validSource) {
throw new FireflyException(sprintf('Source: %s', $this->accountValidator->sourceError));
}
- Log::debug('Source seems valid.');
+ app('log')->debug('Source seems valid.');
// validate destination account
$array = [
@@ -422,25 +422,25 @@ class TransactionJournalFactory
*/
private function reconciliationSanityCheck(?Account $sourceAccount, ?Account $destinationAccount): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
if (null !== $sourceAccount && null !== $destinationAccount) {
- Log::debug('Both accounts exist, simply return them.');
+ app('log')->debug('Both accounts exist, simply return them.');
return [$sourceAccount, $destinationAccount];
}
if (null !== $sourceAccount && null === $destinationAccount) {
- Log::debug('Destination account is NULL, source account is not.');
+ app('log')->debug('Destination account is NULL, source account is not.');
$account = $this->accountRepository->getReconciliation($sourceAccount);
- Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
+ app('log')->debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
return [$sourceAccount, $account];
}
if (null === $sourceAccount && null !== $destinationAccount) {
- Log::debug('Source account is NULL, destination account is not.');
+ app('log')->debug('Source account is NULL, destination account is not.');
$account = $this->accountRepository->getReconciliation($destinationAccount);
- Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
+ app('log')->debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
return [$account, $destinationAccount];
}
- Log::debug('Unused fallback');
+ app('log')->debug('Unused fallback');
return [$sourceAccount, $destinationAccount];
}
@@ -456,7 +456,7 @@ class TransactionJournalFactory
*/
private function getCurrencyByAccount(string $type, ?TransactionCurrency $currency, Account $source, Account $destination): TransactionCurrency
{
- Log::debug('Now in getCurrencyByAccount()');
+ app('log')->debug('Now in getCurrencyByAccount()');
return match ($type) {
default => $this->getCurrency($currency, $source),
@@ -474,7 +474,7 @@ class TransactionJournalFactory
*/
private function getCurrency(?TransactionCurrency $currency, Account $account): TransactionCurrency
{
- Log::debug('Now in getCurrency()');
+ app('log')->debug('Now in getCurrency()');
/** @var Preference|null $preference */
$preference = $this->accountRepository->getAccountCurrency($account);
if (null === $preference && null === $currency) {
@@ -482,7 +482,7 @@ class TransactionJournalFactory
return app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
}
$result = ($preference ?? $currency) ?? app('amount')->getSystemCurrency();
- Log::debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name));
+ app('log')->debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name));
return $result;
}
@@ -545,11 +545,11 @@ class TransactionJournalFactory
*/
private function forceDeleteOnError(Collection $collection): void
{
- Log::debug(sprintf('forceDeleteOnError on collection size %d item(s)', $collection->count()));
+ app('log')->debug(sprintf('forceDeleteOnError on collection size %d item(s)', $collection->count()));
$service = app(JournalDestroyService::class);
/** @var TransactionJournal $journal */
foreach ($collection as $journal) {
- Log::debug(sprintf('forceDeleteOnError on journal #%d', $journal->id));
+ app('log')->debug(sprintf('forceDeleteOnError on journal #%d', $journal->id));
$service->destroy($journal);
}
}
@@ -570,17 +570,17 @@ class TransactionJournalFactory
*/
private function storePiggyEvent(TransactionJournal $journal, NullArrayObject $data): void
{
- Log::debug('Will now store piggy event.');
+ app('log')->debug('Will now store piggy event.');
$piggyBank = $this->piggyRepository->findPiggyBank((int)$data['piggy_bank_id'], $data['piggy_bank_name']);
if (null !== $piggyBank) {
$this->piggyEventFactory->create($journal, $piggyBank);
- Log::debug('Create piggy event.');
+ app('log')->debug('Create piggy event.');
return;
}
- Log::debug('Create no piggy event');
+ app('log')->debug('Create no piggy event');
}
/**
@@ -608,11 +608,11 @@ class TransactionJournalFactory
];
if ($data[$field] instanceof Carbon) {
$data[$field]->setTimezone(config('app.timezone'));
- Log::debug(sprintf('%s Date: %s (%s)', $field, $data[$field], $data[$field]->timezone->getName()));
+ app('log')->debug(sprintf('%s Date: %s (%s)', $field, $data[$field], $data[$field]->timezone->getName()));
$set['data'] = $data[$field]->format('Y-m-d H:i:s');
}
- Log::debug(sprintf('Going to store meta-field "%s", with value "%s".', $set['name'], $set['data']));
+ app('log')->debug(sprintf('Going to store meta-field "%s", with value "%s".', $set['name'], $set['data']));
/** @var TransactionJournalMetaFactory $factory */
$factory = app(TransactionJournalMetaFactory::class);
diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.php
index 41cfe13971..2da490c44e 100644
--- a/app/Factory/TransactionJournalMetaFactory.php
+++ b/app/Factory/TransactionJournalMetaFactory.php
@@ -39,26 +39,26 @@ class TransactionJournalMetaFactory
*/
public function updateOrCreate(array $data): ?TransactionJournalMeta
{
- //Log::debug('In updateOrCreate()');
+ //app('log')->debug('In updateOrCreate()');
$value = $data['data'];
/** @var TransactionJournalMeta|null $entry */
$entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first();
if (null === $value && null !== $entry) {
- //Log::debug('Value is empty, delete meta value.');
+ //app('log')->debug('Value is empty, delete meta value.');
$entry->delete();
return null;
}
if ($data['data'] instanceof Carbon) {
- Log::debug('Is a carbon object.');
+ app('log')->debug('Is a carbon object.');
$value = $data['data']->toW3cString();
}
if ('' === (string)$value) {
- // Log::debug('Is an empty string.');
+ // app('log')->debug('Is an empty string.');
// don't store blank strings.
if (null !== $entry) {
- Log::debug('Will not store empty strings, delete meta value');
+ app('log')->debug('Will not store empty strings, delete meta value');
$entry->delete();
}
@@ -66,13 +66,13 @@ class TransactionJournalMetaFactory
}
if (null === $entry) {
- //Log::debug('Will create new object.');
- Log::debug(sprintf('Going to create new meta-data entry to store "%s".', $data['name']));
+ //app('log')->debug('Will create new object.');
+ app('log')->debug(sprintf('Going to create new meta-data entry to store "%s".', $data['name']));
$entry = new TransactionJournalMeta();
$entry->transactionJournal()->associate($data['journal']);
$entry->name = $data['name'];
}
- Log::debug('Will update value and return.');
+ app('log')->debug('Will update value and return.');
$entry->data = $value;
$entry->save();
diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php
index f6357e4566..16cc0be7cb 100644
--- a/app/Generator/Report/Budget/MonthReportGenerator.php
+++ b/app/Generator/Report/Budget/MonthReportGenerator.php
@@ -155,7 +155,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
protected function getExpenses(): array
{
if (0 !== count($this->expenses)) {
- Log::debug('Return previous set of expenses.');
+ app('log')->debug('Return previous set of expenses.');
return $this->expenses;
}
diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php
index ec43ddcb29..77abf3a590 100644
--- a/app/Generator/Report/Category/MonthReportGenerator.php
+++ b/app/Generator/Report/Category/MonthReportGenerator.php
@@ -155,7 +155,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
protected function getExpenses(): array
{
if (0 !== count($this->expenses)) {
- Log::debug('Return previous set of expenses.');
+ app('log')->debug('Return previous set of expenses.');
return $this->expenses;
}
diff --git a/app/Generator/Webhook/StandardMessageGenerator.php b/app/Generator/Webhook/StandardMessageGenerator.php
index 418f9dca4c..28235ab8db 100644
--- a/app/Generator/Webhook/StandardMessageGenerator.php
+++ b/app/Generator/Webhook/StandardMessageGenerator.php
@@ -67,14 +67,14 @@ class StandardMessageGenerator implements MessageGeneratorInterface
*/
public function generateMessages(): void
{
- Log::debug(__METHOD__);
+ app('log')->debug(__METHOD__);
// get the webhooks:
if (0 === $this->webhooks->count()) {
$this->webhooks = $this->getWebhooks();
}
// do some debugging
- Log::debug(
+ app('log')->debug(
sprintf('StandardMessageGenerator will generate messages for %d object(s) and %d webhook(s).', $this->objects->count(), $this->webhooks->count())
);
$this->run();
@@ -93,12 +93,12 @@ class StandardMessageGenerator implements MessageGeneratorInterface
*/
private function run(): void
{
- Log::debug('Now in StandardMessageGenerator::run');
+ app('log')->debug('Now in StandardMessageGenerator::run');
/** @var Webhook $webhook */
foreach ($this->webhooks as $webhook) {
$this->runWebhook($webhook);
}
- Log::debug('Done with StandardMessageGenerator::run');
+ app('log')->debug('Done with StandardMessageGenerator::run');
}
/**
@@ -109,7 +109,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
*/
private function runWebhook(Webhook $webhook): void
{
- Log::debug(sprintf('Now in runWebhook(#%d)', $webhook->id));
+ app('log')->debug(sprintf('Now in runWebhook(#%d)', $webhook->id));
/** @var Model $object */
foreach ($this->objects as $object) {
$this->generateMessage($webhook, $object);
@@ -127,7 +127,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
{
$class = get_class($model);
// Line is ignored because all of Firefly III's Models have an id property.
- Log::debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id));
+ app('log')->debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id));
$uuid = Uuid::uuid4();
$basicMessage = [
@@ -232,7 +232,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
$webhookMessage->uuid = $message['uuid'];
$webhookMessage->message = $message;
$webhookMessage->save();
- Log::debug(sprintf('Stored new webhook message #%d', $webhookMessage->id));
+ app('log')->debug(sprintf('Stored new webhook message #%d', $webhookMessage->id));
}
/**
diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.php
index d29eca035f..ddde286c96 100644
--- a/app/Handlers/Events/APIEventHandler.php
+++ b/app/Handlers/Events/APIEventHandler.php
@@ -43,7 +43,7 @@ class APIEventHandler
*/
public function accessTokenCreated(AccessTokenCreated $event): void
{
- Log::debug(__METHOD__);
+ app('log')->debug(__METHOD__);
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
$user = $repository->find((int)$event->userId);
diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.php
index f67f3fec0e..08b7b4273a 100644
--- a/app/Handlers/Events/AutomationHandler.php
+++ b/app/Handlers/Events/AutomationHandler.php
@@ -47,23 +47,23 @@ class AutomationHandler
*/
public function reportJournals(RequestedReportOnJournals $event): void
{
- Log::debug('In reportJournals.');
+ app('log')->debug('In reportJournals.');
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
$user = $repository->find($event->userId);
$sendReport = app('preferences')->getForUser($user, 'notification_transaction_creation', false)->data;
if (false === $sendReport) {
- Log::debug('Not sending report, because config says so.');
+ app('log')->debug('Not sending report, because config says so.');
return;
}
if (null === $user || 0 === $event->groups->count()) {
- Log::debug('No transaction groups in event, nothing to email about.');
+ app('log')->debug('No transaction groups in event, nothing to email about.');
return;
}
- Log::debug('Continue with message!');
+ app('log')->debug('Continue with message!');
// transform groups into array:
/** @var TransactionGroupTransformer $transformer */
@@ -88,6 +88,6 @@ class AutomationHandler
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
}
- Log::debug('If there is no error above this line, message was sent.');
+ app('log')->debug('If there is no error above this line, message was sent.');
}
}
diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.php
index c209fc09ef..f8088c12fc 100644
--- a/app/Handlers/Events/BillEventHandler.php
+++ b/app/Handlers/Events/BillEventHandler.php
@@ -43,14 +43,14 @@ class BillEventHandler
*/
public function warnAboutBill(WarnUserAboutBill $event): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$bill = $event->bill;
/** @var bool $preference */
$preference = app('preferences')->getForUser($bill->user, 'notification_bill_reminder', true)->data;
if (true === $preference) {
- Log::debug('Bill reminder is true!');
+ app('log')->debug('Bill reminder is true!');
try {
Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff));
} catch (Exception $e) {
@@ -68,7 +68,7 @@ class BillEventHandler
}
}
if (false === $preference) {
- Log::debug('User has disabled bill reminders.');
+ app('log')->debug('User has disabled bill reminders.');
}
}
}
diff --git a/app/Handlers/Events/DestroyedGroupEventHandler.php b/app/Handlers/Events/DestroyedGroupEventHandler.php
index a7948333ff..061adefafb 100644
--- a/app/Handlers/Events/DestroyedGroupEventHandler.php
+++ b/app/Handlers/Events/DestroyedGroupEventHandler.php
@@ -40,7 +40,7 @@ class DestroyedGroupEventHandler
*/
public function triggerWebhooks(DestroyedTransactionGroup $destroyedGroupEvent): void
{
- Log::debug('DestroyedTransactionGroup:triggerWebhooks');
+ app('log')->debug('DestroyedTransactionGroup:triggerWebhooks');
$group = $destroyedGroupEvent->transactionGroup;
$user = $group->user;
/** @var MessageGeneratorInterface $engine */
diff --git a/app/Handlers/Events/Model/BudgetLimitHandler.php b/app/Handlers/Events/Model/BudgetLimitHandler.php
index 7bf72ba2fe..a937806af2 100644
--- a/app/Handlers/Events/Model/BudgetLimitHandler.php
+++ b/app/Handlers/Events/Model/BudgetLimitHandler.php
@@ -51,7 +51,7 @@ class BudgetLimitHandler
*/
public function created(Created $event): void
{
- Log::debug(sprintf('BudgetLimitHandler::created(#%s)', $event->budgetLimit->id));
+ app('log')->debug(sprintf('BudgetLimitHandler::created(#%s)', $event->budgetLimit->id));
$this->updateAvailableBudget($event->budgetLimit);
}
@@ -62,7 +62,7 @@ class BudgetLimitHandler
*/
private function updateAvailableBudget(BudgetLimit $budgetLimit): void
{
- Log::debug(sprintf('Now in updateAvailableBudget(#%d)', $budgetLimit->id));
+ app('log')->debug(sprintf('Now in updateAvailableBudget(#%d)', $budgetLimit->id));
$budget = Budget::find($budgetLimit->budget_id);
if (null === $budget) {
app('log')->warning('Budget is null, probably deleted, find deleted version.');
@@ -113,7 +113,7 @@ class BudgetLimitHandler
)->where('transaction_currency_id', $budgetLimit->transaction_currency_id)->first();
if (null !== $availableBudget) {
- Log::debug('Found 1 AB, will update.');
+ app('log')->debug('Found 1 AB, will update.');
$this->calculateAmount($availableBudget);
}
if (null === $availableBudget) {
@@ -127,10 +127,10 @@ class BudgetLimitHandler
$amount = 0 === (int)$budgetLimit->id ? '0' : $budgetLimit->amount;
}
if (0 === bccomp($amount, '0')) {
- Log::debug('Amount is zero, will not create AB.');
+ app('log')->debug('Amount is zero, will not create AB.');
}
if (0 !== bccomp($amount, '0')) {
- Log::debug(sprintf('Will create AB for period %s to %s', $current->format('Y-m-d'), $currentEnd->format('Y-m-d')));
+ app('log')->debug(sprintf('Will create AB for period %s to %s', $current->format('Y-m-d'), $currentEnd->format('Y-m-d')));
$availableBudget = new AvailableBudget(
[
'user_id' => $budgetLimit->budget->user->id,
@@ -161,7 +161,7 @@ class BudgetLimitHandler
$repository->setUser($availableBudget->user);
$newAmount = '0';
$abPeriod = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY());
- Log::debug(
+ app('log')->debug(
sprintf(
'Now at AB #%d, ("%s" to "%s")',
$availableBudget->id,
@@ -171,10 +171,10 @@ class BudgetLimitHandler
);
// have to recalculate everything just in case.
$set = $repository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date);
- Log::debug(sprintf('Found %d interesting budget limit(s).', $set->count()));
+ app('log')->debug(sprintf('Found %d interesting budget limit(s).', $set->count()));
/** @var BudgetLimit $budgetLimit */
foreach ($set as $budgetLimit) {
- Log::debug(
+ app('log')->debug(
sprintf(
'Found interesting budget limit #%d ("%s" to "%s")',
$budgetLimit->id,
@@ -210,11 +210,11 @@ class BudgetLimitHandler
}
}
if (0 === bccomp('0', $newAmount)) {
- Log::debug('New amount is zero, deleting AB.');
+ app('log')->debug('New amount is zero, deleting AB.');
$availableBudget->delete();
return;
}
- Log::debug(sprintf('Concluded new amount for this AB must be %s', $newAmount));
+ app('log')->debug(sprintf('Concluded new amount for this AB must be %s', $newAmount));
$availableBudget->amount = app('steam')->bcround($newAmount, $availableBudget->transactionCurrency->decimal_places);
$availableBudget->save();
}
@@ -237,7 +237,7 @@ class BudgetLimitHandler
);
$days = $limitPeriod->length();
$amount = bcdiv((string)$budgetLimit->amount, (string)$days, 12);
- Log::debug(
+ app('log')->debug(
sprintf('Total amount for budget limit #%d is %s. Nr. of days is %d. Amount per day is %s', $budgetLimit->id, $budgetLimit->amount, $days, $amount)
);
return $amount;
@@ -250,7 +250,7 @@ class BudgetLimitHandler
*/
public function deleted(Deleted $event): void
{
- Log::debug(sprintf('BudgetLimitHandler::deleted(#%s)', $event->budgetLimit->id));
+ app('log')->debug(sprintf('BudgetLimitHandler::deleted(#%s)', $event->budgetLimit->id));
$budgetLimit = $event->budgetLimit;
$budgetLimit->id = null;
$this->updateAvailableBudget($event->budgetLimit);
@@ -263,7 +263,7 @@ class BudgetLimitHandler
*/
public function updated(Updated $event): void
{
- Log::debug(sprintf('BudgetLimitHandler::updated(#%s)', $event->budgetLimit->id));
+ app('log')->debug(sprintf('BudgetLimitHandler::updated(#%s)', $event->budgetLimit->id));
$this->updateAvailableBudget($event->budgetLimit);
}
diff --git a/app/Handlers/Events/StoredGroupEventHandler.php b/app/Handlers/Events/StoredGroupEventHandler.php
index 2a367f1b2b..5152a7c733 100644
--- a/app/Handlers/Events/StoredGroupEventHandler.php
+++ b/app/Handlers/Events/StoredGroupEventHandler.php
@@ -51,7 +51,7 @@ class StoredGroupEventHandler
return;
}
- Log::debug('Now in StoredGroupEventHandler::processRules()');
+ app('log')->debug('Now in StoredGroupEventHandler::processRules()');
$journals = $storedGroupEvent->transactionGroup->transactionJournals;
$array = [];
@@ -60,7 +60,7 @@ class StoredGroupEventHandler
$array[] = $journal->id;
}
$journalIds = implode(',', $array);
- Log::debug(sprintf('Add local operator for journal(s): %s', $journalIds));
+ app('log')->debug(sprintf('Add local operator for journal(s): %s', $journalIds));
// collect rules:
$ruleGroupRepository = app(RuleGroupRepositoryInterface::class);
@@ -97,7 +97,7 @@ class StoredGroupEventHandler
*/
public function triggerWebhooks(StoredTransactionGroup $storedGroupEvent): void
{
- Log::debug(__METHOD__);
+ app('log')->debug(__METHOD__);
$group = $storedGroupEvent->transactionGroup;
if (false === $storedGroupEvent->fireWebhooks) {
app('log')->info(sprintf('Will not fire webhooks for transaction group #%d', $group->id));
diff --git a/app/Handlers/Events/UpdatedGroupEventHandler.php b/app/Handlers/Events/UpdatedGroupEventHandler.php
index 12052673b9..b46816c988 100644
--- a/app/Handlers/Events/UpdatedGroupEventHandler.php
+++ b/app/Handlers/Events/UpdatedGroupEventHandler.php
@@ -62,7 +62,7 @@ class UpdatedGroupEventHandler
$array[] = $journal->id;
}
$journalIds = implode(',', $array);
- Log::debug(sprintf('Add local operator for journal(s): %s', $journalIds));
+ app('log')->debug(sprintf('Add local operator for journal(s): %s', $journalIds));
// collect rules:
$ruleGroupRepository = app(RuleGroupRepositoryInterface::class);
@@ -95,7 +95,7 @@ class UpdatedGroupEventHandler
*/
public function triggerWebhooks(UpdatedTransactionGroup $updatedGroupEvent): void
{
- Log::debug(__METHOD__);
+ app('log')->debug(__METHOD__);
$group = $updatedGroupEvent->transactionGroup;
if (false === $updatedGroupEvent->fireWebhooks) {
app('log')->info(sprintf('Will not fire webhooks for transaction group #%d', $group->id));
diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php
index 158ac44faa..498d0770e7 100644
--- a/app/Handlers/Events/UserEventHandler.php
+++ b/app/Handlers/Events/UserEventHandler.php
@@ -73,7 +73,7 @@ class UserEventHandler
// first user ever?
if (1 === $repository->count()) {
- Log::debug('User count is one, attach role.');
+ app('log')->debug('User count is one, attach role.');
$repository->attachRole($event->user, 'owner');
}
}
@@ -386,11 +386,11 @@ class UserEventHandler
*/
public function storeUserIPAddress(ActuallyLoggedIn $event): void
{
- Log::debug('Now in storeUserIPAddress');
+ app('log')->debug('Now in storeUserIPAddress');
$user = $event->user;
if ($user->hasRole('demo')) {
- Log::debug('Do not log demo user logins');
+ app('log')->debug('Do not log demo user logins');
return;
}
@@ -405,19 +405,19 @@ class UserEventHandler
}
$inArray = false;
$ip = request()->ip();
- Log::debug(sprintf('User logging in from IP address %s', $ip));
+ app('log')->debug(sprintf('User logging in from IP address %s', $ip));
// update array if in array
foreach ($preference as $index => $row) {
if ($row['ip'] === $ip) {
- Log::debug('Found IP in array, refresh time.');
+ app('log')->debug('Found IP in array, refresh time.');
$preference[$index]['time'] = now(config('app.timezone'))->format('Y-m-d H:i:s');
$inArray = true;
}
// clean up old entries (6 months)
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $preference[$index]['time']);
if ($carbon->diffInMonths(today()) > 6) {
- Log::debug(sprintf('Entry for %s is very old, remove it.', $row['ip']));
+ app('log')->debug(sprintf('Entry for %s is very old, remove it.', $row['ip']));
unset($preference[$index]);
}
}
diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php
index 5b39792b23..5119bded6b 100644
--- a/app/Handlers/Events/VersionCheckEventHandler.php
+++ b/app/Handlers/Events/VersionCheckEventHandler.php
@@ -51,13 +51,13 @@ class VersionCheckEventHandler
*/
public function checkForUpdates(RequestedVersionCheckStatus $event): void
{
- Log::debug('Now in checkForUpdates()');
+ app('log')->debug('Now in checkForUpdates()');
// should not check for updates:
$permission = app('fireflyconfig')->get('permission_update_check', -1);
$value = (int)$permission->data;
if (1 !== $value) {
- Log::debug('Update check is not enabled.');
+ app('log')->debug('Update check is not enabled.');
$this->warnToCheckForUpdates($event);
return;
@@ -67,7 +67,7 @@ class VersionCheckEventHandler
$repository = app(UserRepositoryInterface::class);
$user = $event->user;
if (!$repository->hasRole($user, 'owner')) {
- Log::debug('User is not admin, done.');
+ app('log')->debug('User is not admin, done.');
return;
}
@@ -76,14 +76,14 @@ class VersionCheckEventHandler
$lastCheckTime = app('fireflyconfig')->get('last_update_check', time());
$now = time();
$diff = $now - $lastCheckTime->data;
- Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
+ app('log')->debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
if ($diff < 604800) {
- Log::debug(sprintf('Checked for updates less than a week ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
+ app('log')->debug(sprintf('Checked for updates less than a week ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
return;
}
// last check time was more than a week ago.
- Log::debug('Have not checked for a new version in a week!');
+ app('log')->debug('Have not checked for a new version in a week!');
$release = $this->getLatestRelease();
session()->flash($release['level'], $release['message']);
@@ -103,7 +103,7 @@ class VersionCheckEventHandler
$repository = app(UserRepositoryInterface::class);
$user = $event->user;
if (!$repository->hasRole($user, 'owner')) {
- Log::debug('User is not admin, done.');
+ app('log')->debug('User is not admin, done.');
return;
}
@@ -112,14 +112,14 @@ class VersionCheckEventHandler
$lastCheckTime = app('fireflyconfig')->get('last_update_warning', time());
$now = time();
$diff = $now - $lastCheckTime->data;
- Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
+ app('log')->debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
if ($diff < 604800 * 4) {
- Log::debug(sprintf('Warned about updates less than four weeks ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
+ app('log')->debug(sprintf('Warned about updates less than four weeks ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
return;
}
// last check time was more than a week ago.
- Log::debug('Have warned about a new version in four weeks!');
+ app('log')->debug('Have warned about a new version in four weeks!');
session()->flash('info', (string)trans('firefly.disabled_but_check'));
app('fireflyconfig')->set('last_update_warning', time());
diff --git a/app/Handlers/Events/WebhookEventHandler.php b/app/Handlers/Events/WebhookEventHandler.php
index c678510606..b3e769fff7 100644
--- a/app/Handlers/Events/WebhookEventHandler.php
+++ b/app/Handlers/Events/WebhookEventHandler.php
@@ -37,7 +37,7 @@ class WebhookEventHandler
*/
public function sendWebhookMessages(): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
// kick off the job!
$messages = WebhookMessage::where('webhook_messages.sent', false)
->get(['webhook_messages.*'])
@@ -46,14 +46,14 @@ class WebhookEventHandler
return $message->webhookAttempts()->count() <= 2;
}
)->splice(0, 5);
- Log::debug(sprintf('Found %d webhook message(s) ready to be send.', $messages->count()));
+ app('log')->debug(sprintf('Found %d webhook message(s) ready to be send.', $messages->count()));
foreach ($messages as $message) {
if (false === $message->sent) {
- Log::debug(sprintf('Send message #%d', $message->id));
+ app('log')->debug(sprintf('Send message #%d', $message->id));
SendWebhookMessage::dispatch($message)->afterResponse();
}
if (false !== $message->sent) {
- Log::debug(sprintf('Skip message #%d', $message->id));
+ app('log')->debug(sprintf('Skip message #%d', $message->id));
}
}
}
diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php
index 84f65ffb36..9b883759bf 100644
--- a/app/Helpers/Attachments/AttachmentHelper.php
+++ b/app/Helpers/Attachments/AttachmentHelper.php
@@ -193,19 +193,19 @@ class AttachmentHelper implements AttachmentHelperInterface
return false;
}
- Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model)));
+ app('log')->debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model)));
if (is_array($files)) {
- Log::debug('$files is an array.');
+ app('log')->debug('$files is an array.');
/** @var UploadedFile $entry */
foreach ($files as $entry) {
if (null !== $entry) {
$this->processFile($entry, $model);
}
}
- Log::debug('Done processing uploads.');
+ app('log')->debug('Done processing uploads.');
}
if (!is_array($files)) {
- Log::debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.');
+ app('log')->debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.');
}
return true;
@@ -223,7 +223,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
protected function processFile(UploadedFile $file, Model $model): ?Attachment
{
- Log::debug('Now in processFile()');
+ app('log')->debug('Now in processFile()');
$validation = $this->validateUpload($file, $model);
$attachment = null;
if (false !== $validation) {
@@ -242,7 +242,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$attachment->size = $file->getSize();
$attachment->uploaded = false;
$attachment->save();
- Log::debug('Created attachment:', $attachment->toArray());
+ app('log')->debug('Created attachment:', $attachment->toArray());
$fileObject = $file->openFile();
$fileObject->rewind();
@@ -252,7 +252,7 @@ class AttachmentHelper implements AttachmentHelperInterface
}
$content = $fileObject->fread($file->getSize());
- Log::debug(sprintf('Full file length is %d and upload size is %d.', strlen($content), $file->getSize()));
+ app('log')->debug(sprintf('Full file length is %d and upload size is %d.', strlen($content), $file->getSize()));
// store it without encryption.
$this->uploadDisk->put($attachment->fileName(), $content);
@@ -278,7 +278,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
protected function validateUpload(UploadedFile $file, Model $model): bool
{
- Log::debug('Now in validateUpload()');
+ app('log')->debug('Now in validateUpload()');
$result = true;
if (!$this->validMime($file)) {
$result = false;
@@ -310,11 +310,11 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
protected function validMime(UploadedFile $file): bool
{
- Log::debug('Now in validMime()');
+ app('log')->debug('Now in validMime()');
$mime = e($file->getMimeType());
$name = e($file->getClientOriginalName());
- Log::debug(sprintf('Name is %s, and mime is %s', $name, $mime));
- Log::debug('Valid mimes are', $this->allowedMimes);
+ app('log')->debug(sprintf('Name is %s, and mime is %s', $name, $mime));
+ app('log')->debug('Valid mimes are', $this->allowedMimes);
$result = true;
if (!in_array($mime, $this->allowedMimes, true)) {
diff --git a/app/Helpers/Collector/Extensions/AttachmentCollection.php b/app/Helpers/Collector/Extensions/AttachmentCollection.php
index 161422d107..ed0c33fedc 100644
--- a/app/Helpers/Collector/Extensions/AttachmentCollection.php
+++ b/app/Helpers/Collector/Extensions/AttachmentCollection.php
@@ -73,7 +73,7 @@ trait AttachmentCollection
*/
public function hasAttachments(): GroupCollectorInterface
{
- Log::debug('Add filter on attachment ID.');
+ app('log')->debug('Add filter on attachment ID.');
$this->joinAttachmentTables();
$this->query->whereNotNull('attachments.attachable_id');
$this->query->whereNull('attachments.deleted_at');
@@ -542,7 +542,7 @@ trait AttachmentCollection
*/
public function hasNoAttachments(): GroupCollectorInterface
{
- Log::debug('Add filter on no attachments.');
+ app('log')->debug('Add filter on no attachments.');
$this->joinAttachmentTables();
$this->query->where(function (Builder $q1) {
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index 535455773f..b23086e416 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -328,8 +328,8 @@ class GroupCollector implements GroupCollectorInterface
*/
public function dumpQueryInLogs(): void
{
- Log::debug($this->query->select($this->fields)->toSql());
- Log::debug('Bindings', $this->query->getBindings());
+ app('log')->debug($this->query->select($this->fields)->toSql());
+ app('log')->debug('Bindings', $this->query->getBindings());
}
/**
@@ -653,7 +653,7 @@ class GroupCollector implements GroupCollectorInterface
try {
$tagDate = Carbon::parse($augumentedJournal['tag_date']);
} catch (InvalidFormatException $e) {
- Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not parse date: %s', $e->getMessage()));
}
$result['tags'][$tagId] = [
@@ -734,7 +734,7 @@ class GroupCollector implements GroupCollectorInterface
try {
$tagDate = Carbon::parse($newArray['tag_date']);
} catch (InvalidFormatException $e) {
- Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not parse date: %s', $e->getMessage()));
}
$existingJournal['tags'][$tagId] = [
diff --git a/app/Helpers/Fiscal/FiscalHelper.php b/app/Helpers/Fiscal/FiscalHelper.php
index a1c86ce9eb..b0e5209f6f 100644
--- a/app/Helpers/Fiscal/FiscalHelper.php
+++ b/app/Helpers/Fiscal/FiscalHelper.php
@@ -52,7 +52,7 @@ class FiscalHelper implements FiscalHelperInterface
*/
public function endOfFiscalYear(Carbon $date): Carbon
{
- // Log::debug(sprintf('Now in endOfFiscalYear(%s).', $date->format('Y-m-d')));
+ // app('log')->debug(sprintf('Now in endOfFiscalYear(%s).', $date->format('Y-m-d')));
$endDate = $this->startOfFiscalYear($date);
if (true === $this->useCustomFiscalYear) {
// add 1 year and sub 1 day
@@ -62,7 +62,7 @@ class FiscalHelper implements FiscalHelperInterface
if (false === $this->useCustomFiscalYear) {
$endDate->endOfYear();
}
- // Log::debug(sprintf('Result of endOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $endDate->format('Y-m-d')));
+ // app('log')->debug(sprintf('Result of endOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $endDate->format('Y-m-d')));
return $endDate;
}
@@ -92,7 +92,7 @@ class FiscalHelper implements FiscalHelperInterface
$startDate->startOfYear();
}
- // Log::debug(sprintf('Result of startOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $startDate->format('Y-m-d')));
+ // app('log')->debug(sprintf('Result of startOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $startDate->format('Y-m-d')));
return $startDate;
}
diff --git a/app/Helpers/Update/UpdateTrait.php b/app/Helpers/Update/UpdateTrait.php
index b5443da8de..e0aa0a0431 100644
--- a/app/Helpers/Update/UpdateTrait.php
+++ b/app/Helpers/Update/UpdateTrait.php
@@ -45,7 +45,7 @@ trait UpdateTrait
*/
public function getLatestRelease(): array
{
- Log::debug('Now in getLatestRelease()');
+ app('log')->debug('Now in getLatestRelease()');
/** @var UpdateRequestInterface $checker */
$checker = app(UpdateRequestInterface::class);
$channelConfig = app('fireflyconfig')->get('update_channel', 'stable');
diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.php
index 3a6915cb8a..966f0efa14 100644
--- a/app/Http/Controllers/Account/IndexController.php
+++ b/app/Http/Controllers/Account/IndexController.php
@@ -138,7 +138,7 @@ class IndexController extends Controller
*/
public function index(Request $request, string $objectType)
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
$subTitle = (string)trans(sprintf('firefly.%s_accounts', $objectType));
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));
$types = config(sprintf('firefly.accountTypesByIdentifier.%s', $objectType));
@@ -152,7 +152,7 @@ class IndexController extends Controller
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
$inactiveCount = $this->repository->getInactiveAccountsByType($types)->count();
- Log::debug(sprintf('Count of collection: %d, count of accounts: %d', $total, $accounts->count()));
+ app('log')->debug(sprintf('Count of collection: %d, count of accounts: %d', $total, $accounts->count()));
unset($collection);
/** @var Carbon $start */
@@ -189,13 +189,13 @@ class IndexController extends Controller
}
);
// make paginator:
- Log::debug(sprintf('Count of accounts before LAP: %d', $accounts->count()));
+ app('log')->debug(sprintf('Count of accounts before LAP: %d', $accounts->count()));
/** @var LengthAwarePaginator $accounts */
$accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
$accounts->setPath(route('accounts.index', [$objectType]));
- Log::debug(sprintf('Count of accounts after LAP (1): %d', $accounts->count()));
- Log::debug(sprintf('Count of accounts after LAP (2): %d', $accounts->getCollection()->count()));
+ app('log')->debug(sprintf('Count of accounts after LAP (1): %d', $accounts->count()));
+ app('log')->debug(sprintf('Count of accounts after LAP (2): %d', $accounts->getCollection()->count()));
return view('accounts.index', compact('objectType', 'inactiveCount', 'subTitleIcon', 'subTitle', 'page', 'accounts'));
}
diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php
index 414a14b7e7..5f1950667e 100644
--- a/app/Http/Controllers/Account/ReconcileController.php
+++ b/app/Http/Controllers/Account/ReconcileController.php
@@ -169,14 +169,14 @@ class ReconcileController extends Controller
return $this->redirectAccountToAccount($account);
}
- Log::debug('In ReconcileController::submit()');
+ app('log')->debug('In ReconcileController::submit()');
$data = $request->getAll();
/** @var string $journalId */
foreach ($data['journals'] as $journalId) {
$this->repository->reconcileById((int)$journalId);
}
- Log::debug('Reconciled all transactions.');
+ app('log')->debug('Reconciled all transactions.');
// switch dates if necessary
if ($end->lt($start)) {
@@ -188,7 +188,7 @@ class ReconcileController extends Controller
if ('create' === $data['reconcile']) {
$result = $this->createReconciliation($account, $start, $end, $data['difference']);
}
- Log::debug('End of routine.');
+ app('log')->debug('End of routine.');
app('preferences')->mark();
if ('' === $result) {
session()->flash('success', (string)trans('firefly.reconciliation_stored'));
diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.php
index 38c5799cc6..1a96d9f7b0 100644
--- a/app/Http/Controllers/Admin/HomeController.php
+++ b/app/Http/Controllers/Admin/HomeController.php
@@ -120,7 +120,7 @@ class HomeController extends Controller
Log::channel('audit')->info('User sends test message.');
/** @var User $user */
$user = auth()->user();
- Log::debug('Now in testMessage() controller.');
+ app('log')->debug('Now in testMessage() controller.');
event(new AdminRequestedTestMessage($user));
session()->flash('info', (string)trans('firefly.send_test_triggered'));
diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php
index 12808973f3..ceaf8e0d74 100644
--- a/app/Http/Controllers/Admin/UserController.php
+++ b/app/Http/Controllers/Admin/UserController.php
@@ -94,13 +94,13 @@ class UserController extends Controller
*/
public function deleteInvite(InvitedUser $invitedUser): JsonResponse
{
- Log::debug('Will now delete invitation');
+ app('log')->debug('Will now delete invitation');
if ($invitedUser->redeemed) {
- Log::debug('Is already redeemed.');
+ app('log')->debug('Is already redeemed.');
session()->flash('error', trans('firefly.invite_is_already_redeemed', ['address' => $invitedUser->email]));
return response()->json(['success' => false]);
}
- Log::debug('Delete!');
+ app('log')->debug('Delete!');
session()->flash('success', trans('firefly.invite_is_deleted', ['address' => $invitedUser->email]));
$this->repository->deleteInvite($invitedUser);
return response()->json(['success' => true]);
@@ -246,7 +246,7 @@ class UserController extends Controller
*/
public function update(UserFormRequest $request, User $user)
{
- Log::debug('Actually here');
+ app('log')->debug('Actually here');
$data = $request->getUserData();
//var_dump($data);
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index e62b6d22e5..f4ab78dcbd 100644
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -90,7 +90,7 @@ class LoginController extends Controller
app('log')->info('User is trying to login.');
$this->validateLogin($request);
- Log::debug('Login data is present.');
+ app('log')->debug('Login data is present.');
/** Copied directly from AuthenticatesUsers, but with logging added: */
// If the class is using the ThrottlesLogins trait, we can automatically throttle
@@ -106,7 +106,7 @@ class LoginController extends Controller
/** Copied directly from AuthenticatesUsers, but with logging added: */
if ($this->attemptLogin($request)) {
Log::channel('audit')->info(sprintf('User "%s" has been logged in.', $request->get($this->username())));
- Log::debug(sprintf('Redirect after login is %s.', $this->redirectPath()));
+ app('log')->debug(sprintf('Redirect after login is %s.', $this->redirectPath()));
// if you just logged in, it can't be that you have a valid 2FA cookie.
diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.php
index 9c82002fc0..fe1db62636 100644
--- a/app/Http/Controllers/Bill/IndexController.php
+++ b/app/Http/Controllers/Bill/IndexController.php
@@ -190,8 +190,8 @@ class IndexController extends Controller
{
$avg = bcdiv(bcadd((string)$bill['amount_min'], (string)$bill['amount_max']), '2');
- Log::debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));
- Log::debug(sprintf('Average is %s', $avg));
+ app('log')->debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));
+ app('log')->debug(sprintf('Average is %s', $avg));
// calculate amount per year:
$multiplies = [
'yearly' => '1',
@@ -202,7 +202,7 @@ class IndexController extends Controller
'daily' => '365.24',
];
$yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
- Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
+ app('log')->debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
// per period:
$division = [
@@ -222,7 +222,7 @@ class IndexController extends Controller
];
$perPeriod = bcdiv($yearAmount, $division[$range]);
- Log::debug(sprintf('Amount per %s is %s (%s / %s)', $range, $perPeriod, $yearAmount, $division[$range]));
+ app('log')->debug(sprintf('Amount per %s is %s (%s / %s)', $range, $perPeriod, $yearAmount, $division[$range]));
return $perPeriod;
}
diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php
index 8cc83335cd..08a07838fb 100644
--- a/app/Http/Controllers/Budget/BudgetLimitController.php
+++ b/app/Http/Controllers/Budget/BudgetLimitController.php
@@ -130,7 +130,7 @@ class BudgetLimitController extends Controller
*/
public function store(Request $request): RedirectResponse | JsonResponse
{
- Log::debug('Going to store new budget-limit.', $request->all());
+ app('log')->debug('Going to store new budget-limit.', $request->all());
// first search for existing one and update it if necessary.
$currency = $this->currencyRepos->find((int)$request->get('transaction_currency_id'));
$budget = $this->repository->find((int)$request->get('budget_id'));
@@ -147,7 +147,7 @@ class BudgetLimitController extends Controller
return response()->json([]);
}
- Log::debug(sprintf('Start: %s, end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
+ app('log')->debug(sprintf('Start: %s, end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
$limit = $this->blRepository->find($budget, $currency, $start, $end);
diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php
index 22eb85d586..4003baf3fd 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -102,7 +102,7 @@ class IndexController extends Controller
public function index(Request $request, Carbon $start = null, Carbon $end = null)
{
$this->abRepository->cleanup();
- Log::debug(sprintf('Start of IndexController::index("%s", "%s")', $start?->format('Y-m-d'), $end?->format('Y-m-d')));
+ app('log')->debug(sprintf('Start of IndexController::index("%s", "%s")', $start?->format('Y-m-d'), $end?->format('Y-m-d')));
// collect some basic vars:
$range = app('navigation')->getViewRange(true);
@@ -219,12 +219,12 @@ class IndexController extends Controller
// get all budgets, and paginate them into $budgets.
$collection = $this->repository->getActiveBudgets();
$budgets = [];
- Log::debug(sprintf('7) Start is "%s", end is "%s"', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));
+ app('log')->debug(sprintf('7) Start is "%s", end is "%s"', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));
// complement budget with budget limits in range, and expenses in currency X in range.
/** @var Budget $current */
foreach ($collection as $current) {
- Log::debug(sprintf('Working on budget #%d ("%s")', $current->id, $current->name));
+ app('log')->debug(sprintf('Working on budget #%d ("%s")', $current->id, $current->name));
$array = $current->toArray();
$array['spent'] = [];
$array['spent_total'] = [];
@@ -234,7 +234,7 @@ class IndexController extends Controller
$budgetLimits = $this->blRepository->getBudgetLimits($current, $start, $end);
/** @var BudgetLimit $limit */
foreach ($budgetLimits as $limit) {
- Log::debug(sprintf('Working on budget limit #%d', $limit->id));
+ app('log')->debug(sprintf('Working on budget limit #%d', $limit->id));
$currency = $limit->transactionCurrency ?? $defaultCurrency;
$amount = app('steam')->bcround($limit->amount, $currency->decimal_places);
$array['budgeted'][] = [
@@ -248,7 +248,7 @@ class IndexController extends Controller
'currency_name' => $currency->name,
'currency_decimal_places' => $currency->decimal_places,
];
- Log::debug(sprintf('The amount budgeted for budget limit #%d is %s %s', $limit->id, $currency->code, $amount));
+ app('log')->debug(sprintf('The amount budgeted for budget limit #%d is %s %s', $limit->id, $currency->code, $amount));
}
/** @var TransactionCurrency $currency */
@@ -348,7 +348,7 @@ class IndexController extends Controller
$budgetId = (int)$budgetId;
$budget = $repository->find($budgetId);
if (null !== $budget) {
- Log::debug(sprintf('Set budget #%d ("%s") to position %d', $budget->id, $budget->name, $index + 1));
+ app('log')->debug(sprintf('Set budget #%d ("%s") to position %d', $budget->id, $budget->name, $index + 1));
$repository->setBudgetOrder($budget, $index + 1);
}
}
diff --git a/app/Http/Controllers/Category/NoCategoryController.php b/app/Http/Controllers/Category/NoCategoryController.php
index 3b8d7bb4b3..693ee23bf6 100644
--- a/app/Http/Controllers/Category/NoCategoryController.php
+++ b/app/Http/Controllers/Category/NoCategoryController.php
@@ -83,7 +83,7 @@ class NoCategoryController extends Controller
*/
public function show(Request $request, Carbon $start = null, Carbon $end = null)
{
- Log::debug('Start of noCategory()');
+ app('log')->debug('Start of noCategory()');
/** @var Carbon $start */
$start = $start ?? session('start');
/** @var Carbon $end */
@@ -96,8 +96,8 @@ class NoCategoryController extends Controller
);
$periods = $this->getNoCategoryPeriodOverview($start);
- Log::debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
- Log::debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
+ app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
+ app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
@@ -128,13 +128,13 @@ class NoCategoryController extends Controller
$periods = new Collection();
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
- Log::debug('Start of noCategory()');
+ app('log')->debug('Start of noCategory()');
$subTitle = (string)trans('firefly.all_journals_without_category');
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon() : $first->date;
$end = today(config('app.timezone'));
- Log::debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
- Log::debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
+ app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
+ app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php
index ab4cdf48e3..21b26f4e63 100644
--- a/app/Http/Controllers/Chart/AccountController.php
+++ b/app/Http/Controllers/Chart/AccountController.php
@@ -335,12 +335,12 @@ class AccountController extends Controller
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
$defaultSet = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray();
- Log::debug('Default set is ', $defaultSet);
+ app('log')->debug('Default set is ', $defaultSet);
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
- Log::debug('Frontpage preference set is ', $frontPage->data);
+ app('log')->debug('Frontpage preference set is ', $frontPage->data);
if (0 === count($frontPage->data)) {
app('preferences')->set('frontPageAccounts', $defaultSet);
- Log::debug('frontpage set is empty!');
+ app('log')->debug('frontpage set is empty!');
}
$accounts = $repository->getAccountsById($frontPage->data);
diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php
index 2b0f3b98ea..9c3e5f0b6f 100644
--- a/app/Http/Controllers/Chart/ReportController.php
+++ b/app/Http/Controllers/Chart/ReportController.php
@@ -98,7 +98,7 @@ class ReportController extends Controller
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
if (false === $result) {
- Log::debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
+ app('log')->debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
}
return $result;
@@ -160,7 +160,7 @@ class ReportController extends Controller
if ($cache->has()) {
return response()->json($cache->get());
}
- Log::debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
+ app('log')->debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
$format = app('navigation')->preferredCarbonFormat($start, $end);
$titleFormat = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
$preferredRange = app('navigation')->preferredRangeFormat($start, $end);
diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php
index 40325d3410..27f173aaa3 100644
--- a/app/Http/Controllers/DebugController.php
+++ b/app/Http/Controllers/DebugController.php
@@ -69,7 +69,7 @@ class DebugController extends Controller
*/
public function displayError(): void
{
- Log::debug('This is a test message at the DEBUG level.');
+ app('log')->debug('This is a test message at the DEBUG 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.');
@@ -92,21 +92,21 @@ class DebugController extends Controller
{
app('preferences')->mark();
$request->session()->forget(['start', 'end', '_previous', 'viewRange', 'range', 'is_custom_range', 'temp-mfa-secret', 'temp-mfa-codes']);
- Log::debug('Call cache:clear...');
+ app('log')->debug('Call cache:clear...');
Artisan::call('cache:clear');
- Log::debug('Call config:clear...');
+ app('log')->debug('Call config:clear...');
Artisan::call('config:clear');
- Log::debug('Call route:clear...');
+ app('log')->debug('Call route:clear...');
Artisan::call('route:clear');
- Log::debug('Call twig:clean...');
+ app('log')->debug('Call twig:clean...');
try {
Artisan::call('twig:clean');
} catch (Exception $e) { // intentional generic exception
throw new FireflyException($e->getMessage(), 0, $e);
}
- Log::debug('Call view:clear...');
+ app('log')->debug('Call view:clear...');
Artisan::call('view:clear');
return redirect(route('index'));
@@ -202,7 +202,7 @@ class DebugController extends Controller
$return['build'] = trim(file_get_contents('/var/www/counter-main.txt'));
}
} catch (Exception $e) { // generic catch for open basedir.
- Log::debug('Could not check build counter, but thats ok.');
+ app('log')->debug('Could not check build counter, but thats ok.');
app('log')->warning($e->getMessage());
}
try {
@@ -210,7 +210,7 @@ class DebugController extends Controller
$return['build_date'] = trim(file_get_contents('/var/www/build-date-main.txt'));
}
} catch (Exception $e) { // generic catch for open basedir.
- Log::debug('Could not check build date, but thats ok.');
+ app('log')->debug('Could not check build date, but thats ok.');
app('log')->warning($e->getMessage());
}
if ('' !== (string)env('BASE_IMAGE_BUILD')) {
@@ -275,7 +275,7 @@ class DebugController extends Controller
$parts = app('steam')->getLocaleArray(app('steam')->getLocale());
foreach ($parts as $code) {
$code = trim($code);
- Log::debug(sprintf('Trying to set %s', $code));
+ app('log')->debug(sprintf('Trying to set %s', $code));
$result = setlocale(LC_ALL, $code);
$localeAttempts[$code] = $result === $code;
}
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index f9ef75ac2b..b4ac5be04d 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -84,12 +84,12 @@ class HomeController extends Controller
$label = $request->get('label');
$isCustomRange = false;
- Log::debug('Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
+ app('log')->debug('Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
// check if the label is "everything" or "Custom range" which will betray
// a possible problem with the budgets.
if ($label === (string)trans('firefly.everything') || $label === (string)trans('firefly.customRange')) {
$isCustomRange = true;
- Log::debug('Range is now marked as "custom".');
+ app('log')->debug('Range is now marked as "custom".');
}
$diff = $start->diffInDays($end) + 1;
@@ -99,11 +99,11 @@ class HomeController extends Controller
}
$request->session()->put('is_custom_range', $isCustomRange);
- Log::debug(sprintf('Set is_custom_range to %s', var_export($isCustomRange, true)));
+ app('log')->debug(sprintf('Set is_custom_range to %s', var_export($isCustomRange, true)));
$request->session()->put('start', $start);
- Log::debug(sprintf('Set start to %s', $start->format('Y-m-d H:i:s')));
+ app('log')->debug(sprintf('Set start to %s', $start->format('Y-m-d H:i:s')));
$request->session()->put('end', $end);
- Log::debug(sprintf('Set end to %s', $end->format('Y-m-d H:i:s')));
+ app('log')->debug(sprintf('Set end to %s', $end->format('Y-m-d H:i:s')));
return response()->json(['ok' => 'ok']);
}
@@ -138,7 +138,7 @@ class HomeController extends Controller
// sort frontpage accounts by order
$accounts = $accounts->sortBy('order');
- Log::debug('Frontpage accounts are ', $frontPage->data);
+ app('log')->debug('Frontpage accounts are ', $frontPage->data);
/** @var BillRepositoryInterface $billRepository */
$billRepository = app(BillRepositoryInterface::class);
diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php
index 48fc94f130..7812d57932 100644
--- a/app/Http/Controllers/Json/BoxController.php
+++ b/app/Http/Controllers/Json/BoxController.php
@@ -253,7 +253,7 @@ class BoxController extends Controller
$allAccounts = $accountRepository->getActiveAccountsByType(
[AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]
);
- Log::debug(sprintf('Found %d accounts.', $allAccounts->count()));
+ app('log')->debug(sprintf('Found %d accounts.', $allAccounts->count()));
// filter list on preference of being included.
$filtered = $allAccounts->filter(
@@ -261,7 +261,7 @@ class BoxController extends Controller
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
if (false === $result) {
- Log::debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
+ app('log')->debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
}
return $result;
diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.php
index 7b98747d9c..fbf00b9b20 100644
--- a/app/Http/Controllers/Json/IntroController.php
+++ b/app/Http/Controllers/Json/IntroController.php
@@ -46,12 +46,12 @@ class IntroController extends Controller
*/
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
{
- Log::debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
+ app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
$specificPage = $specificPage ?? '';
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (0 === count($specificSteps)) {
- Log::debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
+ app('log')->debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
return response()->json($steps);
}
@@ -81,7 +81,7 @@ class IntroController extends Controller
public function hasOutroStep(string $route): bool
{
$routeKey = str_replace('.', '_', $route);
- Log::debug(sprintf('Has outro step for route %s', $routeKey));
+ app('log')->debug(sprintf('Has outro step for route %s', $routeKey));
$elements = config(sprintf('intro.%s', $routeKey));
if (!is_array($elements)) {
return false;
@@ -89,9 +89,9 @@ class IntroController extends Controller
$hasStep = array_key_exists('outro', $elements);
- Log::debug('Elements is array', $elements);
- Log::debug('Keys is', array_keys($elements));
- Log::debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
+ app('log')->debug('Elements is array', $elements);
+ app('log')->debug('Keys is', array_keys($elements));
+ app('log')->debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
return $hasStep;
}
@@ -113,7 +113,7 @@ class IntroController extends Controller
if ('' !== $specialPage) {
$key .= '_' . $specialPage;
}
- Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
+ app('log')->debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('preferences')->set($key, false);
app('preferences')->mark();
@@ -136,7 +136,7 @@ class IntroController extends Controller
if ('' !== $specialPage) {
$key .= '_' . $specialPage;
}
- Log::debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
+ app('log')->debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('preferences')->set($key, true);
return response()->json(['result' => sprintf('Reported demo watched for route "%s" (%s): %s.', $route, $specialPage, $key)]);
diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php
index ac89ca131d..cac3f5e742 100644
--- a/app/Http/Controllers/Json/ReconcileController.php
+++ b/app/Http/Controllers/Json/ReconcileController.php
@@ -116,13 +116,13 @@ class ReconcileController extends Controller
$clearedJournals = $collector->getExtractedJournals();
}
- Log::debug('Start transaction loop');
+ app('log')->debug('Start transaction loop');
/** @var array $journal */
foreach ($journals as $journal) {
$amount = $this->processJournal($account, $accountCurrency, $journal, $amount);
}
- Log::debug(sprintf('Final amount is %s', $amount));
- Log::debug('End transaction loop');
+ app('log')->debug(sprintf('Final amount is %s', $amount));
+ app('log')->debug('End transaction loop');
/** @var array $journal */
foreach ($clearedJournals as $journal) {
@@ -156,7 +156,7 @@ class ReconcileController extends Controller
)
)->render();
} catch (Throwable $e) {
- Log::debug(sprintf('View error: %s', $e->getMessage()));
+ app('log')->debug(sprintf('View error: %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
$view = sprintf('Could not render accounts.reconcile.overview: %s', $e->getMessage());
throw new FireflyException($view, 0, $e);
@@ -181,7 +181,7 @@ class ReconcileController extends Controller
private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
{
$toAdd = '0';
- Log::debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
+ app('log')->debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
// not much magic below we need to cover using tests.
@@ -203,9 +203,9 @@ class ReconcileController extends Controller
}
- Log::debug(sprintf('Going to add %s to %s', $toAdd, $amount));
+ app('log')->debug(sprintf('Going to add %s to %s', $toAdd, $amount));
$amount = bcadd($amount, $toAdd);
- Log::debug(sprintf('Result is %s', $amount));
+ app('log')->debug(sprintf('Result is %s', $amount));
return $amount;
}
@@ -258,7 +258,7 @@ class ReconcileController extends Controller
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
)->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render: %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
$html = sprintf('Could not render accounts.reconcile.transactions: %s', $e->getMessage());
throw new FireflyException($html, 0, $e);
diff --git a/app/Http/Controllers/Json/RecurrenceController.php b/app/Http/Controllers/Json/RecurrenceController.php
index f7dbd0678d..e28d569d91 100644
--- a/app/Http/Controllers/Json/RecurrenceController.php
+++ b/app/Http/Controllers/Json/RecurrenceController.php
@@ -156,12 +156,12 @@ class RecurrenceController extends Controller
$preSelected = (string)$request->get('pre_select');
$locale = app('steam')->getLocale();
- Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
- Log::debug(sprintf('past = true? %s', var_export('true' === (string)$request->get('past'), true)));
+ app('log')->debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
+ app('log')->debug(sprintf('past = true? %s', var_export('true' === (string)$request->get('past'), true)));
$result = [];
if ($date > $today || 'true' === (string)$request->get('past')) {
- Log::debug('Will fill dropdown.');
+ app('log')->debug('Will fill dropdown.');
$weekly = sprintf('weekly,%s', $date->dayOfWeekIso);
$monthly = sprintf('monthly,%s', $date->day);
$dayOfWeek = (string)trans(sprintf('config.dow_%s', $date->dayOfWeekIso));
@@ -188,7 +188,7 @@ class RecurrenceController extends Controller
],
];
}
- Log::debug('Dropdown is', $result);
+ app('log')->debug('Dropdown is', $result);
return response()->json($result);
}
diff --git a/app/Http/Controllers/ObjectGroup/IndexController.php b/app/Http/Controllers/ObjectGroup/IndexController.php
index 7f48d4240c..cc13bb344d 100644
--- a/app/Http/Controllers/ObjectGroup/IndexController.php
+++ b/app/Http/Controllers/ObjectGroup/IndexController.php
@@ -82,7 +82,7 @@ class IndexController extends Controller
*/
public function setOrder(Request $request, ObjectGroup $objectGroup)
{
- Log::debug(sprintf('Found object group #%d "%s"', $objectGroup->id, $objectGroup->title));
+ app('log')->debug(sprintf('Found object group #%d "%s"', $objectGroup->id, $objectGroup->title));
$newOrder = (int)$request->get('order');
$this->repository->setOrder($objectGroup, $newOrder);
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 91af1bd5ac..faeb5f4963 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -90,7 +90,7 @@ class ProfileController extends Controller
);
$authGuard = config('firefly.authentication_guard');
$this->internalAuth = 'web' === $authGuard;
- Log::debug(sprintf('ProfileController::__construct(). Authentication guard is "%s"', $authGuard));
+ app('log')->debug(sprintf('ProfileController::__construct(). Authentication guard is "%s"', $authGuard));
$this->middleware(IsDemoUser::class)->except(['index']);
}
diff --git a/app/Http/Controllers/Recurring/TriggerController.php b/app/Http/Controllers/Recurring/TriggerController.php
index 094bfbffc9..818a9fca1b 100644
--- a/app/Http/Controllers/Recurring/TriggerController.php
+++ b/app/Http/Controllers/Recurring/TriggerController.php
@@ -62,14 +62,14 @@ class TriggerController extends Controller
$job->setDate($date);
$job->setForce(false);
$job->handle();
- Log::debug('Done with recurrence.');
+ app('log')->debug('Done with recurrence.');
$groups = $job->getGroups();
/** @var TransactionGroup $group */
foreach ($groups as $group) {
/** @var TransactionJournal $journal */
foreach ($group->transactionJournals as $journal) {
- Log::debug(sprintf('Set date of journal #%d to today!', $journal->id));
+ app('log')->debug(sprintf('Set date of journal #%d to today!', $journal->id));
$journal->date = today(config('app.timezone'));
$journal->save();
}
diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php
index 0603f0aebf..667d677674 100644
--- a/app/Http/Controllers/Report/CategoryController.php
+++ b/app/Http/Controllers/Report/CategoryController.php
@@ -729,7 +729,7 @@ class CategoryController extends Controller
try {
$result = view('reports.category.partials.top-expenses', compact('result'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($e->getMessage(), 0, $e);
}
@@ -780,7 +780,7 @@ class CategoryController extends Controller
try {
$result = view('reports.category.partials.top-income', compact('result'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($e->getMessage(), 0, $e);
}
diff --git a/app/Http/Controllers/Report/TagController.php b/app/Http/Controllers/Report/TagController.php
index 8b43ead1db..5d72c5cdde 100644
--- a/app/Http/Controllers/Report/TagController.php
+++ b/app/Http/Controllers/Report/TagController.php
@@ -308,7 +308,7 @@ class TagController extends Controller
try {
$result = view('reports.tag.partials.avg-expenses', compact('result'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
@@ -361,7 +361,7 @@ class TagController extends Controller
try {
$result = view('reports.tag.partials.avg-income', compact('result'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
@@ -520,7 +520,7 @@ class TagController extends Controller
try {
$result = view('reports.tag.partials.top-expenses', compact('result'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
@@ -571,7 +571,7 @@ class TagController extends Controller
try {
$result = view('reports.tag.partials.top-income', compact('result'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index 029dce0424..70abb453e0 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -346,7 +346,7 @@ class ReportController extends Controller
$double = implode(',', $request->getDoubleList()->pluck('id')->toArray());
if (0 === $request->getAccountList()->count()) {
- Log::debug('Account count is zero');
+ app('log')->debug('Account count is zero');
session()->flash('error', (string)trans('firefly.select_at_least_one_account'));
return redirect(route('reports.index'));
diff --git a/app/Http/Controllers/Rule/EditController.php b/app/Http/Controllers/Rule/EditController.php
index 0c8dec18ec..e14a775312 100644
--- a/app/Http/Controllers/Rule/EditController.php
+++ b/app/Http/Controllers/Rule/EditController.php
@@ -173,7 +173,7 @@ class EditController extends Controller
)->render();
} catch (Throwable $e) {
$message = sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage());
- Log::debug($message);
+ app('log')->debug($message);
app('log')->error($e->getTraceAsString());
throw new FireflyException($message, 0, $e);
}
diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php
index 03c87ace86..2a6832cfdc 100644
--- a/app/Http/Controllers/System/InstallController.php
+++ b/app/Http/Controllers/System/InstallController.php
@@ -107,12 +107,12 @@ class InstallController extends Controller
'errorMessage' => null,
];
- Log::debug(sprintf('Will now run commands. Request index is %d', $requestIndex));
+ app('log')->debug(sprintf('Will now run commands. Request index is %d', $requestIndex));
$indexes = array_values(array_keys($this->upgradeCommands));
if (array_key_exists($requestIndex, $indexes)) {
$command = $indexes[$requestIndex];
$parameters = $this->upgradeCommands[$command];
- Log::debug(sprintf('Will now execute command "%s" with parameters', $command), $parameters);
+ app('log')->debug(sprintf('Will now execute command "%s" with parameters', $command), $parameters);
try {
$result = $this->executeCommand($command, $parameters);
} catch (FireflyException $e) {
@@ -144,14 +144,14 @@ class InstallController extends Controller
*/
private function executeCommand(string $command, array $args): bool
{
- Log::debug(sprintf('Will now call command %s with args.', $command), $args);
+ app('log')->debug(sprintf('Will now call command %s with args.', $command), $args);
try {
if ('generate-keys' === $command) {
$this->keys();
}
if ('generate-keys' !== $command) {
Artisan::call($command, $args);
- Log::debug(Artisan::output());
+ app('log')->debug(Artisan::output());
}
} catch (Exception $e) { // intentional generic exception
throw new FireflyException($e->getMessage(), 0, $e);
diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php
index 1fd2592349..b5bc31c05c 100644
--- a/app/Http/Controllers/TagController.php
+++ b/app/Http/Controllers/TagController.php
@@ -317,10 +317,10 @@ class TagController extends Controller
public function store(TagFormRequest $request): RedirectResponse
{
$data = $request->collectTagData();
- Log::debug('Data from request', $data);
+ app('log')->debug('Data from request', $data);
$result = $this->repository->store($data);
- Log::debug('Data after storage', $result->toArray());
+ app('log')->debug('Data after storage', $result->toArray());
session()->flash('success', (string)trans('firefly.created_tag', ['tag' => $data['tag']]));
app('preferences')->mark();
diff --git a/app/Http/Controllers/Transaction/BulkController.php b/app/Http/Controllers/Transaction/BulkController.php
index 28f4831ea4..7a967b31d9 100644
--- a/app/Http/Controllers/Transaction/BulkController.php
+++ b/app/Http/Controllers/Transaction/BulkController.php
@@ -146,7 +146,7 @@ class BulkController extends Controller
if (true === $ignoreUpdate) {
return false;
}
- Log::debug(sprintf('Set budget to %d', $budgetId));
+ app('log')->debug(sprintf('Set budget to %d', $budgetId));
$this->repository->updateBudget($journal, $budgetId);
return true;
@@ -162,7 +162,7 @@ class BulkController extends Controller
private function updateJournalTags(TransactionJournal $journal, string $action, array $tags): bool
{
if ('do_replace' === $action) {
- Log::debug(sprintf('Set tags to %s', implode(',', $tags)));
+ app('log')->debug(sprintf('Set tags to %s', implode(',', $tags)));
$this->repository->updateTags($journal, $tags);
}
if ('do_append' === $action) {
@@ -186,7 +186,7 @@ class BulkController extends Controller
if (true === $ignoreUpdate) {
return false;
}
- Log::debug(sprintf('Set budget to %s', $category));
+ app('log')->debug(sprintf('Set budget to %s', $category));
$this->repository->updateCategory($journal, $category);
return true;
diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.php
index ac5b9e6cab..4e47067d6b 100644
--- a/app/Http/Controllers/Transaction/ConvertController.php
+++ b/app/Http/Controllers/Transaction/ConvertController.php
@@ -119,7 +119,7 @@ class ConvertController extends Controller
];
if ($sourceType->type === $destinationType->type) { // cannot convert to its own type.
- Log::debug('This is already a transaction of the expected type..');
+ app('log')->debug('This is already a transaction of the expected type..');
session()->flash('info', (string)trans('firefly.convert_is_already_type_' . $destinationType->type));
return redirect(route('transactions.show', [$group->id]));
diff --git a/app/Http/Controllers/Transaction/DeleteController.php b/app/Http/Controllers/Transaction/DeleteController.php
index 8e2acc65bb..3988e467ef 100644
--- a/app/Http/Controllers/Transaction/DeleteController.php
+++ b/app/Http/Controllers/Transaction/DeleteController.php
@@ -79,7 +79,7 @@ class DeleteController extends Controller
return $this->redirectGroupToAccount($group);
}
- Log::debug(sprintf('Start of delete view for group #%d', $group->id));
+ app('log')->debug(sprintf('Start of delete view for group #%d', $group->id));
$journal = $group->transactionJournals->first();
if (null === $journal) {
@@ -89,7 +89,7 @@ class DeleteController extends Controller
$subTitle = (string)trans('firefly.delete_' . $objectType, ['description' => $group->title ?? $journal->description]);
$previous = app('steam')->getSafePreviousUrl();
// put previous url in session
- Log::debug('Will try to remember previous URL');
+ app('log')->debug('Will try to remember previous URL');
$this->rememberPreviousUrl('transactions.delete.url');
return view('transactions.delete', compact('group', 'journal', 'subTitle', 'objectType', 'previous'));
@@ -104,7 +104,7 @@ class DeleteController extends Controller
*/
public function destroy(TransactionGroup $group): RedirectResponse
{
- Log::debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
+ app('log')->debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
if (!$this->isEditableGroup($group)) {
return $this->redirectGroupToAccount($group);
}
@@ -134,7 +134,7 @@ class DeleteController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
- Log::debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
+ app('log')->debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
event(new UpdatedAccount($account));
}
app('preferences')->mark();
diff --git a/app/Http/Controllers/Transaction/LinkController.php b/app/Http/Controllers/Transaction/LinkController.php
index f111b4460d..952a0f43f6 100644
--- a/app/Http/Controllers/Transaction/LinkController.php
+++ b/app/Http/Controllers/Transaction/LinkController.php
@@ -123,7 +123,7 @@ class LinkController extends Controller
{
$linkInfo = $request->getLinkInfo();
- Log::debug('We are here (store)');
+ app('log')->debug('We are here (store)');
$other = $this->journalRepository->find($linkInfo['transaction_journal_id']);
if (null === $other) {
session()->flash('error', (string)trans('firefly.invalid_link_selection'));
@@ -144,7 +144,7 @@ class LinkController extends Controller
return redirect(route('transactions.show', [$journal->transaction_group_id]));
}
- Log::debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));
+ app('log')->debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));
$this->repository->storeLink($linkInfo, $other, $journal);
session()->flash('success', (string)trans('firefly.journals_linked'));
diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php
index c1837268a2..6bb4de2a9c 100644
--- a/app/Http/Controllers/Transaction/MassController.php
+++ b/app/Http/Controllers/Transaction/MassController.php
@@ -98,23 +98,23 @@ class MassController extends Controller
*/
public function destroy(MassDeleteJournalRequest $request)
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$ids = $request->get('confirm_mass_delete');
$count = 0;
if (is_array($ids)) {
- Log::debug('Array of IDs', $ids);
+ app('log')->debug('Array of IDs', $ids);
/** @var string $journalId */
foreach ($ids as $journalId) {
- Log::debug(sprintf('Searching for ID #%d', $journalId));
+ app('log')->debug(sprintf('Searching for ID #%d', $journalId));
/** @var TransactionJournal $journal */
$journal = $this->repository->find((int)$journalId);
if (null !== $journal && (int)$journalId === (int)$journal->id) {
$this->repository->destroyJournal($journal);
++$count;
- Log::debug(sprintf('Deleted transaction journal #%d', $journalId));
+ app('log')->debug(sprintf('Deleted transaction journal #%d', $journalId));
continue;
}
- Log::debug(sprintf('Could not find transaction journal #%d', $journalId));
+ app('log')->debug(sprintf('Could not find transaction journal #%d', $journalId));
}
}
app('preferences')->mark();
@@ -224,7 +224,7 @@ class MassController extends Controller
'amount' => $this->getStringFromRequest($request, $journal->id, 'amount'),
'foreign_amount' => $this->getStringFromRequest($request, $journal->id, 'foreign_amount'),
];
- Log::debug(sprintf('Will update journal #%d with data.', $journal->id), $data);
+ app('log')->debug(sprintf('Will update journal #%d with data.', $journal->id), $data);
// call service to update.
$service->setData($data);
diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php
index b0e3e4f743..db91d17b7d 100644
--- a/app/Http/Middleware/Authenticate.php
+++ b/app/Http/Middleware/Authenticate.php
@@ -131,7 +131,7 @@ class Authenticate
app('log')->warning('User is null, throw exception?');
}
if (null !== $user) {
- // Log::debug(get_class($user));
+ // app('log')->debug(get_class($user));
if (1 === (int)$user->blocked) {
$message = (string)trans('firefly.block_account_logout');
if ('email_changed' === $user->blocked_code) {
diff --git a/app/Http/Middleware/Installer.php b/app/Http/Middleware/Installer.php
index 9979ca63d7..eb8efad627 100644
--- a/app/Http/Middleware/Installer.php
+++ b/app/Http/Middleware/Installer.php
@@ -52,7 +52,7 @@ class Installer
*/
public function handle($request, Closure $next)
{
- //Log::debug(sprintf('Installer middleware for URL %s', $request->url()));
+ //app('log')->debug(sprintf('Installer middleware for URL %s', $request->url()));
// ignore installer in test environment.
if ('testing' === config('app.env')) {
return $next($request);
@@ -61,7 +61,7 @@ class Installer
$url = $request->url();
$strpos = stripos($url, '/install');
if (false !== $strpos) {
- //Log::debug(sprintf('URL is %s, will NOT run installer middleware', $url));
+ //app('log')->debug(sprintf('URL is %s, will NOT run installer middleware', $url));
return $next($request);
}
@@ -86,7 +86,7 @@ class Installer
*/
private function hasNoTables(): bool
{
- //Log::debug('Now in routine hasNoTables()');
+ //app('log')->debug('Now in routine hasNoTables()');
try {
DB::table('users')->count();
@@ -109,7 +109,7 @@ class Installer
throw new FireflyException(sprintf('Could not access the database: %s', $message), 0, $e);
}
- //Log::debug('Everything seems OK with the tables.');
+ //app('log')->debug('Everything seems OK with the tables.');
return false;
}
diff --git a/app/Http/Requests/ReconciliationStoreRequest.php b/app/Http/Requests/ReconciliationStoreRequest.php
index c9a1613f20..6587aa471f 100644
--- a/app/Http/Requests/ReconciliationStoreRequest.php
+++ b/app/Http/Requests/ReconciliationStoreRequest.php
@@ -57,7 +57,7 @@ class ReconciliationStoreRequest extends FormRequest
'journals' => $transactions,
'reconcile' => $this->convertString('reconcile'),
];
- Log::debug('In ReconciliationStoreRequest::getAll(). Will now return data.');
+ app('log')->debug('In ReconciliationStoreRequest::getAll(). Will now return data.');
return $data;
}
diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.php
index dce42861b4..ca739e7ce3 100644
--- a/app/Http/Requests/RecurrenceFormRequest.php
+++ b/app/Http/Requests/RecurrenceFormRequest.php
@@ -297,7 +297,7 @@ class RecurrenceFormRequest extends FormRequest
*/
public function validateAccountInformation(Validator $validator): void
{
- Log::debug('Now in validateAccountInformation (RecurrenceFormRequest)()');
+ app('log')->debug('Now in validateAccountInformation (RecurrenceFormRequest)()');
/** @var AccountValidator $accountValidator */
$accountValidator = app(AccountValidator::class);
$data = $validator->getData();
diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php
index d562a4474f..2c04bd8b1d 100644
--- a/app/Http/Requests/ReportFormRequest.php
+++ b/app/Http/Requests/ReportFormRequest.php
@@ -218,14 +218,14 @@ class ReportFormRequest extends FormRequest
$set = $this->get('tag');
$collection = new Collection();
if (is_array($set)) {
- Log::debug('Set is:', $set);
+ app('log')->debug('Set is:', $set);
}
if (!is_array($set)) {
app('log')->error(sprintf('Set is not an array! "%s"', $set));
return $collection;
}
foreach ($set as $tagTag) {
- Log::debug(sprintf('Now searching for "%s"', $tagTag));
+ app('log')->debug(sprintf('Now searching for "%s"', $tagTag));
$tag = $repository->findByTag($tagTag);
if (null !== $tag) {
$collection->push($tag);
diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.php
index 553604b920..7a585c4851 100644
--- a/app/Jobs/CreateAutoBudgetLimits.php
+++ b/app/Jobs/CreateAutoBudgetLimits.php
@@ -62,7 +62,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
$newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
- Log::debug(sprintf('Created new CreateAutoBudgetLimits("%s")', $this->date->format('Y-m-d')));
+ app('log')->debug(sprintf('Created new CreateAutoBudgetLimits("%s")', $this->date->format('Y-m-d')));
}
}
@@ -73,9 +73,9 @@ class CreateAutoBudgetLimits implements ShouldQueue
*/
public function handle(): void
{
- Log::debug(sprintf('Now at start of CreateAutoBudgetLimits() job for %s.', $this->date->format('D d M Y')));
+ app('log')->debug(sprintf('Now at start of CreateAutoBudgetLimits() job for %s.', $this->date->format('D d M Y')));
$autoBudgets = AutoBudget::get();
- Log::debug(sprintf('Found %d auto budgets.', $autoBudgets->count()));
+ app('log')->debug(sprintf('Found %d auto budgets.', $autoBudgets->count()));
foreach ($autoBudgets as $autoBudget) {
$this->handleAutoBudget($autoBudget);
}
@@ -110,7 +110,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
$autoBudget->budget->name
)
);
- Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
return;
}
@@ -136,7 +136,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
// that's easy: create one.
// do nothing else.
$this->createBudgetLimit($autoBudget, $start, $end);
- Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
return;
}
@@ -144,18 +144,18 @@ class CreateAutoBudgetLimits implements ShouldQueue
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ROLLOVER === (int)$autoBudget->auto_budget_type) {
// budget limit exists already,
$this->createRollover($autoBudget);
- Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
return;
}
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ADJUSTED === (int)$autoBudget->auto_budget_type) {
// budget limit exists already,
$this->createAdjustedLimit($autoBudget);
- Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
return;
}
- Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
}
/**
@@ -207,7 +207,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
*/
private function findBudgetLimit(Budget $budget, Carbon $start, Carbon $end): ?BudgetLimit
{
- Log::debug(
+ app('log')->debug(
sprintf(
'Going to find a budget limit for budget #%d ("%s") between %s and %s',
$budget->id,
@@ -230,9 +230,9 @@ class CreateAutoBudgetLimits implements ShouldQueue
*/
private function createBudgetLimit(AutoBudget $autoBudget, Carbon $start, Carbon $end, ?string $amount = null)
{
- Log::debug(sprintf('No budget limit exist. Must create one for auto-budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('No budget limit exist. Must create one for auto-budget #%d', $autoBudget->id));
if (null !== $amount) {
- Log::debug(sprintf('Amount is overruled and will be set to %s', $amount));
+ app('log')->debug(sprintf('Amount is overruled and will be set to %s', $amount));
}
$budgetLimit = new BudgetLimit();
$budgetLimit->budget()->associate($autoBudget->budget);
@@ -244,7 +244,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
$budgetLimit->generated = true;
$budgetLimit->save();
- Log::debug(sprintf('Created budget limit #%d.', $budgetLimit->id));
+ app('log')->debug(sprintf('Created budget limit #%d.', $budgetLimit->id));
}
/**
@@ -254,7 +254,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
*/
private function createRollover(AutoBudget $autoBudget): void
{
- Log::debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
// current period:
$start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
$end = app('navigation')->endOfPeriod($start, $autoBudget->period);
@@ -263,7 +263,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
$previousStart = app('navigation')->subtractPeriod($start, $autoBudget->period);
$previousEnd = app('navigation')->endOfPeriod($previousStart, $autoBudget->period);
- Log::debug(
+ app('log')->debug(
sprintf(
'Current period is %s-%s, so previous period is %s-%s',
$start->format('Y-m-d'),
@@ -277,27 +277,27 @@ class CreateAutoBudgetLimits implements ShouldQueue
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
if (null === $budgetLimit) {
- Log::debug('No budget limit exists in previous period, so create one.');
+ app('log')->debug('No budget limit exists in previous period, so create one.');
// if not, create it and we're done.
$this->createBudgetLimit($autoBudget, $start, $end);
- Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
return;
}
- Log::debug('Budget limit exists for previous period.');
+ app('log')->debug('Budget limit exists for previous period.');
// if has one, calculate expenses and use that as a base.
$repository = app(OperationsRepositoryInterface::class);
$repository->setUser($autoBudget->budget->user);
$spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection([$autoBudget->budget]), $autoBudget->transactionCurrency);
$currencyId = (int)$autoBudget->transaction_currency_id;
$spentAmount = $spent[$currencyId]['sum'] ?? '0';
- Log::debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
+ app('log')->debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
// if you spent more in previous budget period, than whatever you had previous budget period, the amount resets
// previous budget limit + spent
$budgetLeft = bcadd($budgetLimit->amount, $spentAmount);
$totalAmount = $autoBudget->amount;
- Log::debug(sprintf('Total amount left for previous budget period is %s', $budgetLeft));
+ app('log')->debug(sprintf('Total amount left for previous budget period is %s', $budgetLeft));
if (-1 !== bccomp('0', $budgetLeft)) {
app('log')->info(sprintf('The amount left is negative, so it will be reset to %s.', $totalAmount));
@@ -309,7 +309,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
// create budget limit:
$this->createBudgetLimit($autoBudget, $start, $end, $totalAmount);
- Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
}
/**
@@ -319,7 +319,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
*/
private function createAdjustedLimit(AutoBudget $autoBudget): void
{
- Log::debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
// current period:
$start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
$end = app('navigation')->endOfPeriod($start, $autoBudget->period);
@@ -328,7 +328,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
$previousStart = app('navigation')->subtractPeriod($start, $autoBudget->period);
$previousEnd = app('navigation')->endOfPeriod($previousStart, $autoBudget->period);
- Log::debug(
+ app('log')->debug(
sprintf(
'Current period is %s-%s, so previous period is %s-%s',
$start->format('Y-m-d'),
@@ -342,12 +342,12 @@ class CreateAutoBudgetLimits implements ShouldQueue
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
if (null === $budgetLimit) {
- Log::debug('No budget limit exists in previous period, so create one.');
+ app('log')->debug('No budget limit exists in previous period, so create one.');
// if not, create standard amount, and we're done.
$this->createBudgetLimit($autoBudget, $start, $end);
return;
}
- Log::debug('Budget limit exists for previous period.');
+ app('log')->debug('Budget limit exists for previous period.');
// if has one, calculate expenses and use that as a base.
$repository = app(OperationsRepositoryInterface::class);
@@ -355,14 +355,14 @@ class CreateAutoBudgetLimits implements ShouldQueue
$spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection([$autoBudget->budget]), $autoBudget->transactionCurrency);
$currencyId = (int)$autoBudget->transaction_currency_id;
$spentAmount = $spent[$currencyId]['sum'] ?? '0';
- Log::debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
+ app('log')->debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
// what you spent in previous period PLUS the amount for the current period,
// if that is more than zero, that's the amount that will be set.
$budgetAvailable = bcadd(bcadd($budgetLimit->amount, $autoBudget->amount), $spentAmount);
$totalAmount = $autoBudget->amount;
- Log::debug(sprintf('Total amount available for current budget period is %s', $budgetAvailable));
+ app('log')->debug(sprintf('Total amount available for current budget period is %s', $budgetAvailable));
if (-1 !== bccomp($budgetAvailable, $totalAmount)) {
@@ -380,7 +380,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
// create budget limit:
$this->createBudgetLimit($autoBudget, $start, $end, '1');
}
- Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
+ app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
}
/**
diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.php
index d5791e956e..c20f2da023 100644
--- a/app/Jobs/CreateRecurringTransactions.php
+++ b/app/Jobs/CreateRecurringTransactions.php
@@ -93,7 +93,7 @@ class CreateRecurringTransactions implements ShouldQueue
$this->recurrences = new Collection();
$this->groups = new Collection();
- Log::debug(sprintf('Created new CreateRecurringTransactions("%s")', $this->date->format('Y-m-d')));
+ app('log')->debug(sprintf('Created new CreateRecurringTransactions("%s")', $this->date->format('Y-m-d')));
}
/**
@@ -109,25 +109,25 @@ class CreateRecurringTransactions implements ShouldQueue
*/
public function handle(): void
{
- Log::debug(sprintf('Now at start of CreateRecurringTransactions() job for %s.', $this->date->format('D d M Y')));
+ app('log')->debug(sprintf('Now at start of CreateRecurringTransactions() job for %s.', $this->date->format('D d M Y')));
// only use recurrences from database if there is no collection submitted.
if (0 !== count($this->recurrences)) {
- Log::debug('Using predetermined set of recurrences.');
+ app('log')->debug('Using predetermined set of recurrences.');
}
if (0 === count($this->recurrences)) {
- Log::debug('Grab all recurrences from the database.');
+ app('log')->debug('Grab all recurrences from the database.');
$this->recurrences = $this->repository->getAll();
}
$result = [];
$count = $this->recurrences->count();
$this->submitted = $count;
- Log::debug(sprintf('Count of collection is %d', $count));
+ app('log')->debug(sprintf('Count of collection is %d', $count));
// filter recurrences:
$filtered = $this->filterRecurrences($this->recurrences);
- Log::debug(sprintf('Left after filtering is %d', $filtered->count()));
+ app('log')->debug(sprintf('Left after filtering is %d', $filtered->count()));
/** @var Recurrence $recurrence */
foreach ($filtered as $recurrence) {
if (!array_key_exists($recurrence->user_id, $result)) {
@@ -140,20 +140,20 @@ class CreateRecurringTransactions implements ShouldQueue
// clear cache for user
app('preferences')->setForUser($recurrence->user, 'lastActivity', microtime());
- Log::debug(sprintf('Now at recurrence #%d of user #%d', $recurrence->id, $recurrence->user_id));
+ app('log')->debug(sprintf('Now at recurrence #%d of user #%d', $recurrence->id, $recurrence->user_id));
$createdReps = $this->handleRepetitions($recurrence);
- Log::debug(sprintf('Done with recurrence #%d', $recurrence->id));
+ app('log')->debug(sprintf('Done with recurrence #%d', $recurrence->id));
$result[$recurrence->user_id] = $result[$recurrence->user_id]->merge($createdReps);
$this->executed++;
}
- Log::debug('Now running report thing.');
+ app('log')->debug('Now running report thing.');
// will now send email to users.
foreach ($result as $userId => $journals) {
event(new RequestedReportOnJournals($userId, $journals));
}
- Log::debug('Done with handle()');
+ app('log')->debug('Done with handle()');
// clear cache:
app('preferences')->mark();
@@ -183,7 +183,7 @@ class CreateRecurringTransactions implements ShouldQueue
*/
private function validRecurrence(Recurrence $recurrence): bool
{
- Log::debug(sprintf('Now filtering recurrence #%d, owned by user #%d', $recurrence->id, $recurrence->user_id));
+ app('log')->debug(sprintf('Now filtering recurrence #%d, owned by user #%d', $recurrence->id, $recurrence->user_id));
// is not active.
if (!$this->active($recurrence)) {
app('log')->info(sprintf('Recurrence #%d is not active. Skipped.', $recurrence->id));
@@ -233,7 +233,7 @@ class CreateRecurringTransactions implements ShouldQueue
return false;
}
- Log::debug('Will be included.');
+ app('log')->debug('Will be included.');
return true;
}
@@ -273,7 +273,7 @@ class CreateRecurringTransactions implements ShouldQueue
private function hasNotStartedYet(Recurrence $recurrence): bool
{
$startDate = $this->getStartDate($recurrence);
- Log::debug(sprintf('Start date is %s', $startDate->format('Y-m-d')));
+ app('log')->debug(sprintf('Start date is %s', $startDate->format('Y-m-d')));
return $startDate->gt($this->date);
}
@@ -322,7 +322,7 @@ class CreateRecurringTransactions implements ShouldQueue
$collection = new Collection();
/** @var RecurrenceRepetition $repetition */
foreach ($recurrence->recurrenceRepetitions as $repetition) {
- Log::debug(
+ app('log')->debug(
sprintf(
'Now repeating %s with value "%s", skips every %d time(s)',
$repetition->repetition_type,
@@ -386,7 +386,7 @@ class CreateRecurringTransactions implements ShouldQueue
if ($date->ne($this->date)) {
return null;
}
- Log::debug(sprintf('%s IS today (%s)', $date->format('Y-m-d'), $this->date->format('Y-m-d')));
+ app('log')->debug(sprintf('%s IS today (%s)', $date->format('Y-m-d'), $this->date->format('Y-m-d')));
// count created journals on THIS day.
$journalCount = $this->repository->getJournalCount($recurrence, $date, $date);
diff --git a/app/Jobs/DownloadExchangeRates.php b/app/Jobs/DownloadExchangeRates.php
index 552c310778..1ac7e2acec 100644
--- a/app/Jobs/DownloadExchangeRates.php
+++ b/app/Jobs/DownloadExchangeRates.php
@@ -74,7 +74,7 @@ class DownloadExchangeRates implements ShouldQueue
$newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
- Log::debug(sprintf('Created new DownloadExchangeRates("%s")', $this->date->format('Y-m-d')));
+ app('log')->debug(sprintf('Created new DownloadExchangeRates("%s")', $this->date->format('Y-m-d')));
}
}
@@ -83,7 +83,7 @@ class DownloadExchangeRates implements ShouldQueue
*/
public function handle(): void
{
- Log::debug('Now in handle()');
+ app('log')->debug('Now in handle()');
$currencies = $this->repository->getCompleteSet();
/** @var TransactionCurrency $currency */
@@ -100,7 +100,7 @@ class DownloadExchangeRates implements ShouldQueue
*/
private function downloadRates(TransactionCurrency $currency): void
{
- Log::debug(sprintf('Now downloading new exchange rates for currency %s.', $currency->code));
+ app('log')->debug(sprintf('Now downloading new exchange rates for currency %s.', $currency->code));
$base = sprintf('%s/%s/%s', (string)config('cer.url'), $this->date->year, $this->date->isoWeek);
$client = new Client();
$url = sprintf('%s/%s.json', $base, $currency->code);
@@ -137,10 +137,10 @@ class DownloadExchangeRates implements ShouldQueue
foreach ($rates as $code => $rate) {
$to = $this->getCurrency($code);
if (null === $to) {
- Log::debug(sprintf('Currency %s is not in use, do not save rate.', $code));
+ app('log')->debug(sprintf('Currency %s is not in use, do not save rate.', $code));
continue;
}
- Log::debug(sprintf('Currency %s is in use.', $code));
+ app('log')->debug(sprintf('Currency %s is in use.', $code));
$this->saveRate($currency, $to, $date, $rate);
}
}
@@ -154,22 +154,22 @@ class DownloadExchangeRates implements ShouldQueue
{
// if we have it already, don't bother searching for it again.
if (array_key_exists($code, $this->active)) {
- Log::debug(sprintf('Already know what the result is of searching for %s', $code));
+ app('log')->debug(sprintf('Already know what the result is of searching for %s', $code));
return $this->active[$code];
}
// find it in the database.
$currency = $this->repository->findByCode($code);
if (null === $currency) {
- Log::debug(sprintf('Did not find currency %s.', $code));
+ app('log')->debug(sprintf('Did not find currency %s.', $code));
$this->active[$code] = null;
return null;
}
if (false === $currency->enabled) {
- Log::debug(sprintf('Currency %s is not enabled.', $code));
+ app('log')->debug(sprintf('Currency %s is not enabled.', $code));
$this->active[$code] = null;
return null;
}
- Log::debug(sprintf('Currency %s is enabled.', $code));
+ app('log')->debug(sprintf('Currency %s is enabled.', $code));
$this->active[$code] = $currency;
return $currency;
@@ -189,7 +189,7 @@ class DownloadExchangeRates implements ShouldQueue
$this->repository->setUser($user);
$existing = $this->repository->getExchangeRate($from, $to, $date);
if (null === $existing) {
- Log::debug(sprintf('Saved rate from %s to %s for user #%d.', $from->code, $to->code, $user->id));
+ app('log')->debug(sprintf('Saved rate from %s to %s for user #%d.', $from->code, $to->code, $user->id));
$this->repository->setExchangeRate($from, $to, $date, $rate);
}
}
diff --git a/app/Jobs/SendWebhookMessage.php b/app/Jobs/SendWebhookMessage.php
index 42dfdf5d46..c4cfebc4a9 100644
--- a/app/Jobs/SendWebhookMessage.php
+++ b/app/Jobs/SendWebhookMessage.php
@@ -62,7 +62,7 @@ class SendWebhookMessage implements ShouldQueue
*/
public function handle(): void
{
- Log::debug(sprintf('Now handling webhook message #%d', $this->message->id));
+ app('log')->debug(sprintf('Now handling webhook message #%d', $this->message->id));
// send job!
$sender = app(WebhookSenderInterface::class);
$sender->setMessage($this->message);
diff --git a/app/Jobs/WarnAboutBills.php b/app/Jobs/WarnAboutBills.php
index 7438d9f760..620e783a17 100644
--- a/app/Jobs/WarnAboutBills.php
+++ b/app/Jobs/WarnAboutBills.php
@@ -67,7 +67,7 @@ class WarnAboutBills implements ShouldQueue
$this->force = false;
- Log::debug(sprintf('Created new WarnAboutBills("%s")', $this->date->format('Y-m-d')));
+ app('log')->debug(sprintf('Created new WarnAboutBills("%s")', $this->date->format('Y-m-d')));
}
/**
@@ -75,11 +75,11 @@ class WarnAboutBills implements ShouldQueue
*/
public function handle(): void
{
- Log::debug(sprintf('Now at start of WarnAboutBills() job for %s.', $this->date->format('D d M Y')));
+ app('log')->debug(sprintf('Now at start of WarnAboutBills() job for %s.', $this->date->format('D d M Y')));
$bills = Bill::all();
/** @var Bill $bill */
foreach ($bills as $bill) {
- Log::debug(sprintf('Now checking bill #%d ("%s")', $bill->id, $bill->name));
+ app('log')->debug(sprintf('Now checking bill #%d ("%s")', $bill->id, $bill->name));
if ($this->hasDateFields($bill)) {
if ($this->needsWarning($bill, 'end_date')) {
$this->sendWarning($bill, 'end_date');
@@ -89,7 +89,7 @@ class WarnAboutBills implements ShouldQueue
}
}
}
- Log::debug('Done with handle()');
+ app('log')->debug('Done with handle()');
// clear cache:
app('preferences')->mark();
@@ -103,11 +103,11 @@ class WarnAboutBills implements ShouldQueue
private function hasDateFields(Bill $bill): bool
{
if (false === $bill->active) {
- Log::debug('Bill is not active.');
+ app('log')->debug('Bill is not active.');
return false;
}
if (null === $bill->end_date && null === $bill->extension_date) {
- Log::debug('Bill has no date fields.');
+ app('log')->debug('Bill has no date fields.');
return false;
}
return true;
@@ -126,7 +126,7 @@ class WarnAboutBills implements ShouldQueue
}
$diff = $this->getDiff($bill, $field);
$list = config('firefly.bill_reminder_periods');
- Log::debug(sprintf('Difference in days for field "%s" ("%s") is %d day(s)', $field, $bill->$field->format('Y-m-d'), $diff));
+ app('log')->debug(sprintf('Difference in days for field "%s" ("%s") is %d day(s)', $field, $bill->$field->format('Y-m-d'), $diff));
if (in_array($diff, $list, true)) {
return true;
}
@@ -155,7 +155,7 @@ class WarnAboutBills implements ShouldQueue
private function sendWarning(Bill $bill, string $field): void
{
$diff = $this->getDiff($bill, $field);
- Log::debug('Will now send warning!');
+ app('log')->debug('Will now send warning!');
event(new WarnUserAboutBill($bill, $field, $diff));
}
diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php
index 06a58e9257..ef4e9b50ed 100644
--- a/app/Models/TransactionGroup.php
+++ b/app/Models/TransactionGroup.php
@@ -96,22 +96,22 @@ class TransactionGroup extends Model
*/
public static function routeBinder(string $value): TransactionGroup
{
- Log::debug(sprintf('Now in %s("%s")', __METHOD__, $value));
+ app('log')->debug(sprintf('Now in %s("%s")', __METHOD__, $value));
if (auth()->check()) {
$groupId = (int)$value;
/** @var User $user */
$user = auth()->user();
- Log::debug(sprintf('User authenticated as %s', $user->email));
+ app('log')->debug(sprintf('User authenticated as %s', $user->email));
/** @var TransactionGroup $group */
$group = $user->transactionGroups()
->with(['transactionJournals', 'transactionJournals.transactions'])
->where('transaction_groups.id', $groupId)->first(['transaction_groups.*']);
if (null !== $group) {
- Log::debug(sprintf('Found group #%d.', $group->id));
+ app('log')->debug(sprintf('Found group #%d.', $group->id));
return $group;
}
}
- Log::debug('Found no group.');
+ app('log')->debug('Found no group.');
throw new NotFoundHttpException();
}
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 80bdd00a9e..67335362b6 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -165,17 +165,17 @@ class AccountRepository implements AccountRepositoryInterface
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$query->whereIn('account_types.type', $types);
}
- Log::debug(sprintf('Searching for account named "%s" (of user #%d) of the following type(s)', $name, $this->user->id), ['types' => $types]);
+ app('log')->debug(sprintf('Searching for account named "%s" (of user #%d) of the following type(s)', $name, $this->user->id), ['types' => $types]);
$query->where('accounts.name', $name);
/** @var Account $account */
$account = $query->first(['accounts.*']);
if (null === $account) {
- Log::debug(sprintf('There is no account with name "%s" of types', $name), $types);
+ app('log')->debug(sprintf('There is no account with name "%s" of types', $name), $types);
return null;
}
- Log::debug(sprintf('Found #%d (%s) with type id %d', $account->id, $account->name, $account->account_type_id));
+ app('log')->debug(sprintf('Found #%d (%s) with type id %d', $account->id, $account->name, $account->account_type_id));
return $account;
}
@@ -568,14 +568,14 @@ class AccountRepository implements AccountRepositoryInterface
];
if (array_key_exists(ucfirst($type), $sets)) {
$order = (int)$this->getAccountsByType($sets[ucfirst($type)])->max('order');
- Log::debug(sprintf('Return max order of "%s" set: %d', $type, $order));
+ app('log')->debug(sprintf('Return max order of "%s" set: %d', $type, $order));
return $order;
}
$specials = [AccountType::CASH, AccountType::INITIAL_BALANCE, AccountType::IMPORT, AccountType::RECONCILIATION];
$order = (int)$this->getAccountsByType($specials)->max('order');
- Log::debug(sprintf('Return max order of "%s" set (specials!): %d', $type, $order));
+ app('log')->debug(sprintf('Return max order of "%s" set (specials!): %d', $type, $order));
return $order;
}
@@ -670,7 +670,7 @@ class AccountRepository implements AccountRepositoryInterface
continue;
}
if ($index !== (int)$account->order) {
- Log::debug(sprintf('Account #%d ("%s"): order should %d be but is %d.', $account->id, $account->name, $index, $account->order));
+ app('log')->debug(sprintf('Account #%d ("%s"): order should %d be but is %d.', $account->id, $account->name, $index, $account->order));
$account->order = $index;
$account->save();
}
diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php
index e30e983ef8..037fa4a3b4 100644
--- a/app/Repositories/Account/AccountTasker.php
+++ b/app/Repositories/Account/AccountTasker.php
@@ -57,7 +57,7 @@ class AccountTasker implements AccountTaskerInterface
$yesterday->subDay();
$startSet = app('steam')->balancesByAccounts($accounts, $yesterday);
$endSet = app('steam')->balancesByAccounts($accounts, $end);
- Log::debug('Start of accountreport');
+ app('log')->debug('Start of accountreport');
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
@@ -99,9 +99,9 @@ class AccountTasker implements AccountTaskerInterface
// first journal exists, and is on start, then this is the actual opening balance:
if (null !== $first && $first->date->isSameDay($start) && TransactionType::OPENING_BALANCE === $first->transactionType->type) {
- Log::debug(sprintf('Date of first journal for %s is %s', $account->name, $first->date->format('Y-m-d')));
+ app('log')->debug(sprintf('Date of first journal for %s is %s', $account->name, $first->date->format('Y-m-d')));
$entry['start_balance'] = $first->transactions()->where('account_id', $account->id)->first()->amount;
- Log::debug(sprintf('Account %s was opened on %s, so opening balance is %f', $account->name, $start->format('Y-m-d'), $entry['start_balance']));
+ app('log')->debug(sprintf('Account %s was opened on %s, so opening balance is %f', $account->name, $start->format('Y-m-d'), $entry['start_balance']));
}
$return['sums'][$currency->id]['start'] = bcadd($return['sums'][$currency->id]['start'], $entry['start_balance']);
$return['sums'][$currency->id]['end'] = bcadd($return['sums'][$currency->id]['end'], $entry['end_balance']);
@@ -190,7 +190,7 @@ class AccountTasker implements AccountTaskerInterface
];
$report['accounts'][$key]['sum'] = bcadd($report['accounts'][$key]['sum'], $journal['amount']);
- Log::debug(sprintf('Sum for %s is now %s', $journal['destination_account_name'], $report['accounts'][$key]['sum']));
+ app('log')->debug(sprintf('Sum for %s is now %s', $journal['destination_account_name'], $report['accounts'][$key]['sum']));
++$report['accounts'][$key]['count'];
}
diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php
index 069789a518..ddca6492dc 100644
--- a/app/Repositories/Attachment/AttachmentRepository.php
+++ b/app/Repositories/Attachment/AttachmentRepository.php
@@ -87,7 +87,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
try {
$unencryptedContent = Crypt::decrypt($encryptedContent); // verified
} catch (DecryptException $e) {
- Log::debug(sprintf('Could not decrypt attachment #%d but this is fine: %s', $attachment->id, $e->getMessage()));
+ app('log')->debug(sprintf('Could not decrypt attachment #%d but this is fine: %s', $attachment->id, $e->getMessage()));
$unencryptedContent = $encryptedContent;
}
}
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index cc3f91b14c..c550f0f3fa 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -140,7 +140,7 @@ class BillRepository implements BillRepositoryInterface
if (null !== $billId) {
$searchResult = $this->find((int)$billId);
if (null !== $searchResult) {
- Log::debug(sprintf('Found bill based on #%d, will return it.', $billId));
+ app('log')->debug(sprintf('Found bill based on #%d, will return it.', $billId));
return $searchResult;
}
@@ -148,12 +148,12 @@ class BillRepository implements BillRepositoryInterface
if (null !== $billName) {
$searchResult = $this->findByName((string)$billName);
if (null !== $searchResult) {
- Log::debug(sprintf('Found bill based on "%s", will return it.', $billName));
+ app('log')->debug(sprintf('Found bill based on "%s", will return it.', $billName));
return $searchResult;
}
}
- Log::debug('Found nothing');
+ app('log')->debug('Found nothing');
return null;
}
@@ -373,7 +373,7 @@ class BillRepository implements BillRepositoryInterface
*/
public function getPaidDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
{
- //Log::debug('Now in getPaidDatesInRange()');
+ //app('log')->debug('Now in getPaidDatesInRange()');
return $bill->transactionJournals()
->before($end)->after($start)->get(
@@ -498,7 +498,7 @@ class BillRepository implements BillRepositoryInterface
$journal = $bill->user->transactionJournals()->find((int)$transaction['transaction_journal_id']);
$journal->bill_id = $bill->id;
$journal->save();
- Log::debug(sprintf('Linked journal #%d to bill #%d', $journal->id, $bill->id));
+ app('log')->debug(sprintf('Linked journal #%d to bill #%d', $journal->id, $bill->id));
}
}
@@ -522,12 +522,12 @@ class BillRepository implements BillRepositoryInterface
}
// find the most recent date for this bill NOT in the future. Cache this date:
$start = clone $bill->date;
- Log::debug('nextExpectedMatch: Start is ' . $start->format('Y-m-d'));
+ app('log')->debug('nextExpectedMatch: Start is ' . $start->format('Y-m-d'));
while ($start < $date) {
- Log::debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d'), $date->format('Y-m-d')));
+ app('log')->debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d'), $date->format('Y-m-d')));
$start = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
- Log::debug('Start is now ' . $start->format('Y-m-d'));
+ app('log')->debug('Start is now ' . $start->format('Y-m-d'));
}
$end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
@@ -537,12 +537,12 @@ class BillRepository implements BillRepositoryInterface
if ($journalCount > 0) {
// this period had in fact a bill. The new start is the current end, and we create a new end.
- Log::debug(sprintf('Journal count is %d, so start becomes %s', $journalCount, $end->format('Y-m-d')));
+ app('log')->debug(sprintf('Journal count is %d, so start becomes %s', $journalCount, $end->format('Y-m-d')));
$start = clone $end;
$end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
}
- Log::debug('nextExpectedMatch: Final start is ' . $start->format('Y-m-d'));
- Log::debug('nextExpectedMatch: Matching end is ' . $end->format('Y-m-d'));
+ app('log')->debug('nextExpectedMatch: Final start is ' . $start->format('Y-m-d'));
+ app('log')->debug('nextExpectedMatch: Matching end is ' . $end->format('Y-m-d'));
$cache->store($start);
@@ -708,21 +708,21 @@ class BillRepository implements BillRepositoryInterface
{
$set = new Collection();
$currentStart = clone $start;
- //Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
- //Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));
+ //app('log')->debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
+ //app('log')->debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));
while ($currentStart <= $end) {
- //Log::debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d')));
+ //app('log')->debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d')));
$nextExpectedMatch = $this->nextDateMatch($bill, $currentStart);
- //Log::debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
+ //app('log')->debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
if ($nextExpectedMatch > $end) {// If nextExpectedMatch is after end, we continue
break;
}
$set->push(clone $nextExpectedMatch);
- //Log::debug(sprintf('Now %d dates in set.', $set->count()));
+ //app('log')->debug(sprintf('Now %d dates in set.', $set->count()));
$nextExpectedMatch->addDay();
- //Log::debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
+ //app('log')->debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
$currentStart = clone $nextExpectedMatch;
}
diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php
index 23c41a4c1d..53606faa70 100644
--- a/app/Repositories/Budget/BudgetLimitRepository.php
+++ b/app/Repositories/Budget/BudgetLimitRepository.php
@@ -315,7 +315,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
if (null !== $limit) {
throw new FireflyException('200027: Budget limit already exists.');
}
- Log::debug('No existing budget limit, create a new one');
+ app('log')->debug('No existing budget limit, create a new one');
// or create one and return it.
$limit = new BudgetLimit();
@@ -325,7 +325,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
$limit->amount = $data['amount'];
$limit->transaction_currency_id = $currency->id;
$limit->save();
- Log::debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $data['amount']));
+ app('log')->debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $data['amount']));
return $limit;
}
@@ -399,7 +399,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00'))
->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00'))
->count(['budget_limits.*']);
- Log::debug(sprintf('Found %d budget limits.', $limits));
+ app('log')->debug(sprintf('Found %d budget limits.', $limits));
// there might be a budget limit for these dates:
/** @var BudgetLimit $limit */
@@ -410,7 +410,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
// if more than 1 limit found, delete the others:
if ($limits > 1 && null !== $limit) {
- Log::debug(sprintf('Found more than 1, delete all except #%d', $limit->id));
+ app('log')->debug(sprintf('Found more than 1, delete all except #%d', $limit->id));
$budget->budgetlimits()
->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00'))
->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00'))
@@ -421,20 +421,20 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
// Returns 0 if the two operands are equal,
// 1 if the left_operand is larger than the right_operand, -1 otherwise.
if (null !== $limit && bccomp($amount, '0') <= 0) {
- Log::debug(sprintf('%s is zero, delete budget limit #%d', $amount, $limit->id));
+ app('log')->debug(sprintf('%s is zero, delete budget limit #%d', $amount, $limit->id));
$limit->delete();
return null;
}
// update if exists:
if (null !== $limit) {
- Log::debug(sprintf('Existing budget limit is #%d, update this to amount %s', $limit->id, $amount));
+ app('log')->debug(sprintf('Existing budget limit is #%d, update this to amount %s', $limit->id, $amount));
$limit->amount = $amount;
$limit->save();
return $limit;
}
- Log::debug('No existing budget limit, create a new one');
+ app('log')->debug('No existing budget limit, create a new one');
// or create one and return it.
$limit = new BudgetLimit();
$limit->budget()->associate($budget);
@@ -442,7 +442,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
$limit->end_date = $end->startOfDay();
$limit->amount = $amount;
$limit->save();
- Log::debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $amount));
+ app('log')->debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $amount));
return $limit;
}
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index 59942cc536..5a4b6adf27 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -91,7 +91,7 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function budgetedInPeriod(Carbon $start, Carbon $end): array
{
- Log::debug(sprintf('Now in budgetedInPeriod("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d')));
+ app('log')->debug(sprintf('Now in budgetedInPeriod("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d')));
$return = [];
/** @var BudgetLimitRepository $limitRepository */
$limitRepository = app(BudgetLimitRepository::class);
@@ -99,11 +99,11 @@ class BudgetRepository implements BudgetRepositoryInterface
$budgets = $this->getActiveBudgets();
/** @var Budget $budget */
foreach ($budgets as $budget) {
- Log::debug(sprintf('Budget #%d: "%s"', $budget->id, $budget->name));
+ app('log')->debug(sprintf('Budget #%d: "%s"', $budget->id, $budget->name));
$limits = $limitRepository->getBudgetLimits($budget, $start, $end);
/** @var BudgetLimit $limit */
foreach ($limits as $limit) {
- Log::debug(sprintf('Budget limit #%d', $limit->id));
+ app('log')->debug(sprintf('Budget limit #%d', $limit->id));
$currency = $limit->transactionCurrency;
$return[$currency->id] = $return[$currency->id] ?? [
'id' => (string)$currency->id,
@@ -116,20 +116,20 @@ class BudgetRepository implements BudgetRepositoryInterface
// same period
if ($limit->start_date->isSameDay($start) && $limit->end_date->isSameDay($end)) {
$return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], (string)$limit->amount);
- Log::debug(sprintf('Add full amount [1]: %s', $limit->amount));
+ app('log')->debug(sprintf('Add full amount [1]: %s', $limit->amount));
continue;
}
// limit is inside of date range
if ($start->lte($limit->start_date) && $end->gte($limit->end_date)) {
$return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], (string)$limit->amount);
- Log::debug(sprintf('Add full amount [2]: %s', $limit->amount));
+ app('log')->debug(sprintf('Add full amount [2]: %s', $limit->amount));
continue;
}
$total = $limit->start_date->diffInDays($limit->end_date) + 1; // include the day itself.
$days = $this->daysInOverlap($limit, $start, $end);
$amount = bcmul(bcdiv((string)$limit->amount, (string)$total), (string)$days);
$return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], $amount);
- Log::debug(
+ app('log')->debug(
sprintf(
'Amount per day: %s (%s over %d days). Total amount for %d days: %s',
bcdiv((string)$limit->amount, (string)$total),
@@ -209,17 +209,17 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function budgetedInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array
{
- Log::debug(sprintf('Now in budgetedInPeriod(#%d, "%s", "%s")', $budget->id, $start->format('Y-m-d'), $end->format('Y-m-d')));
+ app('log')->debug(sprintf('Now in budgetedInPeriod(#%d, "%s", "%s")', $budget->id, $start->format('Y-m-d'), $end->format('Y-m-d')));
$return = [];
/** @var BudgetLimitRepository $limitRepository */
$limitRepository = app(BudgetLimitRepository::class);
$limitRepository->setUser($this->user);
- Log::debug(sprintf('Budget #%d: "%s"', $budget->id, $budget->name));
+ app('log')->debug(sprintf('Budget #%d: "%s"', $budget->id, $budget->name));
$limits = $limitRepository->getBudgetLimits($budget, $start, $end);
/** @var BudgetLimit $limit */
foreach ($limits as $limit) {
- Log::debug(sprintf('Budget limit #%d', $limit->id));
+ app('log')->debug(sprintf('Budget limit #%d', $limit->id));
$currency = $limit->transactionCurrency;
$return[$currency->id] = $return[$currency->id] ?? [
'id' => (string)$currency->id,
@@ -232,20 +232,20 @@ class BudgetRepository implements BudgetRepositoryInterface
// same period
if ($limit->start_date->isSameDay($start) && $limit->end_date->isSameDay($end)) {
$return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], (string)$limit->amount);
- Log::debug(sprintf('Add full amount [1]: %s', $limit->amount));
+ app('log')->debug(sprintf('Add full amount [1]: %s', $limit->amount));
continue;
}
// limit is inside of date range
if ($start->lte($limit->start_date) && $end->gte($limit->end_date)) {
$return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], (string)$limit->amount);
- Log::debug(sprintf('Add full amount [2]: %s', $limit->amount));
+ app('log')->debug(sprintf('Add full amount [2]: %s', $limit->amount));
continue;
}
$total = $limit->start_date->diffInDays($limit->end_date) + 1; // include the day itself.
$days = $this->daysInOverlap($limit, $start, $end);
$amount = bcmul(bcdiv((string)$limit->amount, (string)$total), (string)$days);
$return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], $amount);
- Log::debug(
+ app('log')->debug(
sprintf(
'Amount per day: %s (%s over %d days). Total amount for %d days: %s',
bcdiv((string)$limit->amount, (string)$total),
@@ -291,7 +291,7 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function update(Budget $budget, array $data): Budget
{
- Log::debug('Now in update()');
+ app('log')->debug('Now in update()');
$oldName = $budget->name;
if (array_key_exists('name', $data)) {
@@ -342,12 +342,12 @@ class BudgetRepository implements BudgetRepositoryInterface
->whereIn('rule_actions.action_type', $types)
->where('rule_actions.action_value', $oldName)
->get(['rule_actions.*']);
- Log::debug(sprintf('Found %d actions to update.', $actions->count()));
+ app('log')->debug(sprintf('Found %d actions to update.', $actions->count()));
/** @var RuleAction $action */
foreach ($actions as $action) {
$action->action_value = $newName;
$action->save();
- Log::debug(sprintf('Updated action %d: %s', $action->id, $action->action_value));
+ app('log')->debug(sprintf('Updated action %d: %s', $action->id, $action->action_value));
}
}
@@ -363,12 +363,12 @@ class BudgetRepository implements BudgetRepositoryInterface
->whereIn('rule_triggers.trigger_type', $types)
->where('rule_triggers.trigger_value', $oldName)
->get(['rule_triggers.*']);
- Log::debug(sprintf('Found %d triggers to update.', $triggers->count()));
+ app('log')->debug(sprintf('Found %d triggers to update.', $triggers->count()));
/** @var RuleTrigger $trigger */
foreach ($triggers as $trigger) {
$trigger->trigger_value = $newName;
$trigger->save();
- Log::debug(sprintf('Updated trigger %d: %s', $trigger->id, $trigger->trigger_value));
+ app('log')->debug(sprintf('Updated trigger %d: %s', $trigger->id, $trigger->trigger_value));
}
}
@@ -526,17 +526,17 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function findBudget(?int $budgetId, ?string $budgetName): ?Budget
{
- Log::debug('Now in findBudget()');
- Log::debug(sprintf('Searching for budget with ID #%d...', $budgetId));
+ app('log')->debug('Now in findBudget()');
+ app('log')->debug(sprintf('Searching for budget with ID #%d...', $budgetId));
$result = $this->find((int)$budgetId);
if (null === $result && null !== $budgetName && '' !== $budgetName) {
- Log::debug(sprintf('Searching for budget with name %s...', $budgetName));
+ app('log')->debug(sprintf('Searching for budget with name %s...', $budgetName));
$result = $this->findByName((string)$budgetName);
}
if (null !== $result) {
- Log::debug(sprintf('Found budget #%d: %s', $result->id, $result->name));
+ app('log')->debug(sprintf('Found budget #%d: %s', $result->id, $result->name));
}
- Log::debug(sprintf('Found result is null? %s', var_export(null === $result, true)));
+ app('log')->debug(sprintf('Found result is null? %s', var_export(null === $result, true)));
return $result;
}
@@ -665,7 +665,7 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function spentInPeriod(Carbon $start, Carbon $end): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$start->startOfDay();
$end->endOfDay();
@@ -728,7 +728,7 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function spentInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$start->startOfDay();
$end->endOfDay();
diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php
index 3289b9e4f6..c97c99711b 100644
--- a/app/Repositories/Budget/OperationsRepository.php
+++ b/app/Repositories/Budget/OperationsRepository.php
@@ -53,7 +53,7 @@ class OperationsRepository implements OperationsRepositoryInterface
*/
public function budgetedPerDay(Budget $budget): string
{
- Log::debug(sprintf('Now with budget #%d "%s"', $budget->id, $budget->name));
+ app('log')->debug(sprintf('Now with budget #%d "%s"', $budget->id, $budget->name));
$total = '0';
$count = 0;
foreach ($budget->budgetlimits as $limit) {
@@ -63,13 +63,13 @@ class OperationsRepository implements OperationsRepositoryInterface
$perDay = bcdiv($amount, (string)$diff);
$total = bcadd($total, $perDay);
$count++;
- Log::debug(sprintf('Found %d budget limits. Per day is %s, total is %s', $count, $perDay, $total));
+ app('log')->debug(sprintf('Found %d budget limits. Per day is %s, total is %s', $count, $perDay, $total));
}
$avg = $total;
if ($count > 0) {
$avg = bcdiv($total, (string)$count);
}
- Log::debug(sprintf('%s / %d = %s = average.', $total, $count, $avg));
+ app('log')->debug(sprintf('%s / %d = %s = average.', $total, $count, $avg));
return $avg;
}
@@ -299,7 +299,7 @@ class OperationsRepository implements OperationsRepositoryInterface
?Collection $budgets = null,
?TransactionCurrency $currency = null
): array {
- //Log::debug(sprintf('Now in %s', __METHOD__));
+ //app('log')->debug(sprintf('Now in %s', __METHOD__));
$start->startOfDay();
$end->endOfDay();
@@ -341,7 +341,7 @@ class OperationsRepository implements OperationsRepositoryInterface
// same but for foreign currencies:
if (null !== $currency) {
- //Log::debug(sprintf('Currency is "%s".', $currency->name));
+ //app('log')->debug(sprintf('Currency is "%s".', $currency->name));
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])
@@ -351,7 +351,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->setAccounts($accounts);
}
$result = $collector->getExtractedJournals();
- //Log::debug(sprintf('Found %d journals with currency %s.', count($result), $currency->code));
+ //app('log')->debug(sprintf('Found %d journals with currency %s.', count($result), $currency->code));
// do not use array_merge because you want keys to overwrite (otherwise you get double results):
$journals = $result + $journals;
}
diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php
index d922fe3658..2b0bc7f1ca 100644
--- a/app/Repositories/Category/CategoryRepository.php
+++ b/app/Repositories/Category/CategoryRepository.php
@@ -125,11 +125,11 @@ class CategoryRepository implements CategoryRepositoryInterface
*/
public function findCategory(?int $categoryId, ?string $categoryName): ?Category
{
- Log::debug('Now in findCategory()');
- Log::debug(sprintf('Searching for category with ID #%d...', $categoryId));
+ app('log')->debug('Now in findCategory()');
+ app('log')->debug(sprintf('Searching for category with ID #%d...', $categoryId));
$result = $this->find((int)$categoryId);
if (null === $result) {
- Log::debug(sprintf('Searching for category with name %s...', $categoryName));
+ app('log')->debug(sprintf('Searching for category with name %s...', $categoryName));
$result = $this->findByName((string)$categoryName);
if (null === $result && '' !== (string)$categoryName) {
// create it!
@@ -137,9 +137,9 @@ class CategoryRepository implements CategoryRepositoryInterface
}
}
if (null !== $result) {
- Log::debug(sprintf('Found category #%d: %s', $result->id, $result->name));
+ app('log')->debug(sprintf('Found category #%d: %s', $result->id, $result->name));
}
- Log::debug(sprintf('Found category result is null? %s', var_export(null === $result, true)));
+ app('log')->debug(sprintf('Found category result is null? %s', var_export(null === $result, true)));
return $result;
}
diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php
index 4cb267b9f9..5278994bb1 100644
--- a/app/Repositories/Currency/CurrencyRepository.php
+++ b/app/Repositories/Currency/CurrencyRepository.php
@@ -88,7 +88,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
->where('to_currency_id', $toCurrency->id)
->where('date', $date->format('Y-m-d'))->first();
if (null !== $rate) {
- Log::debug(sprintf('Found cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));
+ app('log')->debug(sprintf('Found cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));
return $rate;
}
diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php
index d6c841ff02..840639e809 100644
--- a/app/Repositories/LinkType/LinkTypeRepository.php
+++ b/app/Repositories/LinkType/LinkTypeRepository.php
@@ -114,7 +114,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
*/
public function findLink(TransactionJournal $one, TransactionJournal $two): bool
{
- Log::debug(sprintf('Now in findLink(%d, %d)', $one->id, $two->id));
+ app('log')->debug(sprintf('Now in findLink(%d, %d)', $one->id, $two->id));
$count = TransactionJournalLink::whereDestinationId($one->id)->whereSourceId($two->id)->count();
$opposingCount = TransactionJournalLink::whereDestinationId($two->id)->whereSourceId($one->id)->count();
@@ -263,13 +263,13 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
$link = new TransactionJournalLink();
$link->linkType()->associate($linkType);
if ('inward' === $information['direction']) {
- Log::debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->inward, $inward->id, $outward->id));
+ app('log')->debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->inward, $inward->id, $outward->id));
$link->source()->associate($inward);
$link->destination()->associate($outward);
}
if ('outward' === $information['direction']) {
- Log::debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->outward, $outward->id, $inward->id));
+ app('log')->debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->outward, $outward->id, $inward->id));
$link->source()->associate($outward);
$link->destination()->associate($inward);
}
diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepository.php b/app/Repositories/ObjectGroup/ObjectGroupRepository.php
index a82c9b7f9d..c67b488c12 100644
--- a/app/Repositories/ObjectGroup/ObjectGroupRepository.php
+++ b/app/Repositories/ObjectGroup/ObjectGroupRepository.php
@@ -114,13 +114,13 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
*/
public function resetOrder(): void
{
- Log::debug('Now in resetOrder');
+ app('log')->debug('Now in resetOrder');
$list = $this->get();
$index = 1;
/** @var ObjectGroup $objectGroup */
foreach ($list as $objectGroup) {
if ($index !== (int)$objectGroup->order) {
- Log::debug(
+ app('log')->debug(
sprintf('objectGroup #%d ("%s"): order should %d be but is %d.', $objectGroup->id, $objectGroup->title, $index, $objectGroup->order)
);
$objectGroup->order = $index;
@@ -203,7 +203,7 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
$objectGroup->save();
}
- Log::debug(sprintf('Objectgroup #%d order is now %d', $objectGroup->id, $newOrder));
+ app('log')->debug(sprintf('Objectgroup #%d order is now %d', $objectGroup->id, $newOrder));
return $objectGroup;
}
diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
index 67a06736cf..6fcf6eb67c 100644
--- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
+++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
@@ -53,13 +53,13 @@ trait ModifiesPiggyBanks
*/
public function addAmountToRepetition(PiggyBankRepetition $repetition, string $amount, TransactionJournal $journal): void
{
- Log::debug(sprintf('addAmountToRepetition: %s', $amount));
+ app('log')->debug(sprintf('addAmountToRepetition: %s', $amount));
if (-1 === bccomp($amount, '0')) {
- Log::debug('Remove amount.');
+ app('log')->debug('Remove amount.');
$this->removeAmount($repetition->piggyBank, bcmul($amount, '-1'), $journal);
}
if (1 === bccomp($amount, '0')) {
- Log::debug('Add amount.');
+ app('log')->debug('Add amount.');
$this->addAmount($repetition->piggyBank, $amount, $journal);
}
}
@@ -80,7 +80,7 @@ trait ModifiesPiggyBanks
$repetition->currentamount = bcsub($repetition->currentamount, $amount);
$repetition->save();
- Log::debug('addAmount [a]: Trigger change for negative amount.');
+ app('log')->debug('addAmount [a]: Trigger change for negative amount.');
event(new ChangedAmount($piggyBank, bcmul($amount, '-1'), $journal, null));
return true;
@@ -103,7 +103,7 @@ trait ModifiesPiggyBanks
$repetition->currentamount = bcadd($currentAmount, $amount);
$repetition->save();
- Log::debug('addAmount [b]: Trigger change for positive amount.');
+ app('log')->debug('addAmount [b]: Trigger change for positive amount.');
event(new ChangedAmount($piggyBank, $amount, $journal, null));
return true;
@@ -131,11 +131,11 @@ trait ModifiesPiggyBanks
$compare = bccomp($amount, $maxAmount);
$result = $compare <= 0;
- Log::debug(sprintf('Left on account: %s on %s', $leftOnAccount, $today->format('Y-m-d')));
- Log::debug(sprintf('Saved so far: %s', $savedSoFar));
- Log::debug(sprintf('Left to save: %s', $leftToSave));
- Log::debug(sprintf('Maximum amount: %s', $maxAmount));
- Log::debug(sprintf('Compare <= 0? %d, so %s', $compare, var_export($result, true)));
+ app('log')->debug(sprintf('Left on account: %s on %s', $leftOnAccount, $today->format('Y-m-d')));
+ app('log')->debug(sprintf('Saved so far: %s', $savedSoFar));
+ app('log')->debug(sprintf('Left to save: %s', $leftToSave));
+ app('log')->debug(sprintf('Maximum amount: %s', $maxAmount));
+ app('log')->debug(sprintf('Compare <= 0? %d, so %s', $compare, var_export($result, true)));
return $result;
}
@@ -202,11 +202,11 @@ trait ModifiesPiggyBanks
$repetition->save();
if (-1 === bccomp($difference, '0')) {
- Log::debug('addAmount [c]: Trigger change for negative amount.');
+ app('log')->debug('addAmount [c]: Trigger change for negative amount.');
event(new ChangedAmount($piggyBank, $difference, null, null));
}
if (1 === bccomp($difference, '0')) {
- Log::debug('addAmount [d]: Trigger change for positive amount.');
+ app('log')->debug('addAmount [d]: Trigger change for positive amount.');
event(new ChangedAmount($piggyBank, $difference, null, null));
}
@@ -299,7 +299,7 @@ trait ModifiesPiggyBanks
$current = 1;
foreach ($set as $piggyBank) {
if ((int)$piggyBank->order !== $current) {
- Log::debug(sprintf('Piggy bank #%d ("%s") was at place %d but should be on %d', $piggyBank->id, $piggyBank->name, $piggyBank->order, $current));
+ app('log')->debug(sprintf('Piggy bank #%d ("%s") was at place %d but should be on %d', $piggyBank->id, $piggyBank->name, $piggyBank->order, $current));
$piggyBank->order = $current;
$piggyBank->save();
}
@@ -313,13 +313,13 @@ trait ModifiesPiggyBanks
public function setOrder(PiggyBank $piggyBank, int $newOrder): bool
{
$oldOrder = (int)$piggyBank->order;
- //Log::debug(sprintf('Will move piggy bank #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder));
+ //app('log')->debug(sprintf('Will move piggy bank #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder));
if ($newOrder > $oldOrder) {
$this->user->piggyBanks()->where('piggy_banks.order', '<=', $newOrder)->where('piggy_banks.order', '>', $oldOrder)
->where('piggy_banks.id', '!=', $piggyBank->id)
->decrement('piggy_banks.order');
$piggyBank->order = $newOrder;
- Log::debug(sprintf('[1] Order of piggy #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder));
+ app('log')->debug(sprintf('[1] Order of piggy #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder));
$piggyBank->save();
return true;
@@ -329,7 +329,7 @@ trait ModifiesPiggyBanks
->where('piggy_banks.id', '!=', $piggyBank->id)
->increment('piggy_banks.order');
$piggyBank->order = $newOrder;
- Log::debug(sprintf('[2] Order of piggy #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder));
+ app('log')->debug(sprintf('[2] Order of piggy #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder));
$piggyBank->save();
return true;
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php
index 95288dd956..181bbe7095 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepository.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php
@@ -66,12 +66,12 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*/
public function findPiggyBank(?int $piggyBankId, ?string $piggyBankName): ?PiggyBank
{
- Log::debug('Searching for piggy information.');
+ app('log')->debug('Searching for piggy information.');
if (null !== $piggyBankId) {
$searchResult = $this->find((int)$piggyBankId);
if (null !== $searchResult) {
- Log::debug(sprintf('Found piggy based on #%d, will return it.', $piggyBankId));
+ app('log')->debug(sprintf('Found piggy based on #%d, will return it.', $piggyBankId));
return $searchResult;
}
@@ -79,12 +79,12 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
if (null !== $piggyBankName) {
$searchResult = $this->findByName((string)$piggyBankName);
if (null !== $searchResult) {
- Log::debug(sprintf('Found piggy based on "%s", will return it.', $piggyBankName));
+ app('log')->debug(sprintf('Found piggy based on "%s", will return it.', $piggyBankName));
return $searchResult;
}
}
- Log::debug('Found nothing');
+ app('log')->debug('Found nothing');
return null;
}
@@ -183,7 +183,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*/
public function getExactAmount(PiggyBank $piggyBank, PiggyBankRepetition $repetition, TransactionJournal $journal): string
{
- Log::debug(sprintf('Now in getExactAmount(%d, %d, %d)', $piggyBank->id, $repetition->id, $journal->id));
+ app('log')->debug(sprintf('Now in getExactAmount(%d, %d, %d)', $piggyBank->id, $repetition->id, $journal->id));
$operator = null;
$currency = null;
@@ -198,7 +198,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
$defaultCurrency = app('amount')->getDefaultCurrencyByUser($this->user);
$piggyBankCurrency = $accountRepos->getAccountCurrency($piggyBank->account) ?? $defaultCurrency;
- Log::debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBankCurrency->code));
+ app('log')->debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBankCurrency->code));
/** @var Transaction $source */
$source = $journal->transactions()->with(['account'])->where('amount', '<', 0)->first();
@@ -209,17 +209,17 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
if ($source->account_id === $piggyBank->account_id) {
$operator = 'negative';
$currency = $accountRepos->getAccountCurrency($source->account) ?? $defaultCurrency;
- Log::debug(sprintf('Currency will draw money out of piggy bank. Source currency is %s', $currency->code));
+ app('log')->debug(sprintf('Currency will draw money out of piggy bank. Source currency is %s', $currency->code));
}
// matches destination, which means amount will be added to piggy.
if ($destination->account_id === $piggyBank->account_id) {
$operator = 'positive';
$currency = $accountRepos->getAccountCurrency($destination->account) ?? $defaultCurrency;
- Log::debug(sprintf('Currency will add money to piggy bank. Destination currency is %s', $currency->code));
+ app('log')->debug(sprintf('Currency will add money to piggy bank. Destination currency is %s', $currency->code));
}
if (null === $operator || null === $currency) {
- Log::debug('Currency is NULL and operator is NULL, return "0".');
+ app('log')->debug('Currency is NULL and operator is NULL, return "0".');
return '0';
}
@@ -227,46 +227,46 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
// which amount from the transaction matches?
$amount = null;
if ((int)$source->transaction_currency_id === (int)$currency->id) {
- Log::debug('Use normal amount');
+ app('log')->debug('Use normal amount');
$amount = app('steam')->$operator($source->amount);
}
if ((int)$source->foreign_currency_id === (int)$currency->id) {
- Log::debug('Use foreign amount');
+ app('log')->debug('Use foreign amount');
$amount = app('steam')->$operator($source->foreign_amount);
}
if (null === $amount) {
- Log::debug('No match on currency, so amount remains null, return "0".');
+ app('log')->debug('No match on currency, so amount remains null, return "0".');
return '0';
}
- Log::debug(sprintf('The currency is %s and the amount is %s', $currency->code, $amount));
+ app('log')->debug(sprintf('The currency is %s and the amount is %s', $currency->code, $amount));
$room = bcsub((string)$piggyBank->targetamount, (string)$repetition->currentamount);
$compare = bcmul($repetition->currentamount, '-1');
if (bccomp((string)$piggyBank->targetamount, '0') === 0) {
// amount is zero? then the "room" is positive amount of we wish to add or remove.
$room = app('steam')->positive($amount);
- Log::debug(sprintf('Room is now %s', $room));
+ app('log')->debug(sprintf('Room is now %s', $room));
}
- Log::debug(sprintf('Will add/remove %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
+ app('log')->debug(sprintf('Will add/remove %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
// if the amount is positive, make sure it fits in piggy bank:
if (1 === bccomp($amount, '0') && bccomp($room, $amount) === -1) {
// amount is positive and $room is smaller than $amount
- Log::debug(sprintf('Room in piggy bank for extra money is %f', $room));
- Log::debug(sprintf('There is NO room to add %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
- Log::debug(sprintf('New amount is %f', $room));
+ app('log')->debug(sprintf('Room in piggy bank for extra money is %f', $room));
+ app('log')->debug(sprintf('There is NO room to add %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
+ app('log')->debug(sprintf('New amount is %f', $room));
return $room;
}
// amount is negative and $currentamount is smaller than $amount
if (bccomp($amount, '0') === -1 && 1 === bccomp($compare, $amount)) {
- Log::debug(sprintf('Max amount to remove is %f', $repetition->currentamount));
- Log::debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
- Log::debug(sprintf('New amount is %f', $compare));
+ app('log')->debug(sprintf('Max amount to remove is %f', $repetition->currentamount));
+ app('log')->debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
+ app('log')->debug(sprintf('New amount is %f', $compare));
return $compare;
}
diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php
index 5687387227..94a8156b04 100644
--- a/app/Repositories/Recurring/RecurringRepository.php
+++ b/app/Repositories/Recurring/RecurringRepository.php
@@ -78,14 +78,14 @@ class RecurringRepository implements RecurringRepositoryInterface
foreach ($set as $journalMeta) {
$count = TransactionJournalMeta::where(function (Builder $q2) use ($date) {
$string = (string)$date;
- Log::debug(sprintf('Search for date: %s', json_encode($string)));
+ app('log')->debug(sprintf('Search for date: %s', json_encode($string)));
$q2->where('name', 'recurrence_date');
$q2->where('data', json_encode($string));
})
->where('transaction_journal_id', $journalMeta->transaction_journal_id)
->count();
if ($count > 0) {
- Log::debug(sprintf('Looks like journal #%d was already created', $journalMeta->transaction_journal_id));
+ app('log')->debug(sprintf('Looks like journal #%d was already created', $journalMeta->transaction_journal_id));
return true;
}
}
@@ -437,7 +437,7 @@ class RecurringRepository implements RecurringRepositoryInterface
*/
public function getXOccurrencesSince(RecurrenceRepetition $repetition, Carbon $date, Carbon $afterDate, int $count): array
{
- Log::debug('Now in getXOccurrencesSince()');
+ app('log')->debug('Now in getXOccurrencesSince()');
$skipMod = $repetition->repetition_skip + 1;
$occurrences = [];
if ('daily' === $repetition->repetition_type) {
@@ -496,7 +496,7 @@ class RecurringRepository implements RecurringRepositoryInterface
*/
public function repetitionDescription(RecurrenceRepetition $repetition): string
{
- Log::debug('Now in repetitionDescription()');
+ app('log')->debug('Now in repetitionDescription()');
/** @var Preference $pref */
$pref = app('preferences')->getForUser($this->user, 'language', config('firefly.default_language', 'en_US'));
$language = $pref->data;
@@ -622,8 +622,8 @@ class RecurringRepository implements RecurringRepositoryInterface
$mutator = clone $start;
$mutator->startOfDay();
$skipMod = $repetition->repetition_skip + 1;
- Log::debug(sprintf('Calculating occurrences for rep type "%s"', $repetition->repetition_type));
- Log::debug(sprintf('Mutator is now: %s', $mutator->format('Y-m-d')));
+ app('log')->debug(sprintf('Calculating occurrences for rep type "%s"', $repetition->repetition_type));
+ app('log')->debug(sprintf('Mutator is now: %s', $mutator->format('Y-m-d')));
if ('daily' === $repetition->repetition_type) {
$occurrences = $this->getDailyInRange($mutator, $end, $skipMod);
diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php
index e34c731cc8..902c39f715 100644
--- a/app/Repositories/Rule/RuleRepository.php
+++ b/app/Repositories/Rule/RuleRepository.php
@@ -298,9 +298,9 @@ class RuleRepository implements RuleRepositoryInterface
// reset order:
$this->resetRuleOrder($ruleGroup);
- Log::debug('Done with resetting.');
+ app('log')->debug('Done with resetting.');
if (array_key_exists('order', $data)) {
- Log::debug(sprintf('User has submitted order %d', $data['order']));
+ app('log')->debug(sprintf('User has submitted order %d', $data['order']));
$this->setOrder($rule, $data['order']);
}
@@ -381,7 +381,7 @@ class RuleRepository implements RuleRepositoryInterface
$groupId = (int)$rule->rule_group_id;
$maxOrder = $this->maxOrder($rule->ruleGroup);
$newOrder = $newOrder > $maxOrder ? $maxOrder + 1 : $newOrder;
- Log::debug(sprintf('New order will be %d', $newOrder));
+ app('log')->debug(sprintf('New order will be %d', $newOrder));
if ($newOrder > $oldOrder) {
$this->user->rules()
@@ -391,7 +391,7 @@ class RuleRepository implements RuleRepositoryInterface
->where('rules.id', '!=', $rule->id)
->decrement('rules.order');
$rule->order = $newOrder;
- Log::debug(sprintf('Order of rule #%d ("%s") is now %d', $rule->id, $rule->title, $newOrder));
+ app('log')->debug(sprintf('Order of rule #%d ("%s") is now %d', $rule->id, $rule->title, $newOrder));
$rule->save();
return;
@@ -404,7 +404,7 @@ class RuleRepository implements RuleRepositoryInterface
->where('rules.id', '!=', $rule->id)
->increment('rules.order');
$rule->order = $newOrder;
- Log::debug(sprintf('Order of rule #%d ("%s") is now %d', $rule->id, $rule->title, $newOrder));
+ app('log')->debug(sprintf('Order of rule #%d ("%s") is now %d', $rule->id, $rule->title, $newOrder));
$rule->save();
}
diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php
index d26fe17600..352ae632e4 100644
--- a/app/Repositories/RuleGroup/RuleGroupRepository.php
+++ b/app/Repositories/RuleGroup/RuleGroupRepository.php
@@ -153,7 +153,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
/** @var Rule $entry */
foreach ($set as $entry) {
if ((int)$entry->order !== $count) {
- Log::debug(sprintf('Rule #%d was on spot %d but must be on spot %d', $entry->id, $entry->order, $count));
+ app('log')->debug(sprintf('Rule #%d was on spot %d but must be on spot %d', $entry->id, $entry->order, $count));
$entry->order = $count;
$entry->save();
}
@@ -182,7 +182,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
if ((int)$action->order !== $index) {
$action->order = $index;
$action->save();
- Log::debug(sprintf('Rule action #%d was on spot %d but must be on spot %d', $action->id, $action->order, $index));
+ app('log')->debug(sprintf('Rule action #%d was on spot %d but must be on spot %d', $action->id, $action->order, $index));
}
$index++;
}
@@ -205,7 +205,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
if ($order !== $index) {
$trigger->order = $index;
$trigger->save();
- Log::debug(sprintf('Rule trigger #%d was on spot %d but must be on spot %d', $trigger->id, $order, $index));
+ app('log')->debug(sprintf('Rule trigger #%d was on spot %d but must be on spot %d', $trigger->id, $order, $index));
}
$index++;
}
@@ -319,23 +319,23 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
if (null === $filter) {
return $groups;
}
- Log::debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter));
+ app('log')->debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter));
return $groups->map(
function (RuleGroup $group) use ($filter) {
- Log::debug(sprintf('Now filtering group #%d', $group->id));
+ app('log')->debug(sprintf('Now filtering group #%d', $group->id));
// filter the rules in the rule group:
$group->rules = $group->rules->filter(
function (Rule $rule) use ($filter) {
- Log::debug(sprintf('Now filtering rule #%d', $rule->id));
+ app('log')->debug(sprintf('Now filtering rule #%d', $rule->id));
foreach ($rule->ruleTriggers as $trigger) {
if ('user_action' === $trigger->trigger_type && $filter === $trigger->trigger_value) {
- Log::debug(sprintf('Rule #%d triggers on %s, include it.', $rule->id, $filter));
+ app('log')->debug(sprintf('Rule #%d triggers on %s, include it.', $rule->id, $filter));
return true;
}
}
- Log::debug(sprintf('Rule #%d does not trigger on %s, do not include it.', $rule->id, $filter));
+ app('log')->debug(sprintf('Rule #%d does not trigger on %s, do not include it.', $rule->id, $filter));
return false;
}
@@ -382,23 +382,23 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
if (null === $filter) {
return $groups;
}
- Log::debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter));
+ app('log')->debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter));
return $groups->map(
function (RuleGroup $group) use ($filter) {
- Log::debug(sprintf('Now filtering group #%d', $group->id));
+ app('log')->debug(sprintf('Now filtering group #%d', $group->id));
// filter the rules in the rule group:
$group->rules = $group->rules->filter(
function (Rule $rule) use ($filter) {
- Log::debug(sprintf('Now filtering rule #%d', $rule->id));
+ app('log')->debug(sprintf('Now filtering rule #%d', $rule->id));
foreach ($rule->ruleTriggers as $trigger) {
if ('user_action' === $trigger->trigger_type && $filter === $trigger->trigger_value) {
- Log::debug(sprintf('Rule #%d triggers on %s, include it.', $rule->id, $filter));
+ app('log')->debug(sprintf('Rule #%d triggers on %s, include it.', $rule->id, $filter));
return true;
}
}
- Log::debug(sprintf('Rule #%d does not trigger on %s, do not include it.', $rule->id, $filter));
+ app('log')->debug(sprintf('Rule #%d does not trigger on %s, do not include it.', $rule->id, $filter));
return false;
}
@@ -491,7 +491,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
->where('rule_groups.id', '!=', $ruleGroup->id)
->decrement('order');
$ruleGroup->order = $newOrder;
- Log::debug(sprintf('Order of group #%d ("%s") is now %d', $ruleGroup->id, $ruleGroup->title, $newOrder));
+ app('log')->debug(sprintf('Order of group #%d ("%s") is now %d', $ruleGroup->id, $ruleGroup->title, $newOrder));
$ruleGroup->save();
return;
@@ -501,7 +501,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
->where('rule_groups.id', '!=', $ruleGroup->id)
->increment('order');
$ruleGroup->order = $newOrder;
- Log::debug(sprintf('Order of group #%d ("%s") is now %d', $ruleGroup->id, $ruleGroup->title, $newOrder));
+ app('log')->debug(sprintf('Order of group #%d ("%s") is now %d', $ruleGroup->id, $ruleGroup->title, $newOrder));
$ruleGroup->save();
}
diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php
index 6b64f7e81f..efe4c1670f 100644
--- a/app/Repositories/Tag/TagRepository.php
+++ b/app/Repositories/Tag/TagRepository.php
@@ -183,12 +183,12 @@ class TagRepository implements TagRepositoryInterface
// add date range (or not):
if (null === $year) {
- Log::debug('Get tags without a date.');
+ app('log')->debug('Get tags without a date.');
$tagQuery->whereNull('tags.date');
}
if (null !== $year) {
- Log::debug(sprintf('Get tags with year %s.', $year));
+ app('log')->debug(sprintf('Get tags with year %s.', $year));
$tagQuery->where('tags.date', '>=', $year . '-01-01 00:00:00')->where('tags.date', '<=', $year . '-12-31 23:59:59');
}
$collection = $tagQuery->get();
diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
index 30b43efa98..5742b3b2fb 100644
--- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php
+++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
@@ -86,7 +86,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
*/
public function destroy(TransactionGroup $group): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$service = new TransactionGroupDestroyService();
$service->destroy($group);
}
diff --git a/app/Repositories/TransactionType/TransactionTypeRepository.php b/app/Repositories/TransactionType/TransactionTypeRepository.php
index e5db6a1308..8d57634157 100644
--- a/app/Repositories/TransactionType/TransactionTypeRepository.php
+++ b/app/Repositories/TransactionType/TransactionTypeRepository.php
@@ -40,9 +40,9 @@ class TransactionTypeRepository implements TransactionTypeRepositoryInterface
*/
public function findTransactionType(?TransactionType $type, ?string $typeString): TransactionType
{
- Log::debug('Now looking for a transaction type.');
+ app('log')->debug('Now looking for a transaction type.');
if (null !== $type) {
- Log::debug(sprintf('Found $type in parameters, its %s. Will return it.', $type->type));
+ app('log')->debug(sprintf('Found $type in parameters, its %s. Will return it.', $type->type));
return $type;
}
@@ -51,7 +51,7 @@ class TransactionTypeRepository implements TransactionTypeRepositoryInterface
if (null === $search) {
$search = $this->findByType(TransactionType::WITHDRAWAL);
}
- Log::debug(sprintf('Tried to search for "%s", came up with "%s". Will return it.', $typeString, $search->type));
+ app('log')->debug(sprintf('Tried to search for "%s", came up with "%s". Will return it.', $typeString, $search->type));
return $search;
}
diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php
index c54ccdb561..6ad2d5c90a 100644
--- a/app/Repositories/User/UserRepository.php
+++ b/app/Repositories/User/UserRepository.php
@@ -124,7 +124,7 @@ class UserRepository implements UserRepositoryInterface
*/
public function deleteInvite(InvitedUser $invite): void
{
- Log::debug(sprintf('Deleting invite #%d', $invite->id));
+ app('log')->debug(sprintf('Deleting invite #%d', $invite->id));
$invite->delete();
}
@@ -136,7 +136,7 @@ class UserRepository implements UserRepositoryInterface
*/
public function destroy(User $user): bool
{
- Log::debug(sprintf('Calling delete() on user %d', $user->id));
+ app('log')->debug(sprintf('Calling delete() on user %d', $user->id));
$user->groupMemberships()->delete();
$user->delete();
diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php
index 937d504af7..8a958f75b8 100644
--- a/app/Repositories/UserGroups/Account/AccountRepository.php
+++ b/app/Repositories/UserGroups/Account/AccountRepository.php
@@ -51,17 +51,17 @@ class AccountRepository implements AccountRepositoryInterface
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$query->whereIn('account_types.type', $types);
}
- Log::debug(sprintf('Searching for account named "%s" (of user #%d) of the following type(s)', $name, $this->user->id), ['types' => $types]);
+ app('log')->debug(sprintf('Searching for account named "%s" (of user #%d) of the following type(s)', $name, $this->user->id), ['types' => $types]);
$query->where('accounts.name', $name);
/** @var Account $account */
$account = $query->first(['accounts.*']);
if (null === $account) {
- Log::debug(sprintf('There is no account with name "%s" of types', $name), $types);
+ app('log')->debug(sprintf('There is no account with name "%s" of types', $name), $types);
return null;
}
- Log::debug(sprintf('Found #%d (%s) with type id %d', $account->id, $account->name, $account->account_type_id));
+ app('log')->debug(sprintf('Found #%d (%s) with type id %d', $account->id, $account->name, $account->account_type_id));
return $account;
}
diff --git a/app/Repositories/UserGroups/Bill/BillRepository.php b/app/Repositories/UserGroups/Bill/BillRepository.php
index 94c985eef0..b6a4bd27c5 100644
--- a/app/Repositories/UserGroups/Bill/BillRepository.php
+++ b/app/Repositories/UserGroups/Bill/BillRepository.php
@@ -193,21 +193,21 @@ class BillRepository implements BillRepositoryInterface
{
$set = new Collection();
$currentStart = clone $start;
- //Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
- //Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));
+ //app('log')->debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
+ //app('log')->debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));
while ($currentStart <= $end) {
- //Log::debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d')));
+ //app('log')->debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d')));
$nextExpectedMatch = $this->nextDateMatch($bill, $currentStart);
- //Log::debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
+ //app('log')->debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
if ($nextExpectedMatch > $end) {// If nextExpectedMatch is after end, we continue
break;
}
$set->push(clone $nextExpectedMatch);
- //Log::debug(sprintf('Now %d dates in set.', $set->count()));
+ //app('log')->debug(sprintf('Now %d dates in set.', $set->count()));
$nextExpectedMatch->addDay();
- //Log::debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
+ //app('log')->debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
$currentStart = clone $nextExpectedMatch;
}
diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
index a421b9c760..be333a1c88 100644
--- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php
+++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
@@ -262,17 +262,17 @@ class CurrencyRepository implements CurrencyRepositoryInterface
$result = $this->findCurrencyNull($currencyId, $currencyCode);
if (null === $result) {
- Log::debug('Grabbing default currency for this user...');
+ app('log')->debug('Grabbing default currency for this user...');
$result = app('amount')->getDefaultCurrencyByUser($this->user);
}
if (null === $result) {
- Log::debug('Grabbing EUR as fallback.');
+ app('log')->debug('Grabbing EUR as fallback.');
$result = $this->findByCode('EUR');
}
- Log::debug(sprintf('Final result: %s', $result->code));
+ app('log')->debug(sprintf('Final result: %s', $result->code));
if (false === $result->enabled) {
- Log::debug(sprintf('Also enabled currency %s', $result->code));
+ app('log')->debug(sprintf('Also enabled currency %s', $result->code));
$this->enable($result);
}
@@ -289,14 +289,14 @@ class CurrencyRepository implements CurrencyRepositoryInterface
*/
public function findCurrencyNull(?int $currencyId, ?string $currencyCode): ?TransactionCurrency
{
- Log::debug('Now in findCurrencyNull()');
+ app('log')->debug('Now in findCurrencyNull()');
$result = $this->find((int)$currencyId);
if (null === $result) {
- Log::debug(sprintf('Searching for currency with code %s...', $currencyCode));
+ app('log')->debug(sprintf('Searching for currency with code %s...', $currencyCode));
$result = $this->findByCode((string)$currencyCode);
}
if (null !== $result && false === $result->enabled) {
- Log::debug(sprintf('Also enabled currency %s', $result->code));
+ app('log')->debug(sprintf('Also enabled currency %s', $result->code));
$this->enable($result);
}
diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.php
index 296dc580b8..a581abcb45 100644
--- a/app/Rules/BelongsUser.php
+++ b/app/Rules/BelongsUser.php
@@ -51,7 +51,7 @@ class BelongsUser implements ValidationRule
return;
}
$attribute = (string)$attribute;
- Log::debug(sprintf('Going to validate %s', $attribute));
+ app('log')->debug(sprintf('Going to validate %s', $attribute));
$result = match ($attribute) {
'piggy_bank_id' => $this->validatePiggyBankId((int)$value),
@@ -137,10 +137,10 @@ class BelongsUser implements ValidationRule
$count = 0;
foreach ($objects as $object) {
$objectValue = trim((string)$object->$field);
- Log::debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
+ app('log')->debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
if ($objectValue === $value) {
$count++;
- Log::debug(sprintf('Hit! Count is now %d', $count));
+ app('log')->debug(sprintf('Hit! Count is now %d', $count));
}
}
@@ -185,7 +185,7 @@ class BelongsUser implements ValidationRule
private function validateBillName(string $value): bool
{
$count = $this->countField(Bill::class, 'name', $value);
- Log::debug(sprintf('Result of countField for bill name "%s" is %d', $value, $count));
+ app('log')->debug(sprintf('Result of countField for bill name "%s" is %d', $value, $count));
return 1 === $count;
}
diff --git a/app/Rules/BelongsUserGroup.php b/app/Rules/BelongsUserGroup.php
index 54cc6a57e2..2d53dc3681 100644
--- a/app/Rules/BelongsUserGroup.php
+++ b/app/Rules/BelongsUserGroup.php
@@ -66,7 +66,7 @@ class BelongsUserGroup implements ValidationRule
return;
}
$attribute = (string)$attribute;
- Log::debug(sprintf('Group: Going to validate "%s"', $attribute));
+ app('log')->debug(sprintf('Group: Going to validate "%s"', $attribute));
$result = match ($attribute) {
'piggy_bank_id' => $this->validatePiggyBankId((int)$value),
diff --git a/app/Rules/IsTransferAccount.php b/app/Rules/IsTransferAccount.php
index 8cf7d14b05..a972e14cad 100644
--- a/app/Rules/IsTransferAccount.php
+++ b/app/Rules/IsTransferAccount.php
@@ -54,7 +54,7 @@ class IsTransferAccount implements Rule
*/
public function passes($attribute, $value): bool
{
- Log::debug(sprintf('Now in %s(%s)', __METHOD__, $value));
+ app('log')->debug(sprintf('Now in %s(%s)', __METHOD__, $value));
/** @var AccountValidator $validator */
$validator = app(AccountValidator::class);
$validator->setTransactionType(TransactionType::TRANSFER);
@@ -62,13 +62,13 @@ class IsTransferAccount implements Rule
$validAccount = $validator->validateSource(['name' => (string)$value,]);
if (true === $validAccount) {
- Log::debug('Found account based on name. Return true.');
+ app('log')->debug('Found account based on name. Return true.');
// found by name, use repos to return.
return true;
}
$validAccount = $validator->validateSource(['id' => (int)$value,]);
- Log::debug(sprintf('Search by id (%d), result is %s.', (int)$value, var_export($validAccount, true)));
+ app('log')->debug(sprintf('Search by id (%d), result is %s.', (int)$value, var_export($validAccount, true)));
return false !== $validAccount;
}
diff --git a/app/Rules/UniqueAccountNumber.php b/app/Rules/UniqueAccountNumber.php
index c9aaddafe8..832c84c12d 100644
--- a/app/Rules/UniqueAccountNumber.php
+++ b/app/Rules/UniqueAccountNumber.php
@@ -46,7 +46,7 @@ class UniqueAccountNumber implements Rule
*/
public function __construct(?Account $account, ?string $expectedType)
{
- Log::debug('Constructed UniqueAccountNumber');
+ app('log')->debug('Constructed UniqueAccountNumber');
$this->account = $account;
$this->expectedType = $expectedType;
// a very basic fix to make sure we get the correct account type:
@@ -59,7 +59,7 @@ class UniqueAccountNumber implements Rule
if ('asset' === $expectedType) {
$this->expectedType = AccountType::ASSET;
}
- Log::debug(sprintf('Expected type is "%s"', $this->expectedType));
+ app('log')->debug(sprintf('Expected type is "%s"', $this->expectedType));
}
/**
@@ -94,9 +94,9 @@ class UniqueAccountNumber implements Rule
foreach ($maxCounts as $type => $max) {
$count = $this->countHits($type, $value);
- Log::debug(sprintf('Count for "%s" and account number "%s" is %d', $type, $value, $count));
+ app('log')->debug(sprintf('Count for "%s" and account number "%s" is %d', $type, $value, $count));
if ($count > $max) {
- Log::debug(
+ app('log')->debug(
sprintf(
'account number "%s" is in use with %d account(s) of type "%s", which is too much for expected type "%s"',
$value,
@@ -109,7 +109,7 @@ class UniqueAccountNumber implements Rule
return false;
}
}
- Log::debug('Account number is valid.');
+ app('log')->debug('Account number is valid.');
return true;
}
diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.php
index 6a0c3940cb..0734862631 100644
--- a/app/Rules/UniqueIban.php
+++ b/app/Rules/UniqueIban.php
@@ -109,9 +109,9 @@ class UniqueIban implements ValidationRule
foreach ($maxCounts as $type => $max) {
$count = $this->countHits($type, $value);
- Log::debug(sprintf('Count for "%s" and IBAN "%s" is %d', $type, $value, $count));
+ app('log')->debug(sprintf('Count for "%s" and IBAN "%s" is %d', $type, $value, $count));
if ($count > $max) {
- Log::debug(
+ app('log')->debug(
sprintf(
'IBAN "%s" is in use with %d account(s) of type "%s", which is too much for expected types "%s"',
$value,
diff --git a/app/Rules/ValidJournals.php b/app/Rules/ValidJournals.php
index 11e56e89cf..32e2017985 100644
--- a/app/Rules/ValidJournals.php
+++ b/app/Rules/ValidJournals.php
@@ -56,7 +56,7 @@ class ValidJournals implements Rule
*/
public function passes($attribute, $value): bool
{
- Log::debug('In ValidJournals::passes');
+ app('log')->debug('In ValidJournals::passes');
if (!is_array($value)) {
return true;
}
@@ -64,12 +64,12 @@ class ValidJournals implements Rule
foreach ($value as $journalId) {
$count = TransactionJournal::where('id', $journalId)->where('user_id', $userId)->count();
if (0 === $count) {
- Log::debug(sprintf('Count for transaction #%d and user #%d is zero! Return FALSE', $journalId, $userId));
+ app('log')->debug(sprintf('Count for transaction #%d and user #%d is zero! Return FALSE', $journalId, $userId));
return false;
}
}
- Log::debug('Return true!');
+ app('log')->debug('Return true!');
return true;
}
diff --git a/app/Rules/ValidRecurrenceRepetitionValue.php b/app/Rules/ValidRecurrenceRepetitionValue.php
index 10ec16ea84..6b094f7705 100644
--- a/app/Rules/ValidRecurrenceRepetitionValue.php
+++ b/app/Rules/ValidRecurrenceRepetitionValue.php
@@ -142,7 +142,7 @@ class ValidRecurrenceRepetitionValue implements Rule
try {
Carbon::createFromFormat('Y-m-d', $dateString);
} catch (InvalidArgumentException $e) {
- Log::debug(sprintf('Could not parse date %s: %s', $dateString, $e->getMessage()));
+ app('log')->debug(sprintf('Could not parse date %s: %s', $dateString, $e->getMessage()));
return false;
}
diff --git a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php
index 62cb0b4ac9..14ff90438e 100644
--- a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php
+++ b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php
@@ -43,7 +43,7 @@ class UpdateRequest implements UpdateRequestInterface
*/
public function getUpdateInformation(string $channel): array
{
- Log::debug(sprintf('Now in getUpdateInformation(%s)', $channel));
+ app('log')->debug(sprintf('Now in getUpdateInformation(%s)', $channel));
$information = [
'level' => 'error',
'message' => (string)trans('firefly.unknown_error'),
@@ -70,7 +70,7 @@ class UpdateRequest implements UpdateRequestInterface
*/
private function contactServer(string $channel): array
{
- Log::debug(sprintf('Now in contactServer(%s)', $channel));
+ app('log')->debug(sprintf('Now in contactServer(%s)', $channel));
// always fall back to current version:
$return = [
'version' => config('firefly.version'),
@@ -80,7 +80,7 @@ class UpdateRequest implements UpdateRequestInterface
];
$url = config('firefly.update_endpoint');
- Log::debug(sprintf('Going to call %s', $url));
+ app('log')->debug(sprintf('Going to call %s', $url));
try {
$client = new Client();
$options = [
@@ -140,7 +140,7 @@ class UpdateRequest implements UpdateRequestInterface
*/
private function parseResult(array $information): array
{
- Log::debug('Now in parseResult()', $information);
+ app('log')->debug('Now in parseResult()', $information);
$return = [
'level' => 'error',
'message' => (string)trans('firefly.unknown_error'),
@@ -155,13 +155,13 @@ class UpdateRequest implements UpdateRequestInterface
$compare = version_compare($latest, $current);
- Log::debug(sprintf('Current version is "%s", latest is "%s", result is: %d', $current, $latest, $compare));
+ app('log')->debug(sprintf('Current version is "%s", latest is "%s", result is: %d', $current, $latest, $compare));
// -1: you're running a newer version:
if (-1 === $compare) {
$return['level'] = 'info';
$return['message'] = (string)trans('firefly.update_newer_version_alert', ['your_version' => $current, 'new_version' => $latest]);
- Log::debug('User is running a newer version', $return);
+ app('log')->debug('User is running a newer version', $return);
return $return;
}
@@ -169,7 +169,7 @@ class UpdateRequest implements UpdateRequestInterface
if (0 === $compare) {
$return['level'] = 'info';
$return['message'] = (string)trans('firefly.update_current_version_alert', ['version' => $current]);
- Log::debug('User is the current version.', $return);
+ app('log')->debug('User is the current version.', $return);
return $return;
}
@@ -191,7 +191,7 @@ class UpdateRequest implements UpdateRequestInterface
'days' => $expectedDiff,
]
);
- Log::debug('Release is very fresh.', $return);
+ app('log')->debug('Release is very fresh.', $return);
return $return;
}
@@ -206,22 +206,22 @@ class UpdateRequest implements UpdateRequestInterface
'date' => $released->isoFormat((string)trans('config.month_and_day_js')),
]
);
- Log::debug('New release is old enough.');
+ app('log')->debug('New release is old enough.');
// add warning in case of alpha or beta:
// append warning if beta or alpha.
$isBeta = $information['is_beta'] ?? false;
if (true === $isBeta) {
$return['message'] = sprintf('%s %s', $return['message'], trans('firefly.update_version_beta'));
- Log::debug('New release is also a beta!');
+ app('log')->debug('New release is also a beta!');
}
$isAlpha = $information['is_alpha'] ?? false;
if (true === $isAlpha) {
$return['message'] = sprintf('%s %s', $return['message'], trans('firefly.update_version_alpha'));
- Log::debug('New release is also a alpha!');
+ app('log')->debug('New release is also a alpha!');
}
- Log::debug('New release is here!', $return);
+ app('log')->debug('New release is here!', $return);
// send event, this may result in a notification.
event(new NewVersionAvailable($return['message']));
diff --git a/app/Services/Internal/Destroy/AccountDestroyService.php b/app/Services/Internal/Destroy/AccountDestroyService.php
index af4fd4cace..7c5b298a1a 100644
--- a/app/Services/Internal/Destroy/AccountDestroyService.php
+++ b/app/Services/Internal/Destroy/AccountDestroyService.php
@@ -75,7 +75,7 @@ class AccountDestroyService
*/
private function destroyOpeningBalance(Account $account): void
{
- Log::debug(sprintf('Searching for opening balance for account #%d "%s"', $account->id, $account->name));
+ app('log')->debug(sprintf('Searching for opening balance for account #%d "%s"', $account->id, $account->name));
$set = $account->transactions()
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
@@ -83,7 +83,7 @@ class AccountDestroyService
->get(['transactions.transaction_journal_id']);
if ($set->count() > 0) {
$journalId = (int)$set->first()->transaction_journal_id;
- Log::debug(sprintf('Found opening balance journal with ID #%d', $journalId));
+ app('log')->debug(sprintf('Found opening balance journal with ID #%d', $journalId));
// get transactions with this journal (should be just one):
$transactions = Transaction::where('transaction_journal_id', $journalId)
@@ -91,9 +91,9 @@ class AccountDestroyService
->get();
/** @var Transaction $transaction */
foreach ($transactions as $transaction) {
- Log::debug(sprintf('Found transaction with ID #%d', $transaction->id));
+ app('log')->debug(sprintf('Found transaction with ID #%d', $transaction->id));
$ibAccount = $transaction->account;
- Log::debug(sprintf('Connected to account #%d "%s"', $ibAccount->id, $ibAccount->name));
+ app('log')->debug(sprintf('Connected to account #%d "%s"', $ibAccount->id, $ibAccount->name));
$ibAccount->accountMeta()->delete();
$transaction->delete();
@@ -114,7 +114,7 @@ class AccountDestroyService
*/
public function moveTransactions(Account $account, Account $moveTo): void
{
- Log::debug(sprintf('Move from account #%d to #%d', $account->id, $moveTo->id));
+ app('log')->debug(sprintf('Move from account #%d to #%d', $account->id, $moveTo->id));
DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]);
$collection = Transaction::groupBy('transaction_journal_id', 'account_id')
@@ -133,7 +133,7 @@ class AccountDestroyService
$journalId = (int)$row->transaction_journal_id;
$journal = $user->transactionJournals()->find($journalId);
if (null !== $journal) {
- Log::debug(sprintf('Deleted journal #%d because it has the same source as destination.', $journal->id));
+ app('log')->debug(sprintf('Deleted journal #%d because it has the same source as destination.', $journal->id));
$service->destroy($journal);
}
}
@@ -158,14 +158,14 @@ class AccountDestroyService
/** @var JournalDestroyService $service */
$service = app(JournalDestroyService::class);
- Log::debug('Now trigger account delete response #' . $account->id);
+ app('log')->debug('Now trigger account delete response #' . $account->id);
/** @var Transaction $transaction */
foreach ($account->transactions()->get() as $transaction) {
- Log::debug('Now at transaction #' . $transaction->id);
+ app('log')->debug('Now at transaction #' . $transaction->id);
/** @var TransactionJournal $journal */
$journal = $transaction->transactionJournal()->first();
if (null !== $journal) {
- Log::debug('Call for deletion of journal #' . $journal->id);
+ app('log')->debug('Call for deletion of journal #' . $journal->id);
$service->destroy($journal);
}
}
diff --git a/app/Services/Internal/Destroy/JournalDestroyService.php b/app/Services/Internal/Destroy/JournalDestroyService.php
index 0c52c769bd..df70f7857f 100644
--- a/app/Services/Internal/Destroy/JournalDestroyService.php
+++ b/app/Services/Internal/Destroy/JournalDestroyService.php
@@ -41,17 +41,17 @@ class JournalDestroyService
*/
public function destroy(TransactionJournal $journal): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
/** @var Transaction $transaction */
foreach ($journal->transactions()->get() as $transaction) {
- Log::debug(sprintf('Will now delete transaction #%d', $transaction->id));
+ app('log')->debug(sprintf('Will now delete transaction #%d', $transaction->id));
$transaction->delete();
}
// also delete journal_meta entries.
/** @var TransactionJournalMeta $meta */
foreach ($journal->transactionJournalMeta()->get() as $meta) {
- Log::debug(sprintf('Will now delete meta-entry #%d', $meta->id));
+ app('log')->debug(sprintf('Will now delete meta-entry #%d', $meta->id));
$meta->delete();
}
diff --git a/app/Services/Internal/Destroy/TransactionGroupDestroyService.php b/app/Services/Internal/Destroy/TransactionGroupDestroyService.php
index 6ef875d46b..9e88c85f40 100644
--- a/app/Services/Internal/Destroy/TransactionGroupDestroyService.php
+++ b/app/Services/Internal/Destroy/TransactionGroupDestroyService.php
@@ -39,7 +39,7 @@ class TransactionGroupDestroyService
*/
public function destroy(TransactionGroup $transactionGroup): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
/** @var JournalDestroyService $service */
$service = app(JournalDestroyService::class);
foreach ($transactionGroup->transactionJournals as $journal) {
diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php
index c6a6866dfe..6b1400f051 100644
--- a/app/Services/Internal/Support/AccountServiceTrait.php
+++ b/app/Services/Internal/Support/AccountServiceTrait.php
@@ -204,11 +204,11 @@ trait AccountServiceTrait
}
if ('' !== $data['opening_balance'] && array_key_exists('opening_balance_date', $data) && '' !== $data['opening_balance_date']
&& $data['opening_balance_date'] instanceof Carbon) {
- Log::debug('Array has valid opening balance data.');
+ app('log')->debug('Array has valid opening balance data.');
return true;
}
- Log::debug('Array does not have valid opening balance data.');
+ app('log')->debug('Array does not have valid opening balance data.');
return false;
}
@@ -224,7 +224,7 @@ trait AccountServiceTrait
*/
protected function createOBGroup(Account $account, array $data): TransactionGroup
{
- Log::debug('Now going to create an OB group.');
+ app('log')->debug('Now going to create an OB group.');
$language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
$sourceId = null;
$sourceName = null;
@@ -234,19 +234,19 @@ trait AccountServiceTrait
// amount is positive.
if (1 === bccomp($amount, '0')) {
- Log::debug(sprintf('Amount is %s, which is positive. Source is a new IB account, destination is #%d', $amount, $account->id));
+ app('log')->debug(sprintf('Amount is %s, which is positive. Source is a new IB account, destination is #%d', $amount, $account->id));
$sourceName = trans('firefly.initial_balance_description', ['account' => $account->name], $language);
$destId = $account->id;
}
// amount is not positive
if (-1 === bccomp($amount, '0')) {
- Log::debug(sprintf('Amount is %s, which is negative. Destination is a new IB account, source is #%d', $amount, $account->id));
+ app('log')->debug(sprintf('Amount is %s, which is negative. Destination is a new IB account, source is #%d', $amount, $account->id));
$destName = trans('firefly.initial_balance_account', ['account' => $account->name], $language);
$sourceId = $account->id;
}
// amount is 0
if (0 === bccomp($amount, '0')) {
- Log::debug('Amount is zero, so will not make an OB group.');
+ app('log')->debug('Amount is zero, so will not make an OB group.');
throw new FireflyException('Amount for new opening balance was unexpectedly 0.');
}
@@ -289,7 +289,7 @@ trait AccountServiceTrait
],
],
];
- Log::debug('Going for submission in createOBGroup', $submission);
+ app('log')->debug('Going for submission in createOBGroup', $submission);
/** @var TransactionGroupFactory $factory */
$factory = app(TransactionGroupFactory::class);
@@ -313,11 +313,11 @@ trait AccountServiceTrait
*/
protected function deleteCreditTransaction(Account $account): void
{
- Log::debug(sprintf('deleteCreditTransaction() for account #%d', $account->id));
+ app('log')->debug(sprintf('deleteCreditTransaction() for account #%d', $account->id));
$creditGroup = $this->getCreditTransaction($account);
if (null !== $creditGroup) {
- Log::debug('Credit journal found, delete journal.');
+ app('log')->debug('Credit journal found, delete journal.');
/** @var TransactionGroupDestroyService $service */
$service = app(TransactionGroupDestroyService::class);
$service->destroy($creditGroup);
@@ -333,7 +333,7 @@ trait AccountServiceTrait
*/
protected function getCreditTransaction(Account $account): ?TransactionGroup
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
return $this->accountRepository->getCreditTransactionGroup($account);
}
@@ -345,12 +345,12 @@ trait AccountServiceTrait
*/
protected function deleteOBGroup(Account $account): void
{
- Log::debug(sprintf('deleteOB() for account #%d', $account->id));
+ app('log')->debug(sprintf('deleteOB() for account #%d', $account->id));
$openingBalanceGroup = $this->getOBGroup($account);
// opening balance data? update it!
if (null !== $openingBalanceGroup) {
- Log::debug('Opening balance journal found, delete journal.');
+ app('log')->debug('Opening balance journal found, delete journal.');
/** @var TransactionGroupDestroyService $service */
$service = app(TransactionGroupDestroyService::class);
$service->destroy($openingBalanceGroup);
@@ -410,10 +410,10 @@ trait AccountServiceTrait
*/
protected function updateCreditTransaction(Account $account, string $direction, string $openingBalance, Carbon $openingBalanceDate): TransactionGroup
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
if (0 === bccomp($openingBalance, '0')) {
- Log::debug('Amount is zero, so will not update liability credit/debit group.');
+ app('log')->debug('Amount is zero, so will not update liability credit/debit group.');
throw new FireflyException('Amount for update liability credit/debit was unexpectedly 0.');
}
// if direction is "debit" (i owe this debt), amount is negative.
@@ -471,10 +471,10 @@ trait AccountServiceTrait
*/
protected function createCreditTransaction(Account $account, string $openingBalance, Carbon $openingBalanceDate): TransactionGroup
{
- Log::debug('Now going to create an createCreditTransaction.');
+ app('log')->debug('Now going to create an createCreditTransaction.');
if (0 === bccomp($openingBalance, '0')) {
- Log::debug('Amount is zero, so will not make an liability credit group.');
+ app('log')->debug('Amount is zero, so will not make an liability credit group.');
throw new FireflyException('Amount for new liability credit was unexpectedly 0.');
}
@@ -534,7 +534,7 @@ trait AccountServiceTrait
],
],
];
- Log::debug('Going for submission in createCreditTransaction', $submission);
+ app('log')->debug('Going for submission in createCreditTransaction', $submission);
/** @var TransactionGroupFactory $factory */
$factory = app(TransactionGroupFactory::class);
@@ -622,13 +622,13 @@ trait AccountServiceTrait
*/
protected function updateOBGroupV2(Account $account, string $openingBalance, Carbon $openingBalanceDate): TransactionGroup
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
// create if not exists:
$obGroup = $this->getOBGroup($account);
if (null === $obGroup) {
return $this->createOBGroupV2($account, $openingBalance, $openingBalanceDate);
}
- Log::debug('Update OB group');
+ app('log')->debug('Update OB group');
// if exists, update:
$currency = $this->accountRepository->getAccountCurrency($account);
@@ -646,7 +646,7 @@ trait AccountServiceTrait
// if amount is negative:
if (1 === bccomp('0', $openingBalance)) {
- Log::debug('Amount is negative.');
+ app('log')->debug('Amount is negative.');
// account transaction loses money:
$accountTransaction->amount = app('steam')->negative($openingBalance);
$accountTransaction->transaction_currency_id = $currency->id;
@@ -656,7 +656,7 @@ trait AccountServiceTrait
$obTransaction->transaction_currency_id = $currency->id;
}
if (-1 === bccomp('0', $openingBalance)) {
- Log::debug('Amount is positive.');
+ app('log')->debug('Amount is positive.');
// account gains money:
$accountTransaction->amount = app('steam')->positive($openingBalance);
$accountTransaction->transaction_currency_id = $currency->id;
@@ -685,7 +685,7 @@ trait AccountServiceTrait
*/
protected function createOBGroupV2(Account $account, string $openingBalance, Carbon $openingBalanceDate): TransactionGroup
{
- Log::debug('Now going to create an OB group.');
+ app('log')->debug('Now going to create an OB group.');
$language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
$sourceId = null;
$sourceName = null;
@@ -694,19 +694,19 @@ trait AccountServiceTrait
// amount is positive.
if (1 === bccomp($openingBalance, '0')) {
- Log::debug(sprintf('Amount is %s, which is positive. Source is a new IB account, destination is #%d', $openingBalance, $account->id));
+ app('log')->debug(sprintf('Amount is %s, which is positive. Source is a new IB account, destination is #%d', $openingBalance, $account->id));
$sourceName = trans('firefly.initial_balance_description', ['account' => $account->name], $language);
$destId = $account->id;
}
// amount is not positive
if (-1 === bccomp($openingBalance, '0')) {
- Log::debug(sprintf('Amount is %s, which is negative. Destination is a new IB account, source is #%d', $openingBalance, $account->id));
+ app('log')->debug(sprintf('Amount is %s, which is negative. Destination is a new IB account, source is #%d', $openingBalance, $account->id));
$destName = trans('firefly.initial_balance_account', ['account' => $account->name], $language);
$sourceId = $account->id;
}
// amount is 0
if (0 === bccomp($openingBalance, '0')) {
- Log::debug('Amount is zero, so will not make an OB group.');
+ app('log')->debug('Amount is zero, so will not make an OB group.');
throw new FireflyException('Amount for new opening balance was unexpectedly 0.');
}
@@ -749,7 +749,7 @@ trait AccountServiceTrait
],
],
];
- Log::debug('Going for submission in createOBGroupV2', $submission);
+ app('log')->debug('Going for submission in createOBGroupV2', $submission);
/** @var TransactionGroupFactory $factory */
$factory = app(TransactionGroupFactory::class);
diff --git a/app/Services/Internal/Support/BillServiceTrait.php b/app/Services/Internal/Support/BillServiceTrait.php
index a30385423b..cecbcf0bd8 100644
--- a/app/Services/Internal/Support/BillServiceTrait.php
+++ b/app/Services/Internal/Support/BillServiceTrait.php
@@ -52,7 +52,7 @@ trait BillServiceTrait
/** @var RuleAction $ruleAction */
foreach ($set as $ruleAction) {
- Log::debug(sprintf('Updated rule action #%d to search for new bill name "%s"', $ruleAction->id, $newName));
+ app('log')->debug(sprintf('Updated rule action #%d to search for new bill name "%s"', $ruleAction->id, $newName));
$ruleAction->action_value = $newName;
$ruleAction->save();
}
diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php
index f82bfd83db..7ea00a9de6 100644
--- a/app/Services/Internal/Support/JournalServiceTrait.php
+++ b/app/Services/Internal/Support/JournalServiceTrait.php
@@ -59,7 +59,7 @@ trait JournalServiceTrait
protected function getAccount(string $transactionType, string $direction, array $data): ?Account
{
// some debug logging:
- Log::debug(sprintf('Now in getAccount(%s)', $direction), $data);
+ app('log')->debug(sprintf('Now in getAccount(%s)', $direction), $data);
// expected type of source account, in order of preference
/** @var array $array */
@@ -69,7 +69,7 @@ trait JournalServiceTrait
// and now try to find it, based on the type of transaction.
$message = 'Transaction = %s, %s account should be in: %s. Direction is %s.';
- Log::debug(sprintf($message, $transactionType, $direction, implode(', ', $expectedTypes[$transactionType] ?? ['UNKNOWN']), $direction));
+ app('log')->debug(sprintf($message, $transactionType, $direction, implode(', ', $expectedTypes[$transactionType] ?? ['UNKNOWN']), $direction));
$result = $this->findAccountById($data, $expectedTypes[$transactionType]);
$result = $this->findAccountByIban($result, $data, $expectedTypes[$transactionType]);
@@ -83,7 +83,7 @@ trait JournalServiceTrait
// this account. In such a case, the name search must be retried with a new name.
if (null !== $nameResult && null === $numberResult && null === $ibanResult && '' !== (string)$data['iban'] && '' !== (string)$nameResult->iban) {
$data['name'] = sprintf('%s (%s)', $data['name'], $data['iban']);
- Log::debug(sprintf('Search again using the new name, "%s".', $data['name']));
+ app('log')->debug(sprintf('Search again using the new name, "%s".', $data['name']));
$result = $this->findAccountByName(null, $data, $expectedTypes[$transactionType]);
}
@@ -94,7 +94,7 @@ trait JournalServiceTrait
// if the result is NULL but the ID is set, an account could exist of the wrong type.
// that data can be used to create a new account of the right type.
if (null === $result && null !== $data['id'] && null !== $creatableType) {
- Log::debug(sprintf('Account #%d may exist and be of the wrong type, use data to create one of the right type.', $data['id']));
+ app('log')->debug(sprintf('Account #%d may exist and be of the wrong type, use data to create one of the right type.', $data['id']));
$temp = $this->findAccountById(['id' => $data['id']], []);
if (null !== $temp) {
$tempData = [
@@ -107,11 +107,11 @@ trait JournalServiceTrait
}
}
if (null === $result && null !== $creatableType) {
- Log::debug('If nothing is found, create it.');
+ app('log')->debug('If nothing is found, create it.');
$result = $this->createAccount($result, $data, $creatableType);
}
if (null === $result) {
- Log::debug('If cant be created, return cash account.');
+ app('log')->debug('If cant be created, return cash account.');
$result = $this->getCashAccount($result, $data, $expectedTypes[$transactionType]);
}
return $result;
@@ -129,19 +129,19 @@ trait JournalServiceTrait
if (null !== $data['id']) {
$search = $this->accountRepository->find((int)$data['id']);
if (null !== $search && in_array($search->accountType->type, $types, true)) {
- Log::debug(
+ app('log')->debug(
sprintf('Found "account_id" object: #%d, "%s" of type %s (1)', $search->id, $search->name, $search->accountType->type)
);
return $search;
}
if (null !== $search && 0 === count($types)) {
- Log::debug(
+ app('log')->debug(
sprintf('Found "account_id" object: #%d, "%s" of type %s (2)', $search->id, $search->name, $search->accountType->type)
);
return $search;
}
}
- Log::debug(sprintf('Found no account by ID #%d of types', $data['id']), $types);
+ app('log')->debug(sprintf('Found no account by ID #%d of types', $data['id']), $types);
return null;
}
@@ -155,11 +155,11 @@ trait JournalServiceTrait
private function findAccountByIban(?Account $account, array $data, array $types): ?Account
{
if (null !== $account) {
- Log::debug(sprintf('Already have account #%d ("%s"), return that.', $account->id, $account->name));
+ app('log')->debug(sprintf('Already have account #%d ("%s"), return that.', $account->id, $account->name));
return $account;
}
if (null === $data['iban'] || '' === $data['iban']) {
- Log::debug('IBAN is empty, will not search for IBAN.');
+ app('log')->debug('IBAN is empty, will not search for IBAN.');
return null;
}
// find by preferred type.
@@ -168,11 +168,11 @@ trait JournalServiceTrait
$source = $source ?? $this->accountRepository->findByIbanNull($data['iban'], $types);
if (null !== $source) {
- Log::debug(sprintf('Found "account_iban" object: #%d, %s', $source->id, $source->name));
+ app('log')->debug(sprintf('Found "account_iban" object: #%d, %s', $source->id, $source->name));
return $source;
}
- Log::debug(sprintf('Found no account with IBAN "%s" of expected types', $data['iban']), $types);
+ app('log')->debug(sprintf('Found no account with IBAN "%s" of expected types', $data['iban']), $types);
return null;
}
@@ -186,11 +186,11 @@ trait JournalServiceTrait
private function findAccountByNumber(?Account $account, array $data, array $types): ?Account
{
if (null !== $account) {
- Log::debug(sprintf('Already have account #%d ("%s"), return that.', $account->id, $account->name));
+ app('log')->debug(sprintf('Already have account #%d ("%s"), return that.', $account->id, $account->name));
return $account;
}
if (null === $data['number'] || '' === $data['number']) {
- Log::debug('Account number is empty, will not search for account number.');
+ app('log')->debug('Account number is empty, will not search for account number.');
return null;
}
// find by preferred type.
@@ -200,12 +200,12 @@ trait JournalServiceTrait
$source = $source ?? $this->accountRepository->findByAccountNumber((string)$data['number'], $types);
if (null !== $source) {
- Log::debug(sprintf('Found account: #%d, %s', $source->id, $source->name));
+ app('log')->debug(sprintf('Found account: #%d, %s', $source->id, $source->name));
return $source;
}
- Log::debug(sprintf('Found no account with account number "%s" of expected types', $data['number']), $types);
+ app('log')->debug(sprintf('Found no account with account number "%s" of expected types', $data['number']), $types);
return null;
}
@@ -219,11 +219,11 @@ trait JournalServiceTrait
private function findAccountByName(?Account $account, array $data, array $types): ?Account
{
if (null !== $account) {
- Log::debug(sprintf('Already have account #%d ("%s"), return that.', $account->id, $account->name));
+ app('log')->debug(sprintf('Already have account #%d ("%s"), return that.', $account->id, $account->name));
return $account;
}
if (null === $data['name'] || '' === $data['name']) {
- Log::debug('Account name is empty, will not search for account name.');
+ app('log')->debug('Account name is empty, will not search for account name.');
return null;
}
@@ -234,11 +234,11 @@ trait JournalServiceTrait
$source = $source ?? $this->accountRepository->findByName($data['name'], $types);
if (null !== $source) {
- Log::debug(sprintf('Found "account_name" object: #%d, %s', $source->id, $source->name));
+ app('log')->debug(sprintf('Found "account_name" object: #%d, %s', $source->id, $source->name));
return $source;
}
- Log::debug(sprintf('Found no account with account name "%s" of expected types', $data['name']), $types);
+ app('log')->debug(sprintf('Found no account with account name "%s" of expected types', $data['name']), $types);
return null;
}
@@ -271,10 +271,10 @@ trait JournalServiceTrait
*/
private function createAccount(?Account $account, array $data, string $preferredType): ?Account
{
- Log::debug('Now in createAccount()', $data);
+ app('log')->debug('Now in createAccount()', $data);
// return new account.
if (null !== $account) {
- Log::debug(
+ app('log')->debug(
sprintf(
'Was given %s account #%d ("%s") so will simply return that.',
$account->accountType->type,
@@ -290,17 +290,17 @@ trait JournalServiceTrait
}
// fix name of account if only IBAN is given:
if ('' === (string)$data['name'] && '' !== (string)$data['iban']) {
- Log::debug(sprintf('Account name is now IBAN ("%s")', $data['iban']));
+ app('log')->debug(sprintf('Account name is now IBAN ("%s")', $data['iban']));
$data['name'] = $data['iban'];
}
// fix name of account if only number is given:
if ('' === (string)$data['name'] && '' !== (string)$data['number']) {
- Log::debug(sprintf('Account name is now account number ("%s")', $data['number']));
+ app('log')->debug(sprintf('Account name is now account number ("%s")', $data['number']));
$data['name'] = $data['number'];
}
// if name is still NULL, return NULL.
if ('' === (string)$data['name']) {
- Log::debug('Account name is still NULL, return NULL.');
+ app('log')->debug('Account name is still NULL, return NULL.');
return null;
}
//$data['name'] = $data['name'] ?? '(no name)';
@@ -348,7 +348,7 @@ trait JournalServiceTrait
&& in_array(AccountType::CASH, $types, true)) {
$account = $this->accountRepository->getCashAccount();
}
- Log::debug('Cannot return cash account, return input instead.');
+ app('log')->debug('Cannot return cash account, return input instead.');
return $account;
}
@@ -363,7 +363,7 @@ trait JournalServiceTrait
if ('' === $amount) {
throw new FireflyException(sprintf('The amount cannot be an empty string: "%s"', $amount));
}
- Log::debug(sprintf('Now in getAmount("%s")', $amount));
+ app('log')->debug(sprintf('Now in getAmount("%s")', $amount));
if (0 === bccomp('0', $amount)) {
throw new FireflyException(sprintf('The amount seems to be zero: "%s"', $amount));
}
@@ -379,21 +379,21 @@ trait JournalServiceTrait
protected function getForeignAmount(?string $amount): ?string
{
if (null === $amount) {
- Log::debug('No foreign amount info in array. Return NULL');
+ app('log')->debug('No foreign amount info in array. Return NULL');
return null;
}
if ('' === $amount) {
- Log::debug('Foreign amount is empty string, return NULL.');
+ app('log')->debug('Foreign amount is empty string, return NULL.');
return null;
}
if (0 === bccomp('0', $amount)) {
- Log::debug('Foreign amount is 0.0, return NULL.');
+ app('log')->debug('Foreign amount is 0.0, return NULL.');
return null;
}
- Log::debug(sprintf('Foreign amount is %s', $amount));
+ app('log')->debug(sprintf('Foreign amount is %s', $amount));
return $amount;
}
@@ -413,7 +413,7 @@ trait JournalServiceTrait
}
$budget = $this->budgetRepository->findBudget($data['budget_id'], $data['budget_name']);
if (null !== $budget) {
- Log::debug(sprintf('Link budget #%d to journal #%d', $budget->id, $journal->id));
+ app('log')->debug(sprintf('Link budget #%d to journal #%d', $budget->id, $journal->id));
$journal->budgets()->sync([$budget->id]);
return;
@@ -432,7 +432,7 @@ trait JournalServiceTrait
{
$category = $this->categoryRepository->findCategory($data['category_id'], $data['category_name']);
if (null !== $category) {
- Log::debug(sprintf('Link category #%d to journal #%d', $category->id, $journal->id));
+ app('log')->debug(sprintf('Link category #%d to journal #%d', $category->id, $journal->id));
$journal->categories()->sync([$category->id]);
return;
@@ -458,7 +458,7 @@ trait JournalServiceTrait
}
$note->text = $notes;
$note->save();
- Log::debug(sprintf('Stored notes for journal #%d', $journal->id));
+ app('log')->debug(sprintf('Stored notes for journal #%d', $journal->id));
return;
}
@@ -478,18 +478,18 @@ trait JournalServiceTrait
*/
protected function storeTags(TransactionJournal $journal, ?array $tags): void
{
- Log::debug('Now in storeTags()', $tags ?? []);
+ app('log')->debug('Now in storeTags()', $tags ?? []);
$this->tagFactory->setUser($journal->user);
$set = [];
if (!is_array($tags)) {
- Log::debug('Tags is not an array, break.');
+ app('log')->debug('Tags is not an array, break.');
return;
}
- Log::debug('Start of loop.');
+ app('log')->debug('Start of loop.');
foreach ($tags as $string) {
$string = (string)$string;
- Log::debug(sprintf('Now at tag "%s"', $string));
+ app('log')->debug(sprintf('Now at tag "%s"', $string));
if ('' !== $string) {
$tag = $this->tagFactory->findOrCreate($string);
if (null !== $tag) {
@@ -498,8 +498,8 @@ trait JournalServiceTrait
}
}
$set = array_unique($set);
- Log::debug('End of loop.');
- Log::debug(sprintf('Total nr. of tags: %d', count($tags)), $tags);
+ app('log')->debug('End of loop.');
+ app('log')->debug(sprintf('Total nr. of tags: %d', count($tags)), $tags);
$journal->tags()->sync($set);
}
}
diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php
index 32adb88029..86c99055be 100644
--- a/app/Services/Internal/Support/RecurringTransactionTrait.php
+++ b/app/Services/Internal/Support/RecurringTransactionTrait.php
@@ -107,9 +107,9 @@ trait RecurringTransactionTrait
*/
protected function createTransactions(Recurrence $recurrence, array $transactions): void
{
- Log::debug('Now in createTransactions()');
+ app('log')->debug('Now in createTransactions()');
foreach ($transactions as $index => $array) {
- Log::debug(sprintf('Now at transaction #%d', $index));
+ app('log')->debug(sprintf('Now at transaction #%d', $index));
$sourceTypes = config(sprintf('firefly.expected_source_types.source.%s', $recurrence->transactionType->type));
$destTypes = config(sprintf('firefly.expected_source_types.destination.%s', $recurrence->transactionType->type));
$source = $this->findAccount($sourceTypes, $array['source_id'], null);
@@ -123,7 +123,7 @@ trait RecurringTransactionTrait
$currency = app('amount')->getDefaultCurrencyByUser($recurrence->user);
}
- Log::debug(
+ app('log')->debug(
sprintf('Will set the validator type to %s based on the type of the recurrence (#%d).', $recurrence->transactionType->type, $recurrence->id)
);
@@ -366,7 +366,7 @@ trait RecurringTransactionTrait
*/
protected function deleteTransactions(Recurrence $recurrence): void
{
- Log::debug('deleteTransactions()');
+ app('log')->debug('deleteTransactions()');
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions as $transaction) {
$transaction->recurrenceTransactionMeta()->delete();
diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php
index 5630684833..fbeebf9237 100644
--- a/app/Services/Internal/Update/AccountUpdateService.php
+++ b/app/Services/Internal/Update/AccountUpdateService.php
@@ -75,7 +75,7 @@ class AccountUpdateService
*/
public function update(Account $account, array $data): Account
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$this->accountRepository->setUser($account->user);
$this->user = $account->user;
$account = $this->updateAccount($account, $data);
@@ -198,21 +198,21 @@ class AccountUpdateService
{
// skip if no order info
if (!array_key_exists('order', $data) || $data['order'] === $account->order) {
- Log::debug(sprintf('Account order will not be touched because its not set or already at %d.', $account->order));
+ app('log')->debug(sprintf('Account order will not be touched because its not set or already at %d.', $account->order));
return $account;
}
// skip if not of orderable type.
$type = $account->accountType->type;
if (!in_array($type, [AccountType::ASSET, AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT], true)) {
- Log::debug('Will not change order of this account.');
+ app('log')->debug('Will not change order of this account.');
return $account;
}
// get account type ID's because a join and an update is hard:
$oldOrder = (int)$account->order;
$newOrder = $data['order'];
- Log::debug(sprintf('Order is set to be updated from %s to %s', $oldOrder, $newOrder));
+ app('log')->debug(sprintf('Order is set to be updated from %s to %s', $oldOrder, $newOrder));
$list = $this->getTypeIds([AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT]);
if ($type === AccountType::ASSET) {
$list = $this->getTypeIds([AccountType::ASSET]);
@@ -224,7 +224,7 @@ class AccountUpdateService
->whereIn('accounts.account_type_id', $list)
->decrement('order');
$account->order = $newOrder;
- Log::debug(sprintf('Order of account #%d ("%s") is now %d', $account->id, $account->name, $newOrder));
+ app('log')->debug(sprintf('Order of account #%d ("%s") is now %d', $account->id, $account->name, $newOrder));
$account->save();
return $account;
@@ -235,7 +235,7 @@ class AccountUpdateService
->whereIn('accounts.account_type_id', $list)
->increment('order');
$account->order = $newOrder;
- Log::debug(sprintf('Order of account #%d ("%s") is now %d', $account->id, $account->name, $newOrder));
+ app('log')->debug(sprintf('Order of account #%d ("%s") is now %d', $account->id, $account->name, $newOrder));
$account->save();
return $account;
@@ -341,17 +341,17 @@ class AccountUpdateService
return;
}
$array = $preference->data;
- Log::debug('Old array is: ', $array);
- Log::debug(sprintf('Must remove : %d', $account->id));
+ app('log')->debug('Old array is: ', $array);
+ app('log')->debug(sprintf('Must remove : %d', $account->id));
$removeAccountId = (int)$account->id;
$new = [];
foreach ($array as $value) {
if ((int)$value !== $removeAccountId) {
- Log::debug(sprintf('Will include: %d', $value));
+ app('log')->debug(sprintf('Will include: %d', $value));
$new[] = (int)$value;
}
}
- Log::debug('Final new array is', $new);
+ app('log')->debug('Final new array is', $new);
app('preferences')->setForUser($account->user, 'frontpageAccounts', $new);
}
}
diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php
index 025bdf4f0d..2518a3b26b 100644
--- a/app/Services/Internal/Update/BillUpdateService.php
+++ b/app/Services/Internal/Update/BillUpdateService.php
@@ -214,17 +214,17 @@ class BillUpdateService
*/
private function updateBillTriggers(Bill $bill, array $oldData, array $newData): void
{
- Log::debug(sprintf('Now in updateBillTriggers(%d, "%s")', $bill->id, $bill->name));
+ app('log')->debug(sprintf('Now in updateBillTriggers(%d, "%s")', $bill->id, $bill->name));
/** @var BillRepositoryInterface $repository */
$repository = app(BillRepositoryInterface::class);
$repository->setUser($bill->user);
$rules = $repository->getRulesForBill($bill);
if (0 === $rules->count()) {
- Log::debug('Found no rules.');
+ app('log')->debug('Found no rules.');
return;
}
- Log::debug(sprintf('Found %d rules', $rules->count()));
+ app('log')->debug(sprintf('Found %d rules', $rules->count()));
$fields = [
'name' => 'description_contains',
'amount_min' => 'amount_more',
@@ -236,7 +236,7 @@ class BillUpdateService
continue;
}
if ($oldData[$field] === $newData[$field]) {
- Log::debug(sprintf('Field %s is unchanged ("%s"), continue.', $field, $oldData[$field]));
+ app('log')->debug(sprintf('Field %s is unchanged ("%s"), continue.', $field, $oldData[$field]));
continue;
}
$this->updateRules($rules, $ruleTriggerKey, $oldData[$field], $newData[$field]);
@@ -255,14 +255,14 @@ class BillUpdateService
foreach ($rules as $rule) {
$trigger = $this->getRuleTrigger($rule, $key);
if (null !== $trigger && $trigger->trigger_value === $oldValue) {
- Log::debug(sprintf('Updated rule trigger #%d from value "%s" to value "%s"', $trigger->id, $oldValue, $newValue));
+ app('log')->debug(sprintf('Updated rule trigger #%d from value "%s" to value "%s"', $trigger->id, $oldValue, $newValue));
$trigger->trigger_value = $newValue;
$trigger->save();
continue;
}
if (null !== $trigger && $trigger->trigger_value !== $oldValue && in_array($key, ['amount_more', 'amount_less'], true)
&& 0 === bccomp($trigger->trigger_value, $oldValue)) {
- Log::debug(sprintf('Updated rule trigger #%d from value "%s" to value "%s"', $trigger->id, $oldValue, $newValue));
+ app('log')->debug(sprintf('Updated rule trigger #%d from value "%s" to value "%s"', $trigger->id, $oldValue, $newValue));
$trigger->trigger_value = $newValue;
$trigger->save();
}
diff --git a/app/Services/Internal/Update/CategoryUpdateService.php b/app/Services/Internal/Update/CategoryUpdateService.php
index 0d2cdba3f7..f36dc2d7f9 100644
--- a/app/Services/Internal/Update/CategoryUpdateService.php
+++ b/app/Services/Internal/Update/CategoryUpdateService.php
@@ -94,12 +94,12 @@ class CategoryUpdateService
->whereIn('rule_triggers.trigger_type', $types)
->where('rule_triggers.trigger_value', $oldName)
->get(['rule_triggers.*']);
- Log::debug(sprintf('Found %d triggers to update.', $triggers->count()));
+ app('log')->debug(sprintf('Found %d triggers to update.', $triggers->count()));
/** @var RuleTrigger $trigger */
foreach ($triggers as $trigger) {
$trigger->trigger_value = $newName;
$trigger->save();
- Log::debug(sprintf('Updated trigger %d: %s', $trigger->id, $trigger->trigger_value));
+ app('log')->debug(sprintf('Updated trigger %d: %s', $trigger->id, $trigger->trigger_value));
}
}
@@ -115,12 +115,12 @@ class CategoryUpdateService
->whereIn('rule_actions.action_type', $types)
->where('rule_actions.action_value', $oldName)
->get(['rule_actions.*']);
- Log::debug(sprintf('Found %d actions to update.', $actions->count()));
+ app('log')->debug(sprintf('Found %d actions to update.', $actions->count()));
/** @var RuleAction $action */
foreach ($actions as $action) {
$action->action_value = $newName;
$action->save();
- Log::debug(sprintf('Updated action %d: %s', $action->id, $action->action_value));
+ app('log')->debug(sprintf('Updated action %d: %s', $action->id, $action->action_value));
}
}
diff --git a/app/Services/Internal/Update/GroupUpdateService.php b/app/Services/Internal/Update/GroupUpdateService.php
index a6638acee7..b9e61765c6 100644
--- a/app/Services/Internal/Update/GroupUpdateService.php
+++ b/app/Services/Internal/Update/GroupUpdateService.php
@@ -51,13 +51,13 @@ class GroupUpdateService
*/
public function update(TransactionGroup $transactionGroup, array $data): TransactionGroup
{
- Log::debug(sprintf('Now in %s', __METHOD__));
- Log::debug('Now in group update service', $data);
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug('Now in group update service', $data);
/** @var array $transactions */
$transactions = $data['transactions'] ?? [];
// update group name.
if (array_key_exists('group_title', $data)) {
- Log::debug(sprintf('Update transaction group #%d title.', $transactionGroup->id));
+ app('log')->debug(sprintf('Update transaction group #%d title.', $transactionGroup->id));
$oldTitle = $transactionGroup->title;
$transactionGroup->title = $data['group_title'];
$transactionGroup->save();
@@ -74,7 +74,7 @@ class GroupUpdateService
if (0 === count($transactions)) {
- Log::debug('No transactions submitted, do nothing.');
+ app('log')->debug('No transactions submitted, do nothing.');
return $transactionGroup;
}
@@ -82,7 +82,7 @@ class GroupUpdateService
if (1 === count($transactions) && 1 === $transactionGroup->transactionJournals()->count()) {
/** @var TransactionJournal $first */
$first = $transactionGroup->transactionJournals()->first();
- Log::debug(
+ app('log')->debug(
sprintf('Will now update journal #%d (only journal in group #%d)', $first->id, $transactionGroup->id)
);
$this->updateTransactionJournal($transactionGroup, $first, reset($transactions));
@@ -92,11 +92,11 @@ class GroupUpdateService
return $transactionGroup;
}
- Log::debug('Going to update split group.');
+ app('log')->debug('Going to update split group.');
$existing = $transactionGroup->transactionJournals->pluck('id')->toArray();
$updated = $this->updateTransactions($transactionGroup, $transactions);
- Log::debug('Array of updated IDs: ', $updated);
+ app('log')->debug('Array of updated IDs: ', $updated);
if (0 === count($updated)) {
app('log')->error('There were no transactions updated or created. Will not delete anything.');
@@ -107,7 +107,7 @@ class GroupUpdateService
}
$result = array_diff($existing, $updated);
- Log::debug('Result of DIFF: ', $result);
+ app('log')->debug('Result of DIFF: ', $result);
if (count($result) > 0) {
/** @var string $deletedId */
foreach ($result as $deletedId) {
@@ -137,7 +137,7 @@ class GroupUpdateService
TransactionJournal $journal,
array $data
): void {
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
if (0 === count($data)) {
return;
}
@@ -163,7 +163,7 @@ class GroupUpdateService
*/
private function updateTransactions(TransactionGroup $transactionGroup, array $transactions): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
// updated or created transaction journals:
$updated = [];
/**
@@ -171,28 +171,28 @@ class GroupUpdateService
* @var array $transaction
*/
foreach ($transactions as $index => $transaction) {
- Log::debug(sprintf('Now at #%d of %d', ($index + 1), count($transactions)), $transaction);
+ app('log')->debug(sprintf('Now at #%d of %d', ($index + 1), count($transactions)), $transaction);
$journalId = (int)($transaction['transaction_journal_id'] ?? 0);
/** @var TransactionJournal|null $journal */
$journal = $transactionGroup->transactionJournals()->find($journalId);
if (null === $journal) {
- Log::debug('This entry has no existing journal: make a new split.');
+ app('log')->debug('This entry has no existing journal: make a new split.');
// force the transaction type on the transaction data.
// by plucking it from another journal in the group:
if (!array_key_exists('type', $transaction)) {
- Log::debug('No transaction type is indicated.');
+ app('log')->debug('No transaction type is indicated.');
/** @var TransactionJournal|null $randomJournal */
$randomJournal = $transactionGroup->transactionJournals()->inRandomOrder()->with(
['transactionType']
)->first();
if (null !== $randomJournal) {
$transaction['type'] = $randomJournal->transactionType->type;
- Log::debug(sprintf('Transaction type set to %s.', $transaction['type']));
+ app('log')->debug(sprintf('Transaction type set to %s.', $transaction['type']));
}
}
- Log::debug('Call createTransactionJournal');
+ app('log')->debug('Call createTransactionJournal');
$newJournal = $this->createTransactionJournal($transactionGroup, $transaction);
- Log::debug('Done calling createTransactionJournal');
+ app('log')->debug('Done calling createTransactionJournal');
if (null !== $newJournal) {
$updated[] = $newJournal->id;
}
@@ -201,10 +201,10 @@ class GroupUpdateService
}
}
if (null !== $journal) {
- Log::debug('Call updateTransactionJournal');
+ app('log')->debug('Call updateTransactionJournal');
$this->updateTransactionJournal($transactionGroup, $journal, $transaction);
$updated[] = $journal->id;
- Log::debug('Done calling updateTransactionJournal');
+ app('log')->debug('Done calling updateTransactionJournal');
}
}
diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php
index 6d7e446786..5519c91c89 100644
--- a/app/Services/Internal/Update/JournalUpdateService.php
+++ b/app/Services/Internal/Update/JournalUpdateService.php
@@ -140,8 +140,8 @@ class JournalUpdateService
*/
public function update(): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
- Log::debug(sprintf('Now in JournalUpdateService for journal #%d.', $this->transactionJournal->id));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in JournalUpdateService for journal #%d.', $this->transactionJournal->id));
$this->data['reconciled'] = array_key_exists('reconciled', $this->data) ? $this->data['reconciled'] : false;
@@ -194,7 +194,7 @@ class JournalUpdateService
*/
private function hasValidSourceAccount(): bool
{
- Log::debug('Now in hasValidSourceAccount().');
+ app('log')->debug('Now in hasValidSourceAccount().');
$sourceId = $this->data['source_id'] ?? null;
$sourceName = $this->data['source_name'] ?? null;
@@ -206,7 +206,7 @@ class JournalUpdateService
// make new account validator.
$expectedType = $this->getExpectedType();
- Log::debug(sprintf('Expected type (new or unchanged) is %s', $expectedType));
+ app('log')->debug(sprintf('Expected type (new or unchanged) is %s', $expectedType));
// make a new validator.
/** @var AccountValidator $validator */
@@ -215,7 +215,7 @@ class JournalUpdateService
$validator->setUser($this->transactionJournal->user);
$result = $validator->validateSource(['id' => $sourceId]);
- Log::debug(
+ app('log')->debug(
sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true))
);
@@ -266,7 +266,7 @@ class JournalUpdateService
0
)->first();
}
- Log::debug(sprintf('getSourceTransaction: %s', $this->sourceTransaction->amount));
+ app('log')->debug(sprintf('getSourceTransaction: %s', $this->sourceTransaction->amount));
return $this->sourceTransaction;
}
@@ -282,7 +282,7 @@ class JournalUpdateService
*/
private function getExpectedType(): string
{
- Log::debug('Now in getExpectedType()');
+ app('log')->debug('Now in getExpectedType()');
if ($this->hasFields(['type'])) {
return ucfirst('opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type']);
}
@@ -295,12 +295,12 @@ class JournalUpdateService
*/
private function hasValidDestinationAccount(): bool
{
- Log::debug('Now in hasValidDestinationAccount().');
+ app('log')->debug('Now in hasValidDestinationAccount().');
$destId = $this->data['destination_id'] ?? null;
$destName = $this->data['destination_name'] ?? null;
if (!$this->hasFields(['destination_id', 'destination_name'])) {
- Log::debug('No destination info submitted, grab the original data.');
+ app('log')->debug('No destination info submitted, grab the original data.');
$destination = $this->getOriginalDestinationAccount();
$destId = $destination->id;
$destName = $destination->name;
@@ -308,7 +308,7 @@ class JournalUpdateService
// make new account validator.
$expectedType = $this->getExpectedType();
- Log::debug(sprintf('Expected type (new or unchanged) is %s', $expectedType));
+ app('log')->debug(sprintf('Expected type (new or unchanged) is %s', $expectedType));
// make a new validator.
/** @var AccountValidator $validator */
@@ -317,7 +317,7 @@ class JournalUpdateService
$validator->setUser($this->transactionJournal->user);
$validator->source = $this->getValidSourceAccount();
$result = $validator->validateDestination(['id' => $destId, 'name' => $destName]);
- Log::debug(
+ app('log')->debug(
sprintf(
'hasValidDestinationAccount(%d, "%s") will return %s',
$destId,
@@ -366,7 +366,7 @@ class JournalUpdateService
*/
private function getValidSourceAccount(): Account
{
- Log::debug('Now in getValidSourceAccount().');
+ app('log')->debug('Now in getValidSourceAccount().');
if (!$this->hasFields(['source_id', 'source_name'])) {
return $this->getOriginalSourceAccount();
@@ -389,7 +389,7 @@ class JournalUpdateService
$result = $this->getOriginalSourceAccount();
}
- Log::debug(sprintf('getValidSourceAccount() will return #%d ("%s")', $result->id, $result->name));
+ app('log')->debug(sprintf('getValidSourceAccount() will return #%d ("%s")', $result->id, $result->name));
return $result;
}
@@ -420,8 +420,8 @@ class JournalUpdateService
// refresh transactions.
$this->sourceTransaction->refresh();
$this->destinationTransaction->refresh();
- Log::debug(sprintf('Will set source to #%d ("%s")', $source->id, $source->name));
- Log::debug(sprintf('Will set dest to #%d ("%s")', $destination->id, $destination->name));
+ app('log')->debug(sprintf('Will set source to #%d ("%s")', $source->id, $source->name));
+ app('log')->debug(sprintf('Will set dest to #%d ("%s")', $destination->id, $destination->name));
}
/**
@@ -431,7 +431,7 @@ class JournalUpdateService
*/
private function getValidDestinationAccount(): Account
{
- Log::debug('Now in getValidDestinationAccount().');
+ app('log')->debug('Now in getValidDestinationAccount().');
if (!$this->hasFields(['destination_id', 'destination_name'])) {
return $this->getOriginalDestinationAccount();
@@ -447,7 +447,7 @@ class JournalUpdateService
// make new account validator.
$expectedType = $this->getExpectedType();
- Log::debug(sprintf('Expected type (new or unchanged) is %s', $expectedType));
+ app('log')->debug(sprintf('Expected type (new or unchanged) is %s', $expectedType));
try {
$result = $this->getAccount($expectedType, 'destination', $destInfo);
} catch (FireflyException $e) {
@@ -463,10 +463,10 @@ class JournalUpdateService
*/
private function updateType(): void
{
- Log::debug('Now in updateType()');
+ app('log')->debug('Now in updateType()');
if ($this->hasFields(['type'])) {
$type = 'opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type'];
- Log::debug(
+ app('log')->debug(
sprintf(
'Trying to change journal #%d from a %s to a %s.',
$this->transactionJournal->id,
@@ -479,7 +479,7 @@ class JournalUpdateService
$typeFactory = app(TransactionTypeFactory::class);
$result = $typeFactory->find($this->data['type']);
if (null !== $result) {
- Log::debug('Changed transaction type!');
+ app('log')->debug('Changed transaction type!');
$this->transactionJournal->transaction_type_id = $result->id;
$this->transactionJournal->save();
@@ -488,7 +488,7 @@ class JournalUpdateService
return;
}
- Log::debug('No type field present.');
+ app('log')->debug('No type field present.');
}
/**
@@ -507,7 +507,7 @@ class JournalUpdateService
$billName = (string)($this->data['bill_name'] ?? '');
$bill = $this->billRepository->findBill($billId, $billName);
$this->transactionJournal->bill_id = $bill?->id;
- Log::debug('Updated bill ID');
+ app('log')->debug('Updated bill ID');
}
}
@@ -530,7 +530,7 @@ class JournalUpdateService
$value = new Carbon($value);
}
// do some parsing.
- Log::debug(sprintf('Create date value from string "%s".', $value));
+ app('log')->debug(sprintf('Create date value from string "%s".', $value));
}
event(
new TriggeredAuditLog(
@@ -543,7 +543,7 @@ class JournalUpdateService
);
$this->transactionJournal->$fieldName = $value;
- Log::debug(sprintf('Updated %s', $fieldName));
+ app('log')->debug(sprintf('Updated %s', $fieldName));
}
}
@@ -554,7 +554,7 @@ class JournalUpdateService
{
// update category
if ($this->hasFields(['category_id', 'category_name'])) {
- Log::debug('Will update category.');
+ app('log')->debug('Will update category.');
$this->storeCategory($this->transactionJournal, new NullArrayObject($this->data));
}
@@ -567,7 +567,7 @@ class JournalUpdateService
{
// update budget
if ($this->hasFields(['budget_id', 'budget_name'])) {
- Log::debug('Will update budget.');
+ app('log')->debug('Will update budget.');
$this->storeBudget($this->transactionJournal, new NullArrayObject($this->data));
}
// is transfer? remove budget
@@ -582,7 +582,7 @@ class JournalUpdateService
private function updateTags(): void
{
if ($this->hasFields(['tags'])) {
- Log::debug('Will update tags.');
+ app('log')->debug('Will update tags.');
$tags = $this->data['tags'] ?? null;
$this->storeTags($this->transactionJournal, $tags);
}
@@ -618,13 +618,13 @@ class JournalUpdateService
// update meta fields.
// first string
if ($this->hasFields($this->metaString)) {
- Log::debug('Meta string fields are present.');
+ app('log')->debug('Meta string fields are present.');
$this->updateMetaFields();
}
// then date fields.
if ($this->hasFields($this->metaDate)) {
- Log::debug('Meta date fields are present.');
+ app('log')->debug('Meta date fields are present.');
$this->updateMetaDateFields();
}
}
@@ -640,7 +640,7 @@ class JournalUpdateService
foreach ($this->metaString as $field) {
if ($this->hasFields([$field])) {
$value = '' === $this->data[$field] ? null : $this->data[$field];
- Log::debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
+ app('log')->debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
$set = [
'journal' => $this->transactionJournal,
'name' => $field,
@@ -664,11 +664,11 @@ class JournalUpdateService
try {
$value = '' === (string)$this->data[$field] ? null : new Carbon($this->data[$field]);
} catch (InvalidDateException $e) {
- Log::debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
+ app('log')->debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
return;
}
- Log::debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
+ app('log')->debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
$set = [
'journal' => $this->transactionJournal,
'name' => $field,
@@ -707,7 +707,7 @@ class JournalUpdateService
// refresh transactions.
$this->sourceTransaction->refresh();
$this->destinationTransaction->refresh();
- Log::debug(sprintf('Updated currency to #%d (%s)', $currency->id, $currency->code));
+ app('log')->debug(sprintf('Updated currency to #%d (%s)', $currency->id, $currency->code));
}
}
@@ -716,17 +716,17 @@ class JournalUpdateService
*/
private function updateAmount(): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
if (!$this->hasFields(['amount'])) {
return;
}
$value = $this->data['amount'] ?? '';
- Log::debug(sprintf('Amount is now "%s"', $value));
+ app('log')->debug(sprintf('Amount is now "%s"', $value));
try {
$amount = $this->getAmount($value);
} catch (FireflyException $e) {
- Log::debug(sprintf('getAmount("%s") returns error: %s', $value, $e->getMessage()));
+ app('log')->debug(sprintf('getAmount("%s") returns error: %s', $value, $e->getMessage()));
return;
}
@@ -739,7 +739,7 @@ class JournalUpdateService
// refresh transactions.
$this->sourceTransaction->refresh();
$this->destinationTransaction->refresh();
- Log::debug(sprintf('Updated amount to "%s"', $amount));
+ app('log')->debug(sprintf('Updated amount to "%s"', $amount));
}
/**
@@ -780,7 +780,7 @@ class JournalUpdateService
$dest->foreign_amount = app('steam')->positive($foreignAmount);
$dest->save();
- Log::debug(
+ app('log')->debug(
sprintf(
'Update foreign info to %s (#%d) %s',
$foreignCurrency->code,
@@ -803,7 +803,7 @@ class JournalUpdateService
$dest->foreign_currency_id = null;
$dest->foreign_amount = null;
$dest->save();
- Log::debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount));
+ app('log')->debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount));
}
app('log')->info('Not enough info to update foreign currency info.');
diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.php
index 926882e621..903a09a96b 100644
--- a/app/Services/Internal/Update/RecurrenceUpdateService.php
+++ b/app/Services/Internal/Update/RecurrenceUpdateService.php
@@ -99,7 +99,7 @@ class RecurrenceUpdateService
// update all repetitions
if (array_key_exists('repetitions', $data)) {
- Log::debug('Will update repetitions array');
+ app('log')->debug('Will update repetitions array');
// update each repetition or throw error yay
$this->updateRepetitions($recurrence, $data['repetitions'] ?? []);
}
@@ -148,14 +148,14 @@ class RecurrenceUpdateService
}
// user added or removed repetitions, delete all and recreate:
if ($originalCount !== count($repetitions)) {
- Log::debug('Delete existing repetitions and create new ones.');
+ app('log')->debug('Delete existing repetitions and create new ones.');
$this->deleteRepetitions($recurrence);
$this->createRepetitions($recurrence, $repetitions);
return;
}
// loop all and try to match them:
- Log::debug('Loop and find');
+ app('log')->debug('Loop and find');
foreach ($repetitions as $current) {
$match = $this->matchRepetition($recurrence, $current);
if (null === $match) {
@@ -186,7 +186,7 @@ class RecurrenceUpdateService
{
$originalCount = $recurrence->recurrenceRepetitions()->count();
if (1 === $originalCount) {
- Log::debug('Return the first one');
+ app('log')->debug('Return the first one');
/** @var RecurrenceRepetition|null */
return $recurrence->recurrenceRepetitions()->first();
}
@@ -219,9 +219,9 @@ class RecurrenceUpdateService
*/
private function updateTransactions(Recurrence $recurrence, array $transactions): void
{
- Log::debug('Now in updateTransactions()');
+ app('log')->debug('Now in updateTransactions()');
$originalCount = $recurrence->recurrenceTransactions()->count();
- Log::debug(sprintf('Original count is %d', $originalCount));
+ app('log')->debug(sprintf('Original count is %d', $originalCount));
if (0 === count($transactions)) {
// won't drop transactions, rather avoid.
app('log')->warning('No transactions to update, too scared to continue!');
@@ -235,7 +235,7 @@ class RecurrenceUpdateService
foreach ($originalTransactions as $i => $originalTransaction) {
foreach ($transactions as $ii => $submittedTransaction) {
if (array_key_exists('id', $submittedTransaction) && (int)$originalTransaction['id'] === (int)$submittedTransaction['id']) {
- Log::debug(sprintf('Match original transaction #%d with an entry in the submitted array.', $originalTransaction['id']));
+ app('log')->debug(sprintf('Match original transaction #%d with an entry in the submitted array.', $originalTransaction['id']));
$combinations[] = [
'original' => $originalTransaction,
'submitted' => $submittedTransaction,
@@ -250,7 +250,7 @@ class RecurrenceUpdateService
*/
if (1 === count($originalTransactions) && 1 === count($transactions)) {
$first = array_shift($originalTransactions);
- Log::debug(sprintf('One left of each, link them (ID is #%d)', $first['id']));
+ app('log')->debug(sprintf('One left of each, link them (ID is #%d)', $first['id']));
$combinations[] = [
'original' => $first,
'submitted' => array_shift($transactions),
@@ -265,7 +265,7 @@ class RecurrenceUpdateService
}
// anything left in the original transactions array can be deleted.
foreach ($originalTransactions as $original) {
- Log::debug(sprintf('Original transaction #%d is unmatched, delete it!', $original['id']));
+ app('log')->debug(sprintf('Original transaction #%d is unmatched, delete it!', $original['id']));
$this->deleteTransaction($recurrence, (int)$original['id']);
}
// anything left is new.
@@ -284,7 +284,7 @@ class RecurrenceUpdateService
$submitted = $combination['submitted'];
/** @var RecurrenceTransaction $transaction */
$transaction = $recurrence->recurrenceTransactions()->find($original['id']);
- Log::debug(sprintf('Now in updateCombination(#%d)', $original['id']));
+ app('log')->debug(sprintf('Now in updateCombination(#%d)', $original['id']));
$currencyFactory = app(TransactionCurrencyFactory::class);
@@ -336,13 +336,13 @@ class RecurrenceUpdateService
// reset category if name is set but empty:
// can be removed when v1 is retired.
if (array_key_exists('category_name', $submitted) && '' === (string)$submitted['category_name']) {
- Log::debug('Category name is submitted but is empty. Set category to be empty.');
+ app('log')->debug('Category name is submitted but is empty. Set category to be empty.');
$submitted['category_name'] = null;
$submitted['category_id'] = 0;
}
if (array_key_exists('category_id', $submitted)) {
- Log::debug(sprintf('Category ID is submitted, set category to be %d.', (int)$submitted['category_id']));
+ app('log')->debug(sprintf('Category ID is submitted, set category to be %d.', (int)$submitted['category_id']));
$this->setCategory($transaction, (int)$submitted['category_id']);
}
@@ -362,7 +362,7 @@ class RecurrenceUpdateService
*/
private function deleteTransaction(Recurrence $recurrence, int $transactionId): void
{
- Log::debug(sprintf('Will delete transaction #%d in recurrence #%d.', $transactionId, $recurrence->id));
+ app('log')->debug(sprintf('Will delete transaction #%d in recurrence #%d.', $transactionId, $recurrence->id));
$recurrence->recurrenceTransactions()->where('id', $transactionId)->delete();
}
}
diff --git a/app/Services/Password/PwndVerifierV2.php b/app/Services/Password/PwndVerifierV2.php
index ddd6b16fab..ccc6f575db 100644
--- a/app/Services/Password/PwndVerifierV2.php
+++ b/app/Services/Password/PwndVerifierV2.php
@@ -57,8 +57,8 @@ class PwndVerifierV2 implements Verifier
'timeout' => 3.1415,
];
- Log::debug(sprintf('hash prefix is %s', $prefix));
- Log::debug(sprintf('rest is %s', $rest));
+ app('log')->debug(sprintf('hash prefix is %s', $prefix));
+ app('log')->debug(sprintf('rest is %s', $rest));
try {
$client = new Client();
@@ -68,17 +68,17 @@ class PwndVerifierV2 implements Verifier
return true;
}
- Log::debug(sprintf('Status code returned is %d', $res->getStatusCode()));
+ app('log')->debug(sprintf('Status code returned is %d', $res->getStatusCode()));
if (404 === $res->getStatusCode()) {
return true;
}
$strpos = stripos($res->getBody()->getContents(), $rest);
if (false === $strpos) {
- Log::debug(sprintf('%s was not found in result body. Return true.', $rest));
+ app('log')->debug(sprintf('%s was not found in result body. Return true.', $rest));
return true;
}
- Log::debug(sprintf('Found %s, return FALSE.', $rest));
+ app('log')->debug(sprintf('Found %s, return FALSE.', $rest));
return false;
}
diff --git a/app/Services/Webhook/StandardWebhookSender.php b/app/Services/Webhook/StandardWebhookSender.php
index 16a6b165e7..e80f57ab28 100644
--- a/app/Services/Webhook/StandardWebhookSender.php
+++ b/app/Services/Webhook/StandardWebhookSender.php
@@ -77,7 +77,7 @@ class StandardWebhookSender implements WebhookSenderInterface
return;
}
- Log::debug(sprintf('Trying to send webhook message #%d', $this->message->id));
+ app('log')->debug(sprintf('Trying to send webhook message #%d', $this->message->id));
try {
$json = json_encode($this->message->message, JSON_THROW_ON_ERROR);
@@ -139,9 +139,9 @@ class StandardWebhookSender implements WebhookSenderInterface
$this->message->sent = true;
$this->message->save();
- Log::debug(sprintf('Webhook message #%d was sent. Status code %d', $this->message->id, $res->getStatusCode()));
- Log::debug(sprintf('Webhook request body size: %d bytes', strlen($json)));
- Log::debug(sprintf('Response body: %s', $res->getBody()));
+ app('log')->debug(sprintf('Webhook message #%d was sent. Status code %d', $this->message->id, $res->getStatusCode()));
+ app('log')->debug(sprintf('Webhook request body size: %d bytes', strlen($json)));
+ app('log')->debug(sprintf('Response body: %s', $res->getBody()));
}
/**
diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php
index 98d891a7c2..ad666e35ae 100644
--- a/app/Support/Authentication/RemoteUserGuard.php
+++ b/app/Support/Authentication/RemoteUserGuard.php
@@ -57,7 +57,7 @@ class RemoteUserGuard implements Guard
{
/** @var Request $request */
$request = $app->get('request');
- Log::debug(sprintf('Created RemoteUserGuard for %s "%s"', $request?->getMethod(), $request?->getRequestUri()));
+ app('log')->debug(sprintf('Created RemoteUserGuard for %s "%s"', $request?->getMethod(), $request?->getRequestUri()));
$this->application = $app;
$this->provider = $provider;
$this->user = null;
@@ -68,9 +68,9 @@ class RemoteUserGuard implements Guard
*/
public function authenticate(): void
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
if (null !== $this->user) {
- Log::debug(sprintf('%s is found: #%d, "%s".', get_class($this->user), $this->user->id, $this->user->email));
+ app('log')->debug(sprintf('%s is found: #%d, "%s".', get_class($this->user), $this->user->id, $this->user->email));
return;
}
@@ -79,7 +79,7 @@ class RemoteUserGuard implements Guard
$userID = request()->server($header) ?? null;
if (function_exists('apache_request_headers')) {
- Log::debug('Use apache_request_headers to find user ID.');
+ app('log')->debug('Use apache_request_headers to find user ID.');
$userID = request()->server($header) ?? apache_request_headers()[$header] ?? null;
}
@@ -88,7 +88,7 @@ class RemoteUserGuard implements Guard
throw new FireflyException('The guard header was unexpectedly empty. See the logs.');
}
- Log::debug(sprintf('User ID found in header is "%s"', $userID));
+ app('log')->debug(sprintf('User ID found in header is "%s"', $userID));
/** @var User $retrievedUser */
$retrievedUser = $this->provider->retrieveById($userID);
@@ -109,7 +109,7 @@ class RemoteUserGuard implements Guard
}
}
- Log::debug(sprintf('Result of getting user from provider: %s', $retrievedUser->email));
+ app('log')->debug(sprintf('Result of getting user from provider: %s', $retrievedUser->email));
$this->user = $retrievedUser;
}
@@ -118,7 +118,7 @@ class RemoteUserGuard implements Guard
*/
public function guest(): bool
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
return !$this->check();
}
@@ -127,7 +127,7 @@ class RemoteUserGuard implements Guard
*/
public function check(): bool
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
return !is_null($this->user());
}
@@ -136,10 +136,10 @@ class RemoteUserGuard implements Guard
*/
public function user(): ?User
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
$user = $this->user;
if (null === $user) {
- Log::debug('User is NULL');
+ app('log')->debug('User is NULL');
return null;
}
@@ -151,7 +151,7 @@ class RemoteUserGuard implements Guard
*/
public function hasUser(): bool
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException('Did not implement RemoteUserGuard::hasUser()');
}
@@ -160,7 +160,7 @@ class RemoteUserGuard implements Guard
*/
public function id(): ?User
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
return $this->user;
}
@@ -169,7 +169,7 @@ class RemoteUserGuard implements Guard
*/
public function setUser(Authenticatable $user)
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
$this->user = $user;
}
@@ -178,7 +178,7 @@ class RemoteUserGuard implements Guard
*/
public function validate(array $credentials = [])
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException('Did not implement RemoteUserGuard::validate()');
}
@@ -187,7 +187,7 @@ class RemoteUserGuard implements Guard
*/
public function viaRemember(): bool
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
return false;
}
}
diff --git a/app/Support/Authentication/RemoteUserProvider.php b/app/Support/Authentication/RemoteUserProvider.php
index 73499a7679..fdc588a857 100644
--- a/app/Support/Authentication/RemoteUserProvider.php
+++ b/app/Support/Authentication/RemoteUserProvider.php
@@ -43,7 +43,7 @@ class RemoteUserProvider implements UserProvider
*/
public function retrieveByCredentials(array $credentials)
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException(sprintf('Did not implement %s', __METHOD__));
}
@@ -52,10 +52,10 @@ class RemoteUserProvider implements UserProvider
*/
public function retrieveById($identifier): User
{
- Log::debug(sprintf('Now at %s(%s)', __METHOD__, $identifier));
+ app('log')->debug(sprintf('Now at %s(%s)', __METHOD__, $identifier));
$user = User::where('email', $identifier)->first();
if (null === $user) {
- Log::debug(sprintf('User with email "%s" not found. Will be created.', $identifier));
+ app('log')->debug(sprintf('User with email "%s" not found. Will be created.', $identifier));
$user = User::create(
[
'blocked' => false,
@@ -72,7 +72,7 @@ class RemoteUserProvider implements UserProvider
// make sure the user gets an administration as well.
CreateGroupMemberships::createGroupMembership($user);
}
- Log::debug(sprintf('Going to return user #%d (%s)', $user->id, $user->email));
+ app('log')->debug(sprintf('Going to return user #%d (%s)', $user->id, $user->email));
return $user;
}
@@ -82,7 +82,7 @@ class RemoteUserProvider implements UserProvider
*/
public function retrieveByToken($identifier, $token)
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException(sprintf('A) Did not implement %s', __METHOD__));
}
@@ -91,7 +91,7 @@ class RemoteUserProvider implements UserProvider
*/
public function updateRememberToken(Authenticatable $user, $token)
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException(sprintf('B) Did not implement %s', __METHOD__));
}
@@ -100,7 +100,7 @@ class RemoteUserProvider implements UserProvider
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
- Log::debug(sprintf('Now at %s', __METHOD__));
+ app('log')->debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException(sprintf('C) Did not implement %s', __METHOD__));
}
}
diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php
index 05179903f8..d461bb0bde 100644
--- a/app/Support/Binder/Date.php
+++ b/app/Support/Binder/Date.php
@@ -65,7 +65,7 @@ class Date implements BinderInterface
];
if (array_key_exists($value, $magicWords)) {
$return = $magicWords[$value];
- Log::debug(sprintf('User requests "%s", so will return "%s"', $value, $return));
+ app('log')->debug(sprintf('User requests "%s", so will return "%s"', $value, $return));
return $return;
}
diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.php
index 5d895aa306..2cdf0e97e4 100644
--- a/app/Support/Binder/TagList.php
+++ b/app/Support/Binder/TagList.php
@@ -51,7 +51,7 @@ class TagList implements BinderInterface
->get();
}
$list = array_unique(array_map('\strtolower', explode(',', $value)));
- Log::debug('List of tags is', $list);
+ app('log')->debug('List of tags is', $list);
if (0 === count($list)) {
app('log')->error('Tag list is empty.');
diff --git a/app/Support/Cronjobs/BillWarningCronjob.php b/app/Support/Cronjobs/BillWarningCronjob.php
index 34a44bcb05..30d9ec89f1 100644
--- a/app/Support/Cronjobs/BillWarningCronjob.php
+++ b/app/Support/Cronjobs/BillWarningCronjob.php
@@ -43,7 +43,7 @@ class BillWarningCronjob extends AbstractCronjob
*/
public function fire(): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
/** @var Configuration $config */
$config = app('fireflyconfig')->get('last_bw_job', 0);
$lastTime = (int)$config->data;
diff --git a/app/Support/Cronjobs/RecurringCronjob.php b/app/Support/Cronjobs/RecurringCronjob.php
index 7bfbb811d4..372f2beff4 100644
--- a/app/Support/Cronjobs/RecurringCronjob.php
+++ b/app/Support/Cronjobs/RecurringCronjob.php
@@ -43,7 +43,7 @@ class RecurringCronjob extends AbstractCronjob
*/
public function fire(): void
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
/** @var Configuration $config */
$config = app('fireflyconfig')->get('last_rt_job', 0);
$lastTime = (int)$config->data;
diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php
index 35b9672e0e..f5ac670c91 100644
--- a/app/Support/ExpandedForm.php
+++ b/app/Support/ExpandedForm.php
@@ -102,7 +102,7 @@ class ExpandedForm
try {
$html = view('form.checkbox', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render checkbox(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render checkbox(): %s', $e->getMessage()));
$html = 'Could not render checkbox.';
throw new FireflyException($html, 0, $e);
}
@@ -128,7 +128,7 @@ class ExpandedForm
try {
$html = view('form.date', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render date(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render date(): %s', $e->getMessage()));
$html = 'Could not render date.';
throw new FireflyException($html, 0, $e);
}
@@ -152,7 +152,7 @@ class ExpandedForm
try {
$html = view('form.file', compact('classes', 'name', 'label', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render file(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render file(): %s', $e->getMessage()));
$html = 'Could not render file.';
throw new FireflyException($html, 0, $e);
}
@@ -179,7 +179,7 @@ class ExpandedForm
try {
$html = view('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render integer(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render integer(): %s', $e->getMessage()));
$html = 'Could not render integer.';
throw new FireflyException($html, 0, $e);
}
@@ -205,7 +205,7 @@ class ExpandedForm
try {
$html = view('form.location', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render location(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render location(): %s', $e->getMessage()));
$html = 'Could not render location.';
throw new FireflyException($html, 0, $e);
}
@@ -265,7 +265,7 @@ class ExpandedForm
try {
$html = view('form.object_group', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render objectGroup(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render objectGroup(): %s', $e->getMessage()));
$html = 'Could not render objectGroup.';
throw new FireflyException($html, 0, $e);
}
@@ -285,7 +285,7 @@ class ExpandedForm
try {
$html = view('form.options', compact('type', 'name'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render select(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render select(): %s', $e->getMessage()));
$html = 'Could not render optionsList.';
throw new FireflyException($html, 0, $e);
}
@@ -308,7 +308,7 @@ class ExpandedForm
try {
$html = view('form.password', compact('classes', 'name', 'label', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render password(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render password(): %s', $e->getMessage()));
$html = 'Could not render password.';
throw new FireflyException($html, 0, $e);
}
@@ -337,7 +337,7 @@ class ExpandedForm
try {
$html = view('form.percentage', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render percentage(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render percentage(): %s', $e->getMessage()));
$html = 'Could not render percentage.';
throw new FireflyException($html, 0, $e);
}
@@ -361,7 +361,7 @@ class ExpandedForm
try {
$html = view('form.static', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render staticText(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render staticText(): %s', $e->getMessage()));
$html = 'Could not render staticText.';
throw new FireflyException($html, 0, $e);
}
@@ -386,7 +386,7 @@ class ExpandedForm
try {
$html = view('form.text', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render text(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render text(): %s', $e->getMessage()));
$html = 'Could not render text.';
throw new FireflyException($html, 0, $e);
}
@@ -417,7 +417,7 @@ class ExpandedForm
try {
$html = view('form.textarea', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render textarea(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render textarea(): %s', $e->getMessage()));
$html = 'Could not render textarea.';
throw new FireflyException($html, 0, $e);
}
diff --git a/app/Support/Form/AccountForm.php b/app/Support/Form/AccountForm.php
index 0710bb6967..ef2cfce622 100644
--- a/app/Support/Form/AccountForm.php
+++ b/app/Support/Form/AccountForm.php
@@ -147,7 +147,7 @@ class AccountForm
try {
$html = view('form.assetAccountCheckList', compact('classes', 'selected', 'name', 'label', 'options', 'grouped'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render assetAccountCheckList(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render assetAccountCheckList(): %s', $e->getMessage()));
$html = 'Could not render assetAccountCheckList.';
throw new FireflyException($html, 0, $e);
}
diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php
index 0fc4487edd..7dc0875150 100644
--- a/app/Support/Form/CurrencyForm.php
+++ b/app/Support/Form/CurrencyForm.php
@@ -82,13 +82,13 @@ class CurrencyForm
$key = 'amount_currency_id_' . $name;
$sentCurrencyId = array_key_exists($key, $preFilled) ? (int)$preFilled[$key] : $defaultCurrency->id;
- Log::debug(sprintf('Sent currency ID is %d', $sentCurrencyId));
+ app('log')->debug(sprintf('Sent currency ID is %d', $sentCurrencyId));
// find this currency in set of currencies:
foreach ($currencies as $currency) {
if ($currency->id === $sentCurrencyId) {
$defaultCurrency = $currency;
- Log::debug(sprintf('default currency is now %s', $defaultCurrency->code));
+ app('log')->debug(sprintf('default currency is now %s', $defaultCurrency->code));
break;
}
}
@@ -100,7 +100,7 @@ class CurrencyForm
try {
$html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
$html = 'Could not render currencyField.';
throw new FireflyException($html, 0, $e);
}
@@ -154,13 +154,13 @@ class CurrencyForm
$key = 'amount_currency_id_' . $name;
$sentCurrencyId = array_key_exists($key, $preFilled) ? (int)$preFilled[$key] : $defaultCurrency->id;
- Log::debug(sprintf('Sent currency ID is %d', $sentCurrencyId));
+ app('log')->debug(sprintf('Sent currency ID is %d', $sentCurrencyId));
// find this currency in set of currencies:
foreach ($currencies as $currency) {
if ($currency->id === $sentCurrencyId) {
$defaultCurrency = $currency;
- Log::debug(sprintf('default currency is now %s', $defaultCurrency->code));
+ app('log')->debug(sprintf('default currency is now %s', $defaultCurrency->code));
break;
}
}
@@ -172,7 +172,7 @@ class CurrencyForm
try {
$html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
$html = 'Could not render currencyField.';
throw new FireflyException($html, 0, $e);
}
diff --git a/app/Support/Form/FormSupport.php b/app/Support/Form/FormSupport.php
index e37ef14d38..7c68a06366 100644
--- a/app/Support/Form/FormSupport.php
+++ b/app/Support/Form/FormSupport.php
@@ -54,7 +54,7 @@ trait FormSupport
try {
$html = view('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Could not render select(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Could not render select(): %s', $e->getMessage()));
$html = 'Could not render select.';
}
diff --git a/app/Support/Http/Controllers/ChartGeneration.php b/app/Support/Http/Controllers/ChartGeneration.php
index bfb84f7937..d7954e87fe 100644
--- a/app/Support/Http/Controllers/ChartGeneration.php
+++ b/app/Support/Http/Controllers/ChartGeneration.php
@@ -60,7 +60,7 @@ trait ChartGeneration
if ($cache->has()) {
return $cache->get();
}
- Log::debug('Regenerate chart.account.account-balance-chart from scratch.');
+ app('log')->debug('Regenerate chart.account.account-balance-chart from scratch.');
$locale = app('steam')->getLocale();
/** @var GeneratorInterface $generator */
$generator = app(GeneratorInterface::class);
diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.php
index 0cfe7b8019..2039e9f279 100644
--- a/app/Support/Http/Controllers/GetConfigurationData.php
+++ b/app/Support/Http/Controllers/GetConfigurationData.php
@@ -80,7 +80,7 @@ trait GetConfigurationData
$steps[] = $currentStep;
}
}
- Log::debug(sprintf('Total basic steps for %s is %d', $routeKey, count($steps)));
+ app('log')->debug(sprintf('Total basic steps for %s is %d', $routeKey, count($steps)));
return $steps;
}
@@ -210,7 +210,7 @@ trait GetConfigurationData
}
}
}
- Log::debug(sprintf('Total specific steps for route "%s" and page "%s" (routeKey is "%s") is %d', $route, $specificPage, $routeKey, count($steps)));
+ app('log')->debug(sprintf('Total specific steps for route "%s" and page "%s" (routeKey is "%s") is %d', $route, $specificPage, $routeKey, count($steps)));
return $steps;
}
@@ -223,7 +223,7 @@ trait GetConfigurationData
$config = app('fireflyconfig')->get('last_rt_job', 0);
$lastTime = (int)$config->data;
$now = time();
- Log::debug(sprintf('verifyRecurringCronJob: last time is %d ("%s"), now is %d', $lastTime, $config->data, $now));
+ app('log')->debug(sprintf('verifyRecurringCronJob: last time is %d ("%s"), now is %d', $lastTime, $config->data, $now));
if (0 === $lastTime) {
request()->session()->flash('info', trans('firefly.recurring_never_cron'));
diff --git a/app/Support/Http/Controllers/ModelInformation.php b/app/Support/Http/Controllers/ModelInformation.php
index f354287207..3dc7953cf7 100644
--- a/app/Support/Http/Controllers/ModelInformation.php
+++ b/app/Support/Http/Controllers/ModelInformation.php
@@ -147,8 +147,8 @@ trait ModelInformation
]
)->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
- Log::debug($e->getTraceAsString());
+ app('log')->debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
+ app('log')->debug($e->getTraceAsString());
$string = '';
throw new FireflyException('Could not render trigger', 0, $e);
}
@@ -263,8 +263,8 @@ trait ModelInformation
]
)->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
- Log::debug($e->getTraceAsString());
+ app('log')->debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
+ app('log')->debug($e->getTraceAsString());
$string = '';
throw new FireflyException('Could not render trigger', 0, $e);
}
diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php
index 8bdacc157d..f8f0ec223f 100644
--- a/app/Support/Http/Controllers/PeriodOverview.php
+++ b/app/Support/Http/Controllers/PeriodOverview.php
@@ -409,14 +409,14 @@ trait PeriodOverview
*/
protected function getNoCategoryPeriodOverview(Carbon $theDate): array
{
- Log::debug(sprintf('Now in getNoCategoryPeriodOverview(%s)', $theDate->format('Y-m-d')));
+ app('log')->debug(sprintf('Now in getNoCategoryPeriodOverview(%s)', $theDate->format('Y-m-d')));
$range = app('navigation')->getViewRange(true);
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon() : $first->date;
$end = clone $theDate;
- Log::debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d')));
- Log::debug(sprintf('End for getNoCategoryPeriodOverview() is %s', $end->format('Y-m-d')));
+ app('log')->debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d')));
+ app('log')->debug(sprintf('End for getNoCategoryPeriodOverview() is %s', $end->format('Y-m-d')));
// properties for cache
$dates = app('navigation')->blockPeriods($start, $end, $range);
@@ -462,7 +462,7 @@ trait PeriodOverview
'transferred' => $this->groupByCurrency($transferred),
];
}
- Log::debug('End of loops');
+ app('log')->debug('End of loops');
return $entries;
}
diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php
index 3d82ce0d70..325b11683b 100644
--- a/app/Support/Http/Controllers/RenderPartialViews.php
+++ b/app/Support/Http/Controllers/RenderPartialViews.php
@@ -292,7 +292,7 @@ trait RenderPartialViews
]
)->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Could not render: %s', $e->getMessage()), 0, $e);
}
@@ -347,7 +347,7 @@ trait RenderPartialViews
]
)->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Could not render: %s', $e->getMessage()), 0, $e);
}
diff --git a/app/Support/Http/Controllers/RequestInformation.php b/app/Support/Http/Controllers/RequestInformation.php
index 28780e340f..f4e9914b62 100644
--- a/app/Support/Http/Controllers/RequestInformation.php
+++ b/app/Support/Http/Controllers/RequestInformation.php
@@ -173,7 +173,7 @@ trait RequestInformation
try {
$attributes['startDate'] = Carbon::createFromFormat('Ymd', $attributes['startDate'])->startOfDay();
} catch (InvalidArgumentException $e) {
- Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Not important error message: %s', $e->getMessage()));
$date = today(config('app.timezone'))->startOfMonth();
$attributes['startDate'] = $date;
}
@@ -181,7 +181,7 @@ trait RequestInformation
try {
$attributes['endDate'] = Carbon::createFromFormat('Ymd', $attributes['endDate'])->endOfDay();
} catch (InvalidArgumentException $e) {
- Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Not important error message: %s', $e->getMessage()));
$date = today(config('app.timezone'))->startOfMonth();
$attributes['endDate'] = $date;
}
diff --git a/app/Support/Http/Controllers/RuleManagement.php b/app/Support/Http/Controllers/RuleManagement.php
index 5742a45cec..885d37a8fb 100644
--- a/app/Support/Http/Controllers/RuleManagement.php
+++ b/app/Support/Http/Controllers/RuleManagement.php
@@ -107,7 +107,7 @@ trait RuleManagement
]
)->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Could not render: %s', $e->getMessage()), 0, $e);
}
@@ -152,7 +152,7 @@ trait RuleManagement
]
)->render();
} catch (Throwable $e) {
- Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
+ app('log')->debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Could not render: %s', $e->getMessage()), 0, $e);
}
diff --git a/app/Support/Http/Controllers/UserNavigation.php b/app/Support/Http/Controllers/UserNavigation.php
index 1345f81471..ad9d5e524e 100644
--- a/app/Support/Http/Controllers/UserNavigation.php
+++ b/app/Support/Http/Controllers/UserNavigation.php
@@ -53,9 +53,9 @@ trait UserNavigation
*/
final protected function getPreviousUrl(string $identifier): string
{
- Log::debug(sprintf('Trying to retrieve URL stored under "%s"', $identifier));
+ app('log')->debug(sprintf('Trying to retrieve URL stored under "%s"', $identifier));
$url = (string)session($identifier);
- Log::debug(sprintf('The URL is %s', $url));
+ app('log')->debug(sprintf('The URL is %s', $url));
return app('steam')->getSafeUrl($url, route('index'));
}
@@ -166,7 +166,7 @@ trait UserNavigation
$return = app('steam')->getSafePreviousUrl();
session()->put($identifier, $return);
- Log::debug(sprintf('rememberPreviousUrl: %s: "%s"', $identifier, $return));
+ app('log')->debug(sprintf('rememberPreviousUrl: %s: "%s"', $identifier, $return));
return $return;
}
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index c71fd96d7c..66a875a098 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -116,7 +116,7 @@ class Navigation
app('log')->error($exception->getMessage(), ['exception' => $exception]);
}
- Log::debug(
+ app('log')->debug(
'Any error occurred to calculate the next date.',
['date' => $epoch, 'periodicity' => $periodicity->name, 'skipInterval' => $skipInterval]
);
@@ -788,7 +788,7 @@ class Navigation
*/
public function updateEndDate(string $range, Carbon $start): Carbon
{
- Log::debug(sprintf('updateEndDate("%s", "%s")', $range, $start->format('Y-m-d')));
+ app('log')->debug(sprintf('updateEndDate("%s", "%s")', $range, $start->format('Y-m-d')));
$functionMap = [
'1D' => 'endOfDay',
'1W' => 'endOfWeek',
@@ -834,7 +834,7 @@ class Navigation
if (in_array($range, $list, true)) {
$end = today(config('app.timezone'));
$end->endOfDay();
- Log::debug(sprintf('updateEndDate returns "%s"', $end->format('Y-m-d')));
+ app('log')->debug(sprintf('updateEndDate returns "%s"', $end->format('Y-m-d')));
return $end;
}
@@ -851,7 +851,7 @@ class Navigation
*/
public function updateStartDate(string $range, Carbon $start): Carbon
{
- Log::debug(sprintf('updateStartDate("%s", "%s")', $range, $start->format('Y-m-d')));
+ app('log')->debug(sprintf('updateStartDate("%s", "%s")', $range, $start->format('Y-m-d')));
$functionMap = [
'1D' => 'startOfDay',
'1W' => 'startOfWeek',
diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php
index aff5fb58e5..e3d096c5e2 100644
--- a/app/Support/ParseDateString.php
+++ b/app/Support/ParseDateString.php
@@ -80,7 +80,7 @@ class ParseDateString
*/
public function parseDate(string $date): Carbon
{
- Log::debug(sprintf('parseDate("%s")', $date));
+ app('log')->debug(sprintf('parseDate("%s")', $date));
$date = strtolower($date);
// parse keywords:
if (in_array($date, $this->keywords, true)) {
@@ -108,7 +108,7 @@ class ParseDateString
// maybe a date range
if (10 === strlen($date) && (str_contains($date, 'xx') || str_contains($date, 'xxxx'))) {
- Log::debug(sprintf('[c] Detected a date range ("%s"), return a fake date.', $date));
+ app('log')->debug(sprintf('[c] Detected a date range ("%s"), return a fake date.', $date));
// very lazy way to parse the date without parsing it, because this specific function
// cant handle date ranges.
return new Carbon('1984-09-17');
@@ -162,7 +162,7 @@ class ParseDateString
*/
protected function parseRelativeDate(string $date): Carbon
{
- Log::debug(sprintf('Now in parseRelativeDate("%s")', $date));
+ app('log')->debug(sprintf('Now in parseRelativeDate("%s")', $date));
$parts = explode(' ', $date);
$today = today(config('app.timezone'))->startOfDay();
$functions = [
@@ -183,7 +183,7 @@ class ParseDateString
];
foreach ($parts as $part) {
- Log::debug(sprintf('Now parsing part "%s"', $part));
+ app('log')->debug(sprintf('Now parsing part "%s"', $part));
$part = trim($part);
// verify if correct
@@ -201,9 +201,9 @@ class ParseDateString
continue;
}
$func = $functions[$direction][$period];
- Log::debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d')));
+ app('log')->debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d')));
$today->$func($number);
- Log::debug(sprintf('Resulting date is %s', $today->format('Y-m-d')));
+ app('log')->debug(sprintf('Resulting date is %s', $today->format('Y-m-d')));
}
return $today;
@@ -256,11 +256,11 @@ class ParseDateString
// if regex for xxxx-xx-DD:
$pattern = '/^xxxx-xx-(0[1-9]|[12]\d|3[01])$/';
if (preg_match($pattern, $date)) {
- Log::debug(sprintf('"%s" is a day range.', $date));
+ app('log')->debug(sprintf('"%s" is a day range.', $date));
return true;
}
- Log::debug(sprintf('"%s" is not a day range.', $date));
+ app('log')->debug(sprintf('"%s" is not a day range.', $date));
return false;
}
@@ -291,11 +291,11 @@ class ParseDateString
// if regex for xxxx-MM-xx:
$pattern = '/^xxxx-(0[1-9]|1[012])-xx$/';
if (preg_match($pattern, $date)) {
- Log::debug(sprintf('"%s" is a month range.', $date));
+ app('log')->debug(sprintf('"%s" is a month range.', $date));
return true;
}
- Log::debug(sprintf('"%s" is not a month range.', $date));
+ app('log')->debug(sprintf('"%s" is not a month range.', $date));
return false;
}
@@ -309,7 +309,7 @@ class ParseDateString
*/
protected function parseMonthRange(string $date): array
{
- Log::debug(sprintf('parseMonthRange: Parsed "%s".', $date));
+ app('log')->debug(sprintf('parseMonthRange: Parsed "%s".', $date));
$parts = explode('-', $date);
return [
@@ -327,11 +327,11 @@ class ParseDateString
// if regex for YYYY-xx-xx:
$pattern = '/^(19|20)\d\d-xx-xx$/';
if (preg_match($pattern, $date)) {
- Log::debug(sprintf('"%s" is a year range.', $date));
+ app('log')->debug(sprintf('"%s" is a year range.', $date));
return true;
}
- Log::debug(sprintf('"%s" is not a year range.', $date));
+ app('log')->debug(sprintf('"%s" is not a year range.', $date));
return false;
}
@@ -345,7 +345,7 @@ class ParseDateString
*/
protected function parseYearRange(string $date): array
{
- Log::debug(sprintf('parseYearRange: Parsed "%s"', $date));
+ app('log')->debug(sprintf('parseYearRange: Parsed "%s"', $date));
$parts = explode('-', $date);
return [
@@ -363,11 +363,11 @@ class ParseDateString
// if regex for xxxx-MM-DD:
$pattern = '/^xxxx-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
if (preg_match($pattern, $date)) {
- Log::debug(sprintf('"%s" is a month/day range.', $date));
+ app('log')->debug(sprintf('"%s" is a month/day range.', $date));
return true;
}
- Log::debug(sprintf('"%s" is not a month/day range.', $date));
+ app('log')->debug(sprintf('"%s" is not a month/day range.', $date));
return false;
}
@@ -381,7 +381,7 @@ class ParseDateString
*/
private function parseMonthDayRange(string $date): array
{
- Log::debug(sprintf('parseMonthDayRange: Parsed "%s".', $date));
+ app('log')->debug(sprintf('parseMonthDayRange: Parsed "%s".', $date));
$parts = explode('-', $date);
return [
@@ -400,11 +400,11 @@ class ParseDateString
// if regex for YYYY-xx-DD:
$pattern = '/^(19|20)\d\d-xx-(0[1-9]|[12]\d|3[01])$/';
if (preg_match($pattern, $date)) {
- Log::debug(sprintf('"%s" is a day/year range.', $date));
+ app('log')->debug(sprintf('"%s" is a day/year range.', $date));
return true;
}
- Log::debug(sprintf('"%s" is not a day/year range.', $date));
+ app('log')->debug(sprintf('"%s" is not a day/year range.', $date));
return false;
}
@@ -418,7 +418,7 @@ class ParseDateString
*/
private function parseDayYearRange(string $date): array
{
- Log::debug(sprintf('parseDayYearRange: Parsed "%s".', $date));
+ app('log')->debug(sprintf('parseDayYearRange: Parsed "%s".', $date));
$parts = explode('-', $date);
return [
@@ -437,11 +437,11 @@ class ParseDateString
// if regex for YYYY-MM-xx:
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-xx$/';
if (preg_match($pattern, $date)) {
- Log::debug(sprintf('"%s" is a month/year range.', $date));
+ app('log')->debug(sprintf('"%s" is a month/year range.', $date));
return true;
}
- Log::debug(sprintf('"%s" is not a month/year range.', $date));
+ app('log')->debug(sprintf('"%s" is not a month/year range.', $date));
return false;
}
@@ -455,7 +455,7 @@ class ParseDateString
*/
protected function parseMonthYearRange(string $date): array
{
- Log::debug(sprintf('parseMonthYearRange: Parsed "%s".', $date));
+ app('log')->debug(sprintf('parseMonthYearRange: Parsed "%s".', $date));
$parts = explode('-', $date);
return [
diff --git a/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php b/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php
index 89588bd41b..7103727a42 100644
--- a/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php
+++ b/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php
@@ -140,30 +140,30 @@ trait CalculateRangeOccurrences
{
$return = [];
$attempts = 0;
- Log::debug('Rep is weekly.');
+ app('log')->debug('Rep is weekly.');
// monday = 1
// sunday = 7
$dayOfWeek = (int)$moment;
- Log::debug(sprintf('DoW in repetition is %d, in mutator is %d', $dayOfWeek, $start->dayOfWeekIso));
+ app('log')->debug(sprintf('DoW in repetition is %d, in mutator is %d', $dayOfWeek, $start->dayOfWeekIso));
if ($start->dayOfWeekIso > $dayOfWeek) {
// day has already passed this week, add one week:
$start->addWeek();
- Log::debug(sprintf('Jump to next week, so mutator is now: %s', $start->format('Y-m-d')));
+ app('log')->debug(sprintf('Jump to next week, so mutator is now: %s', $start->format('Y-m-d')));
}
// today is wednesday (3), expected is friday (5): add two days.
// today is friday (5), expected is monday (1), subtract four days.
- Log::debug(sprintf('Mutator is now: %s', $start->format('Y-m-d')));
+ app('log')->debug(sprintf('Mutator is now: %s', $start->format('Y-m-d')));
$dayDifference = $dayOfWeek - $start->dayOfWeekIso;
$start->addDays($dayDifference);
- Log::debug(sprintf('Mutator is now: %s', $start->format('Y-m-d')));
+ app('log')->debug(sprintf('Mutator is now: %s', $start->format('Y-m-d')));
while ($start <= $end) {
if (0 === $attempts % $skipMod && $start->lte($start) && $end->gte($start)) {
- Log::debug('Date is in range of start+end, add to set.');
+ app('log')->debug('Date is in range of start+end, add to set.');
$return[] = clone $start;
}
$attempts++;
$start->addWeek();
- Log::debug(sprintf('Mutator is now (end of loop): %s', $start->format('Y-m-d')));
+ app('log')->debug(sprintf('Mutator is now (end of loop): %s', $start->format('Y-m-d')));
}
return $return;
diff --git a/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php b/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php
index f4c52b5580..16e79a15e8 100644
--- a/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php
+++ b/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php
@@ -45,7 +45,7 @@ trait CalculateXOccurrencesSince
*/
protected function getXDailyOccurrencesSince(Carbon $date, Carbon $afterDate, int $count, int $skipMod): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$return = [];
$mutator = clone $date;
$total = 0;
@@ -76,7 +76,7 @@ trait CalculateXOccurrencesSince
*/
protected function getXMonthlyOccurrencesSince(Carbon $date, Carbon $afterDate, int $count, int $skipMod, string $moment): array
{
- Log::debug(sprintf('Now in %s(%s, %s, %d)', __METHOD__, $date->format('Y-m-d'), $afterDate->format('Y-m-d'), $count));
+ app('log')->debug(sprintf('Now in %s(%s, %s, %d)', __METHOD__, $date->format('Y-m-d'), $afterDate->format('Y-m-d'), $count));
$return = [];
$mutator = clone $date;
$total = 0;
@@ -84,10 +84,10 @@ trait CalculateXOccurrencesSince
$dayOfMonth = (int)$moment;
$dayOfMonth = 0 === $dayOfMonth ? 1 : $dayOfMonth;
if ($mutator->day > $dayOfMonth) {
- Log::debug(sprintf('%d is after %d, add a month. Mutator is now', $mutator->day, $dayOfMonth));
+ app('log')->debug(sprintf('%d is after %d, add a month. Mutator is now', $mutator->day, $dayOfMonth));
// day has passed already, add a month.
$mutator->addMonth();
- Log::debug(sprintf('%s', $mutator->format('Y-m-d')));
+ app('log')->debug(sprintf('%s', $mutator->format('Y-m-d')));
}
while ($total < $count) {
@@ -99,7 +99,7 @@ trait CalculateXOccurrencesSince
}
$attempts++;
$mutator = $mutator->endOfMonth()->addDay();
- Log::debug(sprintf('Mutator is now %s', $mutator->format('Y-m-d')));
+ app('log')->debug(sprintf('Mutator is now %s', $mutator->format('Y-m-d')));
}
return $return;
@@ -119,7 +119,7 @@ trait CalculateXOccurrencesSince
*/
protected function getXNDomOccurrencesSince(Carbon $date, Carbon $afterDate, int $count, int $skipMod, string $moment): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$return = [];
$total = 0;
$attempts = 0;
@@ -159,7 +159,7 @@ trait CalculateXOccurrencesSince
*/
protected function getXWeeklyOccurrencesSince(Carbon $date, Carbon $afterDate, int $count, int $skipMod, string $moment): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
$return = [];
$total = 0;
$attempts = 0;
@@ -204,7 +204,7 @@ trait CalculateXOccurrencesSince
*/
protected function getXYearlyOccurrencesSince(Carbon $date, Carbon $afterDate, int $count, int $skipMod, string $moment): array
{
- Log::debug(sprintf('Now in %s(%s, %d, %d, %s)', __METHOD__, $date->format('Y-m-d'), $date->format('Y-m-d'), $count, $skipMod));
+ app('log')->debug(sprintf('Now in %s(%s, %d, %d, %s)', __METHOD__, $date->format('Y-m-d'), $date->format('Y-m-d'), $count, $skipMod));
$return = [];
$mutator = clone $date;
$total = 0;
@@ -212,19 +212,19 @@ trait CalculateXOccurrencesSince
$date = new Carbon($moment);
$date->year = $mutator->year;
if ($mutator > $date) {
- Log::debug(
+ app('log')->debug(
sprintf('mutator (%s) > date (%s), so add a year to date (%s)', $mutator->format('Y-m-d'), $date->format('Y-m-d'), $date->format('Y-m-d'))
);
$date->addYear();
- Log::debug(sprintf('Date is now %s', $date->format('Y-m-d')));
+ app('log')->debug(sprintf('Date is now %s', $date->format('Y-m-d')));
}
$obj = clone $date;
while ($total < $count) {
- Log::debug(sprintf('total (%d) < count (%d) so go.', $total, $count));
- Log::debug(sprintf('attempts (%d) %% skipmod (%d) === %d', $attempts, $skipMod, $attempts % $skipMod));
- Log::debug(sprintf('Obj (%s) gte afterdate (%s)? %s', $obj->format('Y-m-d'), $afterDate->format('Y-m-d'), var_export($obj->gte($afterDate), true)));
+ app('log')->debug(sprintf('total (%d) < count (%d) so go.', $total, $count));
+ app('log')->debug(sprintf('attempts (%d) %% skipmod (%d) === %d', $attempts, $skipMod, $attempts % $skipMod));
+ app('log')->debug(sprintf('Obj (%s) gte afterdate (%s)? %s', $obj->format('Y-m-d'), $afterDate->format('Y-m-d'), var_export($obj->gte($afterDate), true)));
if (0 === $attempts % $skipMod && $obj->gte($afterDate)) {
- Log::debug('All conditions true, add obj.');
+ app('log')->debug('All conditions true, add obj.');
$return[] = clone $obj;
$total++;
}
diff --git a/app/Support/Repositories/Recurring/FiltersWeekends.php b/app/Support/Repositories/Recurring/FiltersWeekends.php
index 58da6897ba..f8168f94b9 100644
--- a/app/Support/Repositories/Recurring/FiltersWeekends.php
+++ b/app/Support/Repositories/Recurring/FiltersWeekends.php
@@ -45,9 +45,9 @@ trait FiltersWeekends
*/
protected function filterWeekends(RecurrenceRepetition $repetition, array $dates): array
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
if ((int)$repetition->weekend === RecurrenceRepetition::WEEKEND_DO_NOTHING) {
- Log::debug('Repetition will not be filtered on weekend days.');
+ app('log')->debug('Repetition will not be filtered on weekend days.');
return $dates;
}
@@ -57,7 +57,7 @@ trait FiltersWeekends
$isWeekend = $date->isWeekend();
if (!$isWeekend) {
$return[] = clone $date;
- //Log::debug(sprintf('Date is %s, not a weekend date.', $date->format('D d M Y')));
+ //app('log')->debug(sprintf('Date is %s, not a weekend date.', $date->format('D d M Y')));
continue;
}
@@ -65,7 +65,7 @@ trait FiltersWeekends
if ($repetition->weekend === RecurrenceRepetition::WEEKEND_TO_FRIDAY) {
$clone = clone $date;
$clone->addDays(5 - $date->dayOfWeekIso);
- Log::debug(
+ app('log')->debug(
sprintf('Date is %s, and this is in the weekend, so corrected to %s (Friday).', $date->format('D d M Y'), $clone->format('D d M Y'))
);
$return[] = clone $clone;
@@ -76,22 +76,22 @@ trait FiltersWeekends
if ($repetition->weekend === RecurrenceRepetition::WEEKEND_TO_MONDAY) {
$clone = clone $date;
$clone->addDays(8 - $date->dayOfWeekIso);
- Log::debug(
+ app('log')->debug(
sprintf('Date is %s, and this is in the weekend, so corrected to %s (Monday).', $date->format('D d M Y'), $clone->format('D d M Y'))
);
$return[] = $clone;
continue;
}
- //Log::debug(sprintf('Date is %s, removed from final result', $date->format('D d M Y')));
+ //app('log')->debug(sprintf('Date is %s, removed from final result', $date->format('D d M Y')));
}
// filter unique dates
- Log::debug(sprintf('Count before filtering: %d', count($dates)));
+ app('log')->debug(sprintf('Count before filtering: %d', count($dates)));
$collection = new Collection($return);
$filtered = $collection->unique();
$return = $filtered->toArray();
- Log::debug(sprintf('Count after filtering: %d', count($return)));
+ app('log')->debug(sprintf('Count after filtering: %d', count($return)));
return $return;
}
diff --git a/app/Support/Request/AppendsLocationData.php b/app/Support/Request/AppendsLocationData.php
index 5d126ffb17..885ebe1195 100644
--- a/app/Support/Request/AppendsLocationData.php
+++ b/app/Support/Request/AppendsLocationData.php
@@ -50,7 +50,7 @@ trait AppendsLocationData
*/
protected function appendLocationData(array $data, ?string $prefix): array
{
- Log::debug(sprintf('Now in appendLocationData("%s")', $prefix), $data);
+ app('log')->debug(sprintf('Now in appendLocationData("%s")', $prefix), $data);
$data['store_location'] = false;
$data['update_location'] = false;
$data['remove_location'] = false;
@@ -67,7 +67,7 @@ trait AppendsLocationData
// for a POST (store), all fields must be present and not NULL.
if ($isValidPOST) {
- Log::debug('Method is POST and all fields present and not NULL.');
+ app('log')->debug('Method is POST and all fields present and not NULL.');
$data['store_location'] = true;
$data['longitude'] = $this->convertString($longitudeKey);
$data['latitude'] = $this->convertString($latitudeKey);
@@ -76,18 +76,18 @@ trait AppendsLocationData
// for a PUT (api update) or POST update (UI)
if ($isValidPUT) {
- Log::debug('Method is PUT and all fields present and not NULL.');
+ app('log')->debug('Method is PUT and all fields present and not NULL.');
$data['update_location'] = true;
$data['longitude'] = $this->convertString($longitudeKey);
$data['latitude'] = $this->convertString($latitudeKey);
$data['zoom_level'] = $this->convertString($zoomLevelKey);
}
if ($isValidEmptyPUT) {
- Log::debug('Method is PUT and all fields present and NULL.');
+ app('log')->debug('Method is PUT and all fields present and NULL.');
$data['remove_location'] = true;
}
- Log::debug(sprintf('Returning longitude: "%s", latitude: "%s", zoom level: "%s"', $data['longitude'], $data['latitude'], $data['zoom_level']));
- Log::debug(
+ app('log')->debug(sprintf('Returning longitude: "%s", latitude: "%s", zoom level: "%s"', $data['longitude'], $data['latitude'], $data['zoom_level']));
+ app('log')->debug(
sprintf(
'Returning actions: store: %s, update: %s, delete: %s',
var_export($data['store_location'], true),
@@ -121,38 +121,38 @@ trait AppendsLocationData
*/
private function isValidPOST(?string $prefix): bool
{
- Log::debug('Now in isValidPOST()');
+ app('log')->debug('Now in isValidPOST()');
$longitudeKey = $this->getLocationKey($prefix, 'longitude');
$latitudeKey = $this->getLocationKey($prefix, 'latitude');
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
$hasLocationKey = $this->getLocationKey($prefix, 'has_location');
// fields must not be null:
if (null !== $this->get($longitudeKey) && null !== $this->get($latitudeKey) && null !== $this->get($zoomLevelKey)) {
- Log::debug('All fields present');
+ app('log')->debug('All fields present');
// if is POST and route contains API, this is enough:
if ('POST' === $this->method() && $this->routeIs('api.v1.*')) {
- Log::debug('Is API location');
+ app('log')->debug('Is API location');
return true;
}
// if is POST and route does not contain API, must also have "has_location" = true
if ('POST' === $this->method() && $this->routeIs('*.store') && !$this->routeIs('api.v1.*') && $hasLocationKey) {
- Log::debug('Is POST + store route.');
+ app('log')->debug('Is POST + store route.');
$hasLocation = $this->boolean($hasLocationKey);
if (true === $hasLocation) {
- Log::debug('Has form form location');
+ app('log')->debug('Has form form location');
return true;
}
- Log::debug('Does not have form location');
+ app('log')->debug('Does not have form location');
return false;
}
- Log::debug('Is not POST API or POST form');
+ app('log')->debug('Is not POST API or POST form');
return false;
}
- Log::debug('Fields not present');
+ app('log')->debug('Fields not present');
return false;
}
@@ -194,36 +194,36 @@ trait AppendsLocationData
$latitudeKey = $this->getLocationKey($prefix, 'latitude');
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
$hasLocationKey = $this->getLocationKey($prefix, 'has_location');
- Log::debug('Now in isValidPUT()');
+ app('log')->debug('Now in isValidPUT()');
// all fields must be set:
if (null !== $this->get($longitudeKey) && null !== $this->get($latitudeKey) && null !== $this->get($zoomLevelKey)) {
- Log::debug('All fields present.');
+ app('log')->debug('All fields present.');
// must be PUT and API route:
if ('PUT' === $this->method() && $this->routeIs('api.v1.*')) {
- Log::debug('Is API location');
+ app('log')->debug('Is API location');
return true;
}
// if POST and not API route, must also have "has_location"
// if is POST and route does not contain API, must also have "has_location" = true
if ('POST' === $this->method() && $this->routeIs('*.update') && !$this->routeIs('api.v1.*') && $hasLocationKey) {
- Log::debug('Is POST + store route.');
+ app('log')->debug('Is POST + store route.');
$hasLocation = $this->boolean($hasLocationKey);
if (true === $hasLocation) {
- Log::debug('Has form location data + has_location');
+ app('log')->debug('Has form location data + has_location');
return true;
}
- Log::debug('Does not have form location');
+ app('log')->debug('Does not have form location');
return false;
}
- Log::debug('Is not POST API or POST form');
+ app('log')->debug('Is not POST API or POST form');
return false;
}
- Log::debug('Fields not present');
+ app('log')->debug('Fields not present');
return false;
}
diff --git a/app/Support/Request/ChecksLogin.php b/app/Support/Request/ChecksLogin.php
index e0d236f993..5d6944115d 100644
--- a/app/Support/Request/ChecksLogin.php
+++ b/app/Support/Request/ChecksLogin.php
@@ -40,7 +40,7 @@ trait ChecksLogin
*/
public function authorize(): bool
{
- Log::debug(sprintf('Now in %s', __METHOD__));
+ app('log')->debug(sprintf('Now in %s', __METHOD__));
// Only allow logged-in users
$check = auth()->check();
if (!$check) {
diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php
index 3b60baecad..87c92822f8 100644
--- a/app/Support/Request/ConvertsDataTypes.php
+++ b/app/Support/Request/ConvertsDataTypes.php
@@ -329,11 +329,11 @@ trait ConvertsDataTypes
// @ignoreException
}
if (null === $carbon) {
- Log::debug(sprintf('Invalid date: %s', $string));
+ app('log')->debug(sprintf('Invalid date: %s', $string));
return null;
}
- Log::debug(sprintf('Date object: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()));
+ app('log')->debug(sprintf('Date object: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()));
return $carbon;
}
@@ -385,7 +385,7 @@ trait ConvertsDataTypes
// @ignoreException
}
if (null === $result) {
- Log::debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
+ app('log')->debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
}
return $result;
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index 25a9ca79ea..f4e5d604f1 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -87,7 +87,7 @@ class OperatorQuerySearch implements SearchInterface
*/
public function __construct()
{
- Log::debug('Constructed OperatorQuerySearch');
+ app('log')->debug('Constructed OperatorQuerySearch');
$this->operators = new Collection();
$this->page = 1;
$this->words = [];
@@ -151,7 +151,7 @@ class OperatorQuerySearch implements SearchInterface
*/
public function parseQuery(string $query)
{
- Log::debug(sprintf('Now in parseQuery(%s)', $query));
+ app('log')->debug(sprintf('Now in parseQuery(%s)', $query));
$parser = new QueryParser();
try {
$query1 = $parser->parse($query);
@@ -161,7 +161,7 @@ class OperatorQuerySearch implements SearchInterface
throw new FireflyException(sprintf('Invalid search value "%s". See the logs.', e($query)), 0, $e);
}
- Log::debug(sprintf('Found %d node(s)', count($query1->getNodes())));
+ app('log')->debug(sprintf('Found %d node(s)', count($query1->getNodes())));
foreach ($query1->getNodes() as $searchNode) {
$this->handleSearchNode($searchNode);
}
@@ -178,7 +178,7 @@ class OperatorQuerySearch implements SearchInterface
private function handleSearchNode(Node $searchNode): void
{
$class = get_class($searchNode);
- Log::debug(sprintf('Now in handleSearchNode(%s)', $class));
+ app('log')->debug(sprintf('Now in handleSearchNode(%s)', $class));
switch ($class) {
default:
app('log')->error(sprintf('Cannot handle node %s', $class));
@@ -199,11 +199,11 @@ class OperatorQuerySearch implements SearchInterface
case Emoji::class:
case Mention::class:
$allWords = (string)$searchNode->getValue();
- Log::debug(sprintf('Add words "%s" to search string, because Node class is "%s"', $allWords, $class));
+ app('log')->debug(sprintf('Add words "%s" to search string, because Node class is "%s"', $allWords, $class));
$this->words[] = $allWords;
break;
case Field::class:
- Log::debug(sprintf('Now handle Node class %s', $class));
+ app('log')->debug(sprintf('Now handle Node class %s', $class));
/** @var Field $searchNode */
// used to search for x:y
$operator = strtolower($searchNode->getValue());
@@ -227,10 +227,10 @@ class OperatorQuerySearch implements SearchInterface
'prohibited' => $prohibited,
]
);
- Log::debug(sprintf('Added operator type "%s"', $operator));
+ app('log')->debug(sprintf('Added operator type "%s"', $operator));
}
if (!in_array($operator, $this->validOperators, true)) {
- Log::debug(sprintf('Added INVALID operator type "%s"', $operator));
+ app('log')->debug(sprintf('Added INVALID operator type "%s"', $operator));
$this->invalidOperators[] = [
'type' => $operator,
'value' => (string)$value,
@@ -246,11 +246,11 @@ class OperatorQuerySearch implements SearchInterface
private function updateCollector(string $operator, string $value, bool $prohibited): bool
{
if ($prohibited) {
- Log::debug(sprintf('Operator "%s" is now "%s"', $operator, sprintf('-%s', $operator)));
+ app('log')->debug(sprintf('Operator "%s" is now "%s"', $operator, sprintf('-%s', $operator)));
$operator = sprintf('-%s', $operator);
}
- Log::debug(sprintf('Now in updateCollector("%s", "%s")', $operator, $value));
+ app('log')->debug(sprintf('Now in updateCollector("%s", "%s")', $operator, $value));
// check if alias, replace if necessary:
$operator = self::getRootOperator($operator);
@@ -597,12 +597,12 @@ class OperatorQuerySearch implements SearchInterface
//
case 'has_attachments':
case '-has_no_attachments':
- Log::debug('Set collector to filter on attachments.');
+ app('log')->debug('Set collector to filter on attachments.');
$this->collector->hasAttachments();
break;
case 'has_no_attachments':
case '-has_attachments':
- Log::debug('Set collector to filter on NO attachments.');
+ app('log')->debug('Set collector to filter on NO attachments.');
$this->collector->hasNoAttachments();
break;
//
@@ -920,18 +920,18 @@ class OperatorQuerySearch implements SearchInterface
//
case 'amount_is':
// strip comma's, make dots.
- Log::debug(sprintf('Original value "%s"', $value));
+ app('log')->debug(sprintf('Original value "%s"', $value));
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIs($amount);
break;
case '-amount_is':
// strip comma's, make dots.
- Log::debug(sprintf('Original value "%s"', $value));
+ app('log')->debug(sprintf('Original value "%s"', $value));
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIsNot($amount);
break;
case 'foreign_amount_is':
@@ -940,7 +940,7 @@ class OperatorQuerySearch implements SearchInterface
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountIs($amount);
break;
case '-foreign_amount_is':
@@ -949,7 +949,7 @@ class OperatorQuerySearch implements SearchInterface
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountIsNot($amount);
break;
case '-amount_more':
@@ -958,7 +958,7 @@ class OperatorQuerySearch implements SearchInterface
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountLess($amount);
break;
case '-foreign_amount_more':
@@ -967,25 +967,25 @@ class OperatorQuerySearch implements SearchInterface
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountLess($amount);
break;
case '-amount_less':
case 'amount_more':
- Log::debug(sprintf('Now handling operator "%s"', $operator));
+ app('log')->debug(sprintf('Now handling operator "%s"', $operator));
// strip comma's, make dots.
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountMore($amount);
break;
case '-foreign_amount_less':
case 'foreign_amount_more':
- Log::debug(sprintf('Now handling operator "%s"', $operator));
+ app('log')->debug(sprintf('Now handling operator "%s"', $operator));
// strip comma's, make dots.
$value = str_replace(',', '.', (string)$value);
$amount = app('steam')->positive($value);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountMore($amount);
break;
//
@@ -993,11 +993,11 @@ class OperatorQuerySearch implements SearchInterface
//
case 'transaction_type':
$this->collector->setTypes([ucfirst($value)]);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
break;
case '-transaction_type':
$this->collector->excludeTypes([ucfirst($value)]);
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
break;
//
// dates
@@ -1116,38 +1116,38 @@ class OperatorQuerySearch implements SearchInterface
case 'created_at_on':
case '-created_at_on':
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
$range = $this->parseDateRange($operator, $value);
$this->setExactObjectDateParams('created_at', $range, $prohibited);
return false;
case 'created_at_before':
case '-created_at_after':
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
$range = $this->parseDateRange($operator, $value);
$this->setObjectDateBeforeParams('created_at', $range);
return false;
case 'created_at_after':
case '-created_at_before':
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
$range = $this->parseDateRange($operator, $value);
$this->setObjectDateAfterParams('created_at', $range);
return false;
case 'updated_at_on':
case '-updated_at_on':
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
$range = $this->parseDateRange($operator, $value);
$this->setExactObjectDateParams('updated_at', $range, $prohibited);
return false;
case 'updated_at_before':
case '-updated_at_after':
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
$range = $this->parseDateRange($operator, $value);
$this->setObjectDateBeforeParams('updated_at', $range);
return false;
case 'updated_at_after':
case '-updated_at_before':
- Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
+ app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
$range = $this->parseDateRange($operator, $value);
$this->setObjectDateAfterParams('updated_at', $range);
return false;
@@ -1341,11 +1341,11 @@ class OperatorQuerySearch implements SearchInterface
if (str_starts_with($original, '-')) {
$return = sprintf('-%s', $config['alias_for']);
}
- Log::debug(sprintf('"%s" is an alias for "%s", so return that instead.', $original, $return));
+ app('log')->debug(sprintf('"%s" is an alias for "%s", so return that instead.', $original, $return));
return $return;
}
- Log::debug(sprintf('"%s" is not an alias.', $operator));
+ app('log')->debug(sprintf('"%s" is not an alias.', $operator));
return $original;
}
@@ -1361,7 +1361,7 @@ class OperatorQuerySearch implements SearchInterface
*/
private function searchAccount(string $value, int $searchDirection, int $stringPosition, bool $prohibited = false): void
{
- Log::debug(sprintf('searchAccount("%s", %d, %d)', $value, $stringPosition, $searchDirection));
+ app('log')->debug(sprintf('searchAccount("%s", %d, %d)', $value, $stringPosition, $searchDirection));
// search direction (default): for source accounts
$searchTypes = [AccountType::ASSET, AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT, AccountType::REVENUE];
@@ -1404,12 +1404,12 @@ class OperatorQuerySearch implements SearchInterface
// get accounts:
$accounts = $this->accountRepository->searchAccount($value, $searchTypes, 1337);
if (0 === $accounts->count()) {
- Log::debug('Found zero accounts, search for non existing account, NO results will be returned.');
+ app('log')->debug('Found zero accounts, search for non existing account, NO results will be returned.');
$this->collector->findNothing();
return;
}
- Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
+ app('log')->debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
$filtered = $accounts->filter(
function (Account $account) use ($value, $stringMethod) {
return $stringMethod(strtolower($account->name), strtolower($value));
@@ -1417,12 +1417,12 @@ class OperatorQuerySearch implements SearchInterface
);
if (0 === $filtered->count()) {
- Log::debug('Left with zero accounts, so cannot find anything, NO results will be returned.');
+ app('log')->debug('Left with zero accounts, so cannot find anything, NO results will be returned.');
$this->collector->findNothing();
return;
}
- Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
+ app('log')->debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
$this->collector->$collectorMethod($filtered);
}
@@ -1437,7 +1437,7 @@ class OperatorQuerySearch implements SearchInterface
*/
private function searchAccountNr(string $value, int $searchDirection, int $stringPosition, bool $prohibited = false): void
{
- Log::debug(sprintf('searchAccountNr(%s, %d, %d)', $value, $searchDirection, $stringPosition));
+ app('log')->debug(sprintf('searchAccountNr(%s, %d, %d)', $value, $searchDirection, $stringPosition));
// search direction (default): for source accounts
$searchTypes = [AccountType::ASSET, AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT, AccountType::REVENUE];
@@ -1482,14 +1482,14 @@ class OperatorQuerySearch implements SearchInterface
// search for accounts:
$accounts = $this->accountRepository->searchAccountNr($value, $searchTypes, 1337);
if (0 === $accounts->count()) {
- Log::debug('Found zero accounts, search for invalid account.');
+ app('log')->debug('Found zero accounts, search for invalid account.');
$this->collector->findNothing();
return;
}
// if found, do filter
- Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
+ app('log')->debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
$filtered = $accounts->filter(
function (Account $account) use ($value, $stringMethod) {
// either IBAN or account number
@@ -1507,12 +1507,12 @@ class OperatorQuerySearch implements SearchInterface
);
if (0 === $filtered->count()) {
- Log::debug('Left with zero, search for invalid account');
+ app('log')->debug('Left with zero, search for invalid account');
$this->collector->findNothing();
return;
}
- Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
+ app('log')->debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
$this->collector->$collectorMethod($filtered);
}
@@ -1559,7 +1559,7 @@ class OperatorQuerySearch implements SearchInterface
try {
$parsedDate = $parser->parseDate($value);
} catch (FireflyException $e) {
- Log::debug(sprintf('Could not parse date "%s", will return empty array.', $value));
+ app('log')->debug(sprintf('Could not parse date "%s", will return empty array.', $value));
$this->invalidOperators[] = [
'type' => $type,
'value' => (string)$value,
@@ -1588,7 +1588,7 @@ class OperatorQuerySearch implements SearchInterface
default:
throw new FireflyException(sprintf('Cannot handle key "%s" in setExactParameters()', $key));
case 'exact':
- Log::debug(sprintf('Set date_is_exact value "%s"', $value->format('Y-m-d')));
+ app('log')->debug(sprintf('Set date_is_exact value "%s"', $value->format('Y-m-d')));
$this->collector->setRange($value, $value);
$this->operators->push(['type' => 'date_on', 'value' => $value->format('Y-m-d'),]);
break;
@@ -1597,32 +1597,32 @@ class OperatorQuerySearch implements SearchInterface
$this->operators->push(['type' => 'not_date_on', 'value' => $value->format('Y-m-d'),]);
break;
case 'year':
- Log::debug(sprintf('Set date_is_exact YEAR value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_exact YEAR value "%s"', $value));
$this->collector->yearIs($value);
$this->operators->push(['type' => 'date_on_year', 'value' => $value,]);
break;
case 'year_not':
- Log::debug(sprintf('Set date_is_exact_not YEAR value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_exact_not YEAR value "%s"', $value));
$this->collector->yearIsNot($value);
$this->operators->push(['type' => 'not_date_on_year', 'value' => $value,]);
break;
case 'month':
- Log::debug(sprintf('Set date_is_exact MONTH value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_exact MONTH value "%s"', $value));
$this->collector->monthIs($value);
$this->operators->push(['type' => 'date_on_month', 'value' => $value,]);
break;
case 'month_not':
- Log::debug(sprintf('Set date_is_exact not MONTH value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_exact not MONTH value "%s"', $value));
$this->collector->monthIsNot($value);
$this->operators->push(['type' => 'not_date_on_month', 'value' => $value,]);
break;
case 'day':
- Log::debug(sprintf('Set date_is_exact DAY value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_exact DAY value "%s"', $value));
$this->collector->dayIs($value);
$this->operators->push(['type' => 'date_on_day', 'value' => $value,]);
break;
case 'day_not':
- Log::debug(sprintf('Set not date_is_exact DAY value "%s"', $value));
+ app('log')->debug(sprintf('Set not date_is_exact DAY value "%s"', $value));
$this->collector->dayIsNot($value);
$this->operators->push(['type' => 'not_date_on_day', 'value' => $value,]);
break;
@@ -1650,17 +1650,17 @@ class OperatorQuerySearch implements SearchInterface
$this->operators->push(['type' => 'date_before', 'value' => $value->format('Y-m-d'),]);
break;
case 'year':
- Log::debug(sprintf('Set date_is_before YEAR value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_before YEAR value "%s"', $value));
$this->collector->yearBefore($value);
$this->operators->push(['type' => 'date_before_year', 'value' => $value,]);
break;
case 'month':
- Log::debug(sprintf('Set date_is_before MONTH value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_before MONTH value "%s"', $value));
$this->collector->monthBefore($value);
$this->operators->push(['type' => 'date_before_month', 'value' => $value,]);
break;
case 'day':
- Log::debug(sprintf('Set date_is_before DAY value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_before DAY value "%s"', $value));
$this->collector->dayBefore($value);
$this->operators->push(['type' => 'date_before_day', 'value' => $value,]);
break;
@@ -1688,17 +1688,17 @@ class OperatorQuerySearch implements SearchInterface
$this->operators->push(['type' => 'date_after', 'value' => $value->format('Y-m-d'),]);
break;
case 'year':
- Log::debug(sprintf('Set date_is_after YEAR value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_after YEAR value "%s"', $value));
$this->collector->yearAfter($value);
$this->operators->push(['type' => 'date_after_year', 'value' => $value,]);
break;
case 'month':
- Log::debug(sprintf('Set date_is_after MONTH value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_after MONTH value "%s"', $value));
$this->collector->monthAfter($value);
$this->operators->push(['type' => 'date_after_month', 'value' => $value,]);
break;
case 'day':
- Log::debug(sprintf('Set date_is_after DAY value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_after DAY value "%s"', $value));
$this->collector->dayAfter($value);
$this->operators->push(['type' => 'date_after_day', 'value' => $value,]);
break;
@@ -1711,7 +1711,7 @@ class OperatorQuerySearch implements SearchInterface
*/
private function setExactMetaDateParams(string $field, array $range, bool $prohibited = false): void
{
- Log::debug('Now in setExactMetaDateParams()');
+ app('log')->debug('Now in setExactMetaDateParams()');
/**
* @var string $key
* @var Carbon|string $value
@@ -1722,42 +1722,42 @@ class OperatorQuerySearch implements SearchInterface
default:
throw new FireflyException(sprintf('Cannot handle key "%s" in setExactMetaDateParams()', $key));
case 'exact':
- Log::debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
+ app('log')->debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
$this->collector->setMetaDateRange($value, $value, $field);
$this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d'),]);
break;
case 'exact_not':
- Log::debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
+ app('log')->debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
$this->collector->excludeMetaDateRange($value, $value, $field);
$this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d'),]);
break;
case 'year':
- Log::debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
$this->collector->metaYearIs($value, $field);
$this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value,]);
break;
case 'year_not':
- Log::debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
$this->collector->metaYearIsNot($value, $field);
$this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value,]);
break;
case 'month':
- Log::debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
$this->collector->metaMonthIs($value, $field);
$this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value,]);
break;
case 'month_not':
- Log::debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
$this->collector->metaMonthIsNot($value, $field);
$this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value,]);
break;
case 'day':
- Log::debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
$this->collector->metaDayIs($value, $field);
$this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value,]);
break;
case 'day_not':
- Log::debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
$this->collector->metaDayIsNot($value, $field);
$this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value,]);
break;
@@ -1784,17 +1784,17 @@ class OperatorQuerySearch implements SearchInterface
$this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d'),]);
break;
case 'year':
- Log::debug(sprintf('Set %s_is_before YEAR value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_before YEAR value "%s"', $field, $value));
$this->collector->metaYearBefore($value, $field);
$this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value,]);
break;
case 'month':
- Log::debug(sprintf('Set %s_is_before MONTH value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_before MONTH value "%s"', $field, $value));
$this->collector->metaMonthBefore($value, $field);
$this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value,]);
break;
case 'day':
- Log::debug(sprintf('Set %s_is_before DAY value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_before DAY value "%s"', $field, $value));
$this->collector->metaDayBefore($value, $field);
$this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value,]);
break;
@@ -1821,17 +1821,17 @@ class OperatorQuerySearch implements SearchInterface
$this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d'),]);
break;
case 'year':
- Log::debug(sprintf('Set %s_is_after YEAR value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_after YEAR value "%s"', $field, $value));
$this->collector->metaYearAfter($value, $field);
$this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value,]);
break;
case 'month':
- Log::debug(sprintf('Set %s_is_after MONTH value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_after MONTH value "%s"', $field, $value));
$this->collector->metaMonthAfter($value, $field);
$this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value,]);
break;
case 'day':
- Log::debug(sprintf('Set %s_is_after DAY value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_after DAY value "%s"', $field, $value));
$this->collector->metaDayAfter($value, $field);
$this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value,]);
break;
@@ -1854,42 +1854,42 @@ class OperatorQuerySearch implements SearchInterface
default:
throw new FireflyException(sprintf('Cannot handle key "%s" in setExactObjectDateParams()', $key));
case 'exact':
- Log::debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
+ app('log')->debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
$this->collector->setObjectRange($value, clone $value, $field);
$this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d'),]);
break;
case 'exact_not':
- Log::debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
+ app('log')->debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
$this->collector->excludeObjectRange($value, clone $value, $field);
$this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d'),]);
break;
case 'year':
- Log::debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
$this->collector->objectYearIs($value, $field);
$this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value,]);
break;
case 'year_not':
- Log::debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
$this->collector->objectYearIsNot($value, $field);
$this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value,]);
break;
case 'month':
- Log::debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
$this->collector->objectMonthIs($value, $field);
$this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value,]);
break;
case 'month_not':
- Log::debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
$this->collector->objectMonthIsNot($value, $field);
$this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value,]);
break;
case 'day':
- Log::debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
$this->collector->objectDayIs($value, $field);
$this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value,]);
break;
case 'day_not':
- Log::debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
+ app('log')->debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
$this->collector->objectDayIsNot($value, $field);
$this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value,]);
break;
@@ -1917,17 +1917,17 @@ class OperatorQuerySearch implements SearchInterface
$this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d'),]);
break;
case 'year':
- Log::debug(sprintf('Set date_is_before YEAR value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_before YEAR value "%s"', $value));
$this->collector->objectYearBefore($value, $field);
$this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value,]);
break;
case 'month':
- Log::debug(sprintf('Set date_is_before MONTH value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_before MONTH value "%s"', $value));
$this->collector->objectMonthBefore($value, $field);
$this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value,]);
break;
case 'day':
- Log::debug(sprintf('Set date_is_before DAY value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_before DAY value "%s"', $value));
$this->collector->objectDayBefore($value, $field);
$this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value,]);
break;
@@ -1955,17 +1955,17 @@ class OperatorQuerySearch implements SearchInterface
$this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d'),]);
break;
case 'year':
- Log::debug(sprintf('Set date_is_after YEAR value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_after YEAR value "%s"', $value));
$this->collector->objectYearAfter($value, $field);
$this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value,]);
break;
case 'month':
- Log::debug(sprintf('Set date_is_after MONTH value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_after MONTH value "%s"', $value));
$this->collector->objectMonthAfter($value, $field);
$this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value,]);
break;
case 'day':
- Log::debug(sprintf('Set date_is_after DAY value "%s"', $value));
+ app('log')->debug(sprintf('Set date_is_after DAY value "%s"', $value));
$this->collector->objectDayAfter($value, $field);
$this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value,]);
break;
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index 59b9ae7d83..91f3bf1e16 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -632,7 +632,7 @@ class Steam
$number = sprintf('%.12f', $number);
}
- // Log::debug(sprintf('Trying bcround("%s",%d)', $number, $precision));
+ // app('log')->debug(sprintf('Trying bcround("%s",%d)', $number, $precision));
if (str_contains($number, '.')) {
if ($number[0] !== '-') {
return bcadd($number, '0.' . str_repeat('0', $precision) . '5', $precision);
@@ -812,7 +812,7 @@ class Steam
*/
public function getSafePreviousUrl(): string
{
- //Log::debug(sprintf('getSafePreviousUrl: "%s"', session()->previousUrl()));
+ //app('log')->debug(sprintf('getSafePreviousUrl: "%s"', session()->previousUrl()));
return session()->previousUrl() ?? route('index');
}
@@ -826,7 +826,7 @@ class Steam
*/
public function getSafeUrl(string $unknownUrl, string $safeUrl): string
{
- //Log::debug(sprintf('getSafeUrl(%s, %s)', $unknownUrl, $safeUrl));
+ //app('log')->debug(sprintf('getSafeUrl(%s, %s)', $unknownUrl, $safeUrl));
$returnUrl = $safeUrl;
$unknownHost = parse_url($unknownUrl, PHP_URL_HOST);
$safeHost = parse_url($safeUrl, PHP_URL_HOST);
diff --git a/app/TransactionRules/Actions/AddTag.php b/app/TransactionRules/Actions/AddTag.php
index 057473463c..782385e97c 100644
--- a/app/TransactionRules/Actions/AddTag.php
+++ b/app/TransactionRules/Actions/AddTag.php
@@ -74,14 +74,14 @@ class AddTag implements ActionInterface
if (0 === $count) {
// add to journal:
DB::table('tag_transaction_journal')->insert(['tag_id' => $tag->id, 'transaction_journal_id' => $journal['transaction_journal_id']]);
- Log::debug(sprintf('RuleAction AddTag. Added tag #%d ("%s") to journal %d.', $tag->id, $tag->tag, $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction AddTag. Added tag #%d ("%s") to journal %d.', $tag->id, $tag->tag, $journal['transaction_journal_id']));
$object = TransactionJournal::find($journal['transaction_journal_id']);
// event for audit log entry
event(new TriggeredAuditLog($this->action->rule, $object, 'add_tag', null, $tag->tag));
return true;
}
- Log::debug(
+ app('log')->debug(
sprintf('RuleAction AddTag fired but tag %d ("%s") was already added to journal %d.', $tag->id, $tag->tag, $journal['transaction_journal_id'])
);
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.tag_already_added', ['tag' => $this->action->action_value])));
diff --git a/app/TransactionRules/Actions/AppendNotes.php b/app/TransactionRules/Actions/AppendNotes.php
index 8d130b2521..5590fff06f 100644
--- a/app/TransactionRules/Actions/AppendNotes.php
+++ b/app/TransactionRules/Actions/AppendNotes.php
@@ -60,7 +60,7 @@ class AppendNotes implements ActionInterface
$dbNote->noteable_type = TransactionJournal::class;
$dbNote->text = '';
}
- Log::debug(sprintf('RuleAction AppendNotes appended "%s" to "%s".', $this->action->action_value, $dbNote->text));
+ app('log')->debug(sprintf('RuleAction AppendNotes appended "%s" to "%s".', $this->action->action_value, $dbNote->text));
$before = $dbNote->text;
$text = sprintf('%s%s', $dbNote->text, $this->action->action_value);
$dbNote->text = $text;
diff --git a/app/TransactionRules/Actions/AppendNotesToDescription.php b/app/TransactionRules/Actions/AppendNotesToDescription.php
index 64626015eb..bae71716ab 100644
--- a/app/TransactionRules/Actions/AppendNotesToDescription.php
+++ b/app/TransactionRules/Actions/AppendNotesToDescription.php
@@ -56,7 +56,7 @@ class AppendNotesToDescription implements ActionInterface
*/
public function actOnArray(array $journal): bool
{
- Log::debug('Now in AppendNotesToDescription');
+ app('log')->debug('Now in AppendNotesToDescription');
/** @var TransactionJournal $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
@@ -66,7 +66,7 @@ class AppendNotesToDescription implements ActionInterface
}
$note = $object->notes()->first();
if (null === $note) {
- Log::debug('Journal has no notes.');
+ app('log')->debug('Journal has no notes.');
$note = new Note();
$note->noteable()->associate($object);
$note->text = '';
@@ -76,7 +76,7 @@ class AppendNotesToDescription implements ActionInterface
$before = $object->description;
$object->description = trim(sprintf('%s %s', $object->description, (string)$this->clearString($note->text, false)));
$object->save();
- Log::debug(sprintf('Journal description is updated to "%s".', $object->description));
+ app('log')->debug(sprintf('Journal description is updated to "%s".', $object->description));
event(new TriggeredAuditLog($this->action->rule, $object, 'update_description', $before, $object->description));
diff --git a/app/TransactionRules/Actions/ClearBudget.php b/app/TransactionRules/Actions/ClearBudget.php
index 2c79a535fb..572e2f7c52 100644
--- a/app/TransactionRules/Actions/ClearBudget.php
+++ b/app/TransactionRules/Actions/ClearBudget.php
@@ -56,7 +56,7 @@ class ClearBudget implements ActionInterface
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
$budget = $object->budgets()->first();
if (null === $budget) {
- Log::debug(sprintf('RuleAction ClearBudget, no budget in journal #%d.', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction ClearBudget, no budget in journal #%d.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_already_no_budget')));
return false;
}
@@ -65,7 +65,7 @@ class ClearBudget implements ActionInterface
event(new TriggeredAuditLog($this->action->rule, $object, 'clear_budget', $budget->name, null));
- Log::debug(sprintf('RuleAction ClearBudget removed all budgets from journal #%d.', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction ClearBudget removed all budgets from journal #%d.', $journal['transaction_journal_id']));
return true;
}
diff --git a/app/TransactionRules/Actions/ClearCategory.php b/app/TransactionRules/Actions/ClearCategory.php
index 22b9df33f7..249b023c9c 100644
--- a/app/TransactionRules/Actions/ClearCategory.php
+++ b/app/TransactionRules/Actions/ClearCategory.php
@@ -56,7 +56,7 @@ class ClearCategory implements ActionInterface
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
$category = $object->categories()->first();
if (null === $category) {
- Log::debug(sprintf('RuleAction ClearCategory, no category in journal #%d.', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction ClearCategory, no category in journal #%d.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_already_no_category')));
return false;
}
@@ -65,7 +65,7 @@ class ClearCategory implements ActionInterface
event(new TriggeredAuditLog($this->action->rule, $object, 'clear_category', $category->name, null));
- Log::debug(sprintf('RuleAction ClearCategory removed all categories from journal #%d.', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction ClearCategory removed all categories from journal #%d.', $journal['transaction_journal_id']));
return true;
}
diff --git a/app/TransactionRules/Actions/ClearNotes.php b/app/TransactionRules/Actions/ClearNotes.php
index d67a1b3d90..da48900189 100644
--- a/app/TransactionRules/Actions/ClearNotes.php
+++ b/app/TransactionRules/Actions/ClearNotes.php
@@ -55,7 +55,7 @@ class ClearNotes implements ActionInterface
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
$notes = $object->notes()->first();
if (null === $notes) {
- Log::debug(sprintf('RuleAction ClearNotes, journal #%d has no notes.', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction ClearNotes, journal #%d has no notes.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_already_no_notes')));
return false;
}
@@ -65,7 +65,7 @@ class ClearNotes implements ActionInterface
->where('noteable_id', $journal['transaction_journal_id'])
->where('noteable_type', TransactionJournal::class)
->delete();
- Log::debug(sprintf('RuleAction ClearNotes removed all notes from journal #%d.', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction ClearNotes removed all notes from journal #%d.', $journal['transaction_journal_id']));
event(new TriggeredAuditLog($this->action->rule, $object, 'clear_notes', $before, null));
diff --git a/app/TransactionRules/Actions/ConvertToDeposit.php b/app/TransactionRules/Actions/ConvertToDeposit.php
index 0c272de728..2fa56b2b50 100644
--- a/app/TransactionRules/Actions/ConvertToDeposit.php
+++ b/app/TransactionRules/Actions/ConvertToDeposit.php
@@ -76,7 +76,7 @@ class ConvertToDeposit implements ActionInterface
return false;
}
- Log::debug(sprintf('Convert journal #%d to deposit.', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('Convert journal #%d to deposit.', $journal['transaction_journal_id']));
$type = $object->transactionType->type;
if (TransactionType::DEPOSIT === $type) {
app('log')->error(sprintf('Journal #%d is already a deposit (rule #%d).', $journal['transaction_journal_id'], $this->action->rule_id));
@@ -85,12 +85,12 @@ class ConvertToDeposit implements ActionInterface
}
if (TransactionType::WITHDRAWAL === $type) {
- Log::debug('Going to transform a withdrawal to a deposit.');
+ app('log')->debug('Going to transform a withdrawal to a deposit.');
try {
$res = $this->convertWithdrawalArray($object);
} catch (JsonException | FireflyException $e) {
- Log::debug('Could not convert withdrawal to deposit.');
+ app('log')->debug('Could not convert withdrawal to deposit.');
app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
@@ -101,12 +101,12 @@ class ConvertToDeposit implements ActionInterface
return $res;
}
if (TransactionType::TRANSFER === $type) {
- Log::debug('Going to transform a transfer to a deposit.');
+ app('log')->debug('Going to transform a transfer to a deposit.');
try {
$res = $this->convertTransferArray($object);
} catch (JsonException | FireflyException $e) {
- Log::debug('Could not convert transfer to deposit.');
+ app('log')->debug('Could not convert transfer to deposit.');
app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
@@ -153,7 +153,7 @@ class ConvertToDeposit implements ActionInterface
$opposingAccount = $factory->findOrCreate($opposingName, AccountType::REVENUE);
}
- Log::debug(sprintf('ConvertToDeposit. Action value is "%s", new opposing name is "%s"', $this->action->action_value, $opposingAccount->name));
+ app('log')->debug(sprintf('ConvertToDeposit. Action value is "%s", new opposing name is "%s"', $this->action->action_value, $opposingAccount->name));
// update the source transaction and put in the new revenue ID.
DB::table('transactions')
@@ -174,7 +174,7 @@ class ConvertToDeposit implements ActionInterface
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id, 'bill_id' => null]);
- Log::debug('Converted withdrawal to deposit.');
+ app('log')->debug('Converted withdrawal to deposit.');
return true;
}
@@ -245,7 +245,7 @@ class ConvertToDeposit implements ActionInterface
$opposingAccount = $factory->findOrCreate($opposingName, AccountType::REVENUE);
}
- Log::debug(sprintf('ConvertToDeposit. Action value is "%s", revenue name is "%s"', $this->action->action_value, $opposingAccount->name));
+ app('log')->debug(sprintf('ConvertToDeposit. Action value is "%s", revenue name is "%s"', $this->action->action_value, $opposingAccount->name));
// update source transaction(s) to be revenue account
DB::table('transactions')
@@ -260,7 +260,7 @@ class ConvertToDeposit implements ActionInterface
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id, 'bill_id' => null]);
- Log::debug('Converted transfer to deposit.');
+ app('log')->debug('Converted transfer to deposit.');
return true;
}
diff --git a/app/TransactionRules/Actions/ConvertToTransfer.php b/app/TransactionRules/Actions/ConvertToTransfer.php
index a57a8b65ab..bc2db833fb 100644
--- a/app/TransactionRules/Actions/ConvertToTransfer.php
+++ b/app/TransactionRules/Actions/ConvertToTransfer.php
@@ -121,11 +121,11 @@ class ConvertToTransfer implements ActionInterface
}
if (TransactionType::WITHDRAWAL === $type) {
- Log::debug('Going to transform a withdrawal to a transfer.');
+ app('log')->debug('Going to transform a withdrawal to a transfer.');
try {
$res = $this->convertWithdrawalArray($object, $opposing);
} catch (FireflyException $e) {
- Log::debug('Could not convert withdrawal to transfer.');
+ app('log')->debug('Could not convert withdrawal to transfer.');
app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
@@ -136,11 +136,11 @@ class ConvertToTransfer implements ActionInterface
return $res;
}
if (TransactionType::DEPOSIT === $type) {
- Log::debug('Going to transform a deposit to a transfer.');
+ app('log')->debug('Going to transform a deposit to a transfer.');
try {
$res = $this->convertDepositArray($object, $opposing);
} catch (FireflyException $e) {
- Log::debug('Could not convert deposit to transfer.');
+ app('log')->debug('Could not convert deposit to transfer.');
app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
@@ -225,7 +225,7 @@ class ConvertToTransfer implements ActionInterface
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id, 'bill_id' => null]);
- Log::debug('Converted withdrawal to transfer.');
+ app('log')->debug('Converted withdrawal to transfer.');
return true;
}
@@ -284,7 +284,7 @@ class ConvertToTransfer implements ActionInterface
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id, 'bill_id' => null]);
- Log::debug('Converted deposit to transfer.');
+ app('log')->debug('Converted deposit to transfer.');
return true;
}
diff --git a/app/TransactionRules/Actions/ConvertToWithdrawal.php b/app/TransactionRules/Actions/ConvertToWithdrawal.php
index 1b9f07fe3f..4d93d7fbea 100644
--- a/app/TransactionRules/Actions/ConvertToWithdrawal.php
+++ b/app/TransactionRules/Actions/ConvertToWithdrawal.php
@@ -87,11 +87,11 @@ class ConvertToWithdrawal implements ActionInterface
return false;
}
if (TransactionType::DEPOSIT === $type) {
- Log::debug('Going to transform a deposit to a withdrawal.');
+ app('log')->debug('Going to transform a deposit to a withdrawal.');
try {
$res = $this->convertDepositArray($object);
} catch (JsonException | FireflyException $e) {
- Log::debug('Could not convert transfer to deposit.');
+ app('log')->debug('Could not convert transfer to deposit.');
app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
@@ -101,12 +101,12 @@ class ConvertToWithdrawal implements ActionInterface
return $res;
}
if (TransactionType::TRANSFER === $type) {
- Log::debug('Going to transform a transfer to a withdrawal.');
+ app('log')->debug('Going to transform a transfer to a withdrawal.');
try {
$res = $this->convertTransferArray($object);
} catch (JsonException | FireflyException $e) {
- Log::debug('Could not convert transfer to deposit.');
+ app('log')->debug('Could not convert transfer to deposit.');
app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
@@ -149,7 +149,7 @@ class ConvertToWithdrawal implements ActionInterface
$opposingAccount = $factory->findOrCreate($opposingName, AccountType::EXPENSE);
}
- Log::debug(sprintf('ConvertToWithdrawal. Action value is "%s", expense name is "%s"', $this->action->action_value, $opposingName));
+ app('log')->debug(sprintf('ConvertToWithdrawal. Action value is "%s", expense name is "%s"', $this->action->action_value, $opposingName));
// update source transaction(s) to be the original destination account
DB::table('transactions')
@@ -169,7 +169,7 @@ class ConvertToWithdrawal implements ActionInterface
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id]);
- Log::debug('Converted deposit to withdrawal.');
+ app('log')->debug('Converted deposit to withdrawal.');
return true;
}
@@ -239,7 +239,7 @@ class ConvertToWithdrawal implements ActionInterface
$opposingAccount = $factory->findOrCreate($opposingName, AccountType::EXPENSE);
}
- Log::debug(sprintf('ConvertToWithdrawal. Action value is "%s", destination name is "%s"', $this->action->action_value, $opposingName));
+ app('log')->debug(sprintf('ConvertToWithdrawal. Action value is "%s", destination name is "%s"', $this->action->action_value, $opposingName));
// update destination transaction(s) to be new expense account.
DB::table('transactions')
@@ -253,7 +253,7 @@ class ConvertToWithdrawal implements ActionInterface
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id]);
- Log::debug('Converted transfer to withdrawal.');
+ app('log')->debug('Converted transfer to withdrawal.');
return true;
}
diff --git a/app/TransactionRules/Actions/DeleteTransaction.php b/app/TransactionRules/Actions/DeleteTransaction.php
index 0f52553457..9f0407efde 100644
--- a/app/TransactionRules/Actions/DeleteTransaction.php
+++ b/app/TransactionRules/Actions/DeleteTransaction.php
@@ -57,7 +57,7 @@ class DeleteTransaction implements ActionInterface
// destroy entire group.
if (1 === $count) {
- Log::debug(
+ app('log')->debug(
sprintf(
'RuleAction DeleteTransaction DELETED the entire transaction group of journal #%d ("%s").',
$journal['transaction_journal_id'],
@@ -72,7 +72,7 @@ class DeleteTransaction implements ActionInterface
return true;
}
- Log::debug(
+ app('log')->debug(
sprintf('RuleAction DeleteTransaction DELETED transaction journal #%d ("%s").', $journal['transaction_journal_id'], $journal['description'])
);
diff --git a/app/TransactionRules/Actions/LinkToBill.php b/app/TransactionRules/Actions/LinkToBill.php
index 6511528789..d5608e6739 100644
--- a/app/TransactionRules/Actions/LinkToBill.php
+++ b/app/TransactionRules/Actions/LinkToBill.php
@@ -82,7 +82,7 @@ class LinkToBill implements ActionInterface
DB::table('transaction_journals')
->where('id', '=', $journal['transaction_journal_id'])
->update(['bill_id' => $bill->id]);
- Log::debug(
+ app('log')->debug(
sprintf('RuleAction LinkToBill set the bill of journal #%d to bill #%d ("%s").', $journal['transaction_journal_id'], $bill->id, $bill->name)
);
diff --git a/app/TransactionRules/Actions/PrependNotes.php b/app/TransactionRules/Actions/PrependNotes.php
index 25534fa25d..e202b5c912 100644
--- a/app/TransactionRules/Actions/PrependNotes.php
+++ b/app/TransactionRules/Actions/PrependNotes.php
@@ -61,7 +61,7 @@ class PrependNotes implements ActionInterface
$dbNote->text = '';
}
$before = $dbNote->text;
- Log::debug(sprintf('RuleAction PrependNotes prepended "%s" to "%s".', $this->action->action_value, $dbNote->text));
+ app('log')->debug(sprintf('RuleAction PrependNotes prepended "%s" to "%s".', $this->action->action_value, $dbNote->text));
$text = sprintf('%s%s', $this->action->action_value, $dbNote->text);
$dbNote->text = $text;
$dbNote->save();
diff --git a/app/TransactionRules/Actions/RemoveAllTags.php b/app/TransactionRules/Actions/RemoveAllTags.php
index 87ccbe0b2f..8ab60713bd 100644
--- a/app/TransactionRules/Actions/RemoveAllTags.php
+++ b/app/TransactionRules/Actions/RemoveAllTags.php
@@ -55,11 +55,11 @@ class RemoveAllTags implements ActionInterface
DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->delete();
$count = DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->count();
if (0 === $count) {
- Log::debug(sprintf('RuleAction RemoveAllTags, journal #%d has no tags.', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction RemoveAllTags, journal #%d has no tags.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_tags_to_remove')));
return false;
}
- Log::debug(sprintf('RuleAction RemoveAllTags removed all tags from journal %d.', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction RemoveAllTags removed all tags from journal %d.', $journal['transaction_journal_id']));
/** @var TransactionJournal $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
diff --git a/app/TransactionRules/Actions/RemoveTag.php b/app/TransactionRules/Actions/RemoveTag.php
index f3f23ad9e9..a97819b72f 100644
--- a/app/TransactionRules/Actions/RemoveTag.php
+++ b/app/TransactionRules/Actions/RemoveTag.php
@@ -59,7 +59,7 @@ class RemoveTag implements ActionInterface
$tag = $user->tags()->where('tag', $name)->first();
if (null === $tag) {
- Log::debug(
+ app('log')->debug(
sprintf('RuleAction RemoveTag tried to remove tag "%s" from journal #%d but no such tag exists.', $name, $journal['transaction_journal_id'])
);
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_tag', ['tag' => $name])));
@@ -67,14 +67,14 @@ class RemoveTag implements ActionInterface
}
$count = DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->where('tag_id', $tag->id)->count();
if (0 === $count) {
- Log::debug(
+ app('log')->debug(
sprintf('RuleAction RemoveTag tried to remove tag "%s" from journal #%d but no such tag is linked.', $name, $journal['transaction_journal_id'])
);
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_unlink_tag', ['tag' => $name])));
return false;
}
- Log::debug(sprintf('RuleAction RemoveTag removed tag #%d ("%s") from journal #%d.', $tag->id, $tag->tag, $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('RuleAction RemoveTag removed tag #%d ("%s") from journal #%d.', $tag->id, $tag->tag, $journal['transaction_journal_id']));
DB::table('tag_transaction_journal')
->where('transaction_journal_id', $journal['transaction_journal_id'])
->where('tag_id', $tag->id)
diff --git a/app/TransactionRules/Actions/SetBudget.php b/app/TransactionRules/Actions/SetBudget.php
index 1dbdc54c18..ee75a6ba50 100644
--- a/app/TransactionRules/Actions/SetBudget.php
+++ b/app/TransactionRules/Actions/SetBudget.php
@@ -59,7 +59,7 @@ class SetBudget implements ActionInterface
$budget = $user->budgets()->where('name', $search)->first();
if (null === $budget) {
- Log::debug(
+ app('log')->debug(
sprintf(
'RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.',
$journal['transaction_journal_id'],
@@ -71,7 +71,7 @@ class SetBudget implements ActionInterface
}
if (TransactionType::WITHDRAWAL !== $journal['transaction_type_type']) {
- Log::debug(
+ app('log')->debug(
sprintf(
'RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a %s.',
$journal['transaction_journal_id'],
@@ -94,7 +94,7 @@ class SetBudget implements ActionInterface
}
- Log::debug(
+ app('log')->debug(
sprintf('RuleAction SetBudget set the budget of journal #%d to budget #%d ("%s").', $journal['transaction_journal_id'], $budget->id, $budget->name)
);
diff --git a/app/TransactionRules/Actions/SetCategory.php b/app/TransactionRules/Actions/SetCategory.php
index dfc4c0dfbd..dc95b5a444 100644
--- a/app/TransactionRules/Actions/SetCategory.php
+++ b/app/TransactionRules/Actions/SetCategory.php
@@ -67,7 +67,7 @@ class SetCategory implements ActionInterface
$factory->setUser($user);
$category = $factory->findOrCreate(null, $search);
if (null === $category) {
- Log::debug(
+ app('log')->debug(
sprintf(
'RuleAction SetCategory could not set category of journal #%d to "%s" because no such category exists.',
$journal['transaction_journal_id'],
@@ -78,7 +78,7 @@ class SetCategory implements ActionInterface
return false;
}
- Log::debug(
+ app('log')->debug(
sprintf(
'RuleAction SetCategory set the category of journal #%d to category #%d ("%s").',
$journal['transaction_journal_id'],
diff --git a/app/TransactionRules/Actions/SetDescription.php b/app/TransactionRules/Actions/SetDescription.php
index 26e3a2be9d..6f2e2b3d9b 100644
--- a/app/TransactionRules/Actions/SetDescription.php
+++ b/app/TransactionRules/Actions/SetDescription.php
@@ -59,7 +59,7 @@ class SetDescription implements ActionInterface
->where('id', '=', $journal['transaction_journal_id'])
->update(['description' => $this->action->action_value]);
- Log::debug(
+ app('log')->debug(
sprintf(
'RuleAction SetDescription changed the description of journal #%d from "%s" to "%s".',
$journal['transaction_journal_id'],
diff --git a/app/TransactionRules/Actions/SetDestinationAccount.php b/app/TransactionRules/Actions/SetDestinationAccount.php
index 74acdf9d55..c67bfdb320 100644
--- a/app/TransactionRules/Actions/SetDestinationAccount.php
+++ b/app/TransactionRules/Actions/SetDestinationAccount.php
@@ -119,7 +119,7 @@ class SetDestinationAccount implements ActionInterface
$newAccount = $this->findWithdrawalDestinationAccount();
}
- Log::debug(sprintf('New destination account is #%d ("%s").', $newAccount->id, $newAccount->name));
+ app('log')->debug(sprintf('New destination account is #%d ("%s").', $newAccount->id, $newAccount->name));
event(new TriggeredAuditLog($this->action->rule, $object, 'set_destination', null, $newAccount->name));
@@ -129,7 +129,7 @@ class SetDestinationAccount implements ActionInterface
->where('amount', '>', 0)
->update(['account_id' => $newAccount->id]);
- Log::debug(sprintf('Updated journal #%d (group #%d) and gave it new destination account ID.', $object->id, $object->transaction_group_id));
+ app('log')->debug(sprintf('Updated journal #%d (group #%d) and gave it new destination account ID.', $object->id, $object->transaction_group_id));
return true;
}
@@ -144,7 +144,7 @@ class SetDestinationAccount implements ActionInterface
// switch on type:
$allowed = config(sprintf('firefly.expected_source_types.destination.%s', $type));
$allowed = is_array($allowed) ? $allowed : [];
- Log::debug(sprintf('Check config for expected_source_types.destination.%s, result is', $type), $allowed);
+ app('log')->debug(sprintf('Check config for expected_source_types.destination.%s, result is', $type), $allowed);
return $this->repository->findByName($this->action->action_value, $allowed);
}
@@ -167,7 +167,7 @@ class SetDestinationAccount implements ActionInterface
];
$account = $this->repository->store($data);
}
- Log::debug(sprintf('Found or created expense account #%d ("%s")', $account->id, $account->name));
+ app('log')->debug(sprintf('Found or created expense account #%d ("%s")', $account->id, $account->name));
return $account;
}
diff --git a/app/TransactionRules/Actions/SetNotes.php b/app/TransactionRules/Actions/SetNotes.php
index a1874c241c..3752180e8d 100644
--- a/app/TransactionRules/Actions/SetNotes.php
+++ b/app/TransactionRules/Actions/SetNotes.php
@@ -63,7 +63,7 @@ class SetNotes implements ActionInterface
$dbNote->text = $this->action->action_value;
$dbNote->save();
- Log::debug(
+ app('log')->debug(
sprintf(
'RuleAction SetNotes changed the notes of journal #%d from "%s" to "%s".',
$journal['transaction_journal_id'],
diff --git a/app/TransactionRules/Actions/SetSourceAccount.php b/app/TransactionRules/Actions/SetSourceAccount.php
index d60b9d399c..f45b25a037 100644
--- a/app/TransactionRules/Actions/SetSourceAccount.php
+++ b/app/TransactionRules/Actions/SetSourceAccount.php
@@ -113,7 +113,7 @@ class SetSourceAccount implements ActionInterface
$newAccount = $this->findDepositSourceAccount();
}
- Log::debug(sprintf('New source account is #%d ("%s").', $newAccount->id, $newAccount->name));
+ app('log')->debug(sprintf('New source account is #%d ("%s").', $newAccount->id, $newAccount->name));
// update source transaction with new source account:
DB::table('transactions')
@@ -123,7 +123,7 @@ class SetSourceAccount implements ActionInterface
event(new TriggeredAuditLog($this->action->rule, $object, 'set_source', null, $newAccount->name));
- Log::debug(sprintf('Updated journal #%d (group #%d) and gave it new source account ID.', $object->id, $object->transaction_group_id));
+ app('log')->debug(sprintf('Updated journal #%d (group #%d) and gave it new source account ID.', $object->id, $object->transaction_group_id));
return true;
}
@@ -138,7 +138,7 @@ class SetSourceAccount implements ActionInterface
// switch on type:
$allowed = config(sprintf('firefly.expected_source_types.source.%s', $type));
$allowed = is_array($allowed) ? $allowed : [];
- Log::debug(sprintf('Check config for expected_source_types.source.%s, result is', $type), $allowed);
+ app('log')->debug(sprintf('Check config for expected_source_types.source.%s, result is', $type), $allowed);
return $this->repository->findByName($this->action->action_value, $allowed);
}
@@ -162,7 +162,7 @@ class SetSourceAccount implements ActionInterface
];
$account = $this->repository->store($data);
}
- Log::debug(sprintf('Found or created revenue account #%d ("%s")', $account->id, $account->name));
+ app('log')->debug(sprintf('Found or created revenue account #%d ("%s")', $account->id, $account->name));
return $account;
}
diff --git a/app/TransactionRules/Actions/UpdatePiggybank.php b/app/TransactionRules/Actions/UpdatePiggybank.php
index 1d52c9c6ef..848742ab8e 100644
--- a/app/TransactionRules/Actions/UpdatePiggybank.php
+++ b/app/TransactionRules/Actions/UpdatePiggybank.php
@@ -57,7 +57,7 @@ class UpdatePiggybank implements ActionInterface
*/
public function actOnArray(array $journal): bool
{
- Log::debug(sprintf('Triggered rule action UpdatePiggybank on journal #%d', $journal['transaction_journal_id']));
+ app('log')->debug(sprintf('Triggered rule action UpdatePiggybank on journal #%d', $journal['transaction_journal_id']));
// refresh the transaction type.
$user = User::find($journal['user_id']);
@@ -74,7 +74,7 @@ class UpdatePiggybank implements ActionInterface
return false;
}
- Log::debug(sprintf('Found piggy bank #%d ("%s")', $piggyBank->id, $piggyBank->name));
+ app('log')->debug(sprintf('Found piggy bank #%d ("%s")', $piggyBank->id, $piggyBank->name));
/** @var Transaction $source */
$source = $journalObj->transactions()->where('amount', '<', 0)->first();
@@ -82,7 +82,7 @@ class UpdatePiggybank implements ActionInterface
$destination = $journalObj->transactions()->where('amount', '>', 0)->first();
if ((int)$source->account_id === (int)$piggyBank->account_id) {
- Log::debug('Piggy bank account is linked to source, so remove amount from piggy bank.');
+ app('log')->debug('Piggy bank account is linked to source, so remove amount from piggy bank.');
$this->removeAmount($piggyBank, $journalObj, $destination->amount);
event(
@@ -103,7 +103,7 @@ class UpdatePiggybank implements ActionInterface
return true;
}
if ((int)$destination->account_id === (int)$piggyBank->account_id) {
- Log::debug('Piggy bank account is linked to source, so add amount to piggy bank.');
+ app('log')->debug('Piggy bank account is linked to source, so add amount to piggy bank.');
$this->addAmount($piggyBank, $journalObj, $destination->amount);
event(
@@ -158,11 +158,11 @@ class UpdatePiggybank implements ActionInterface
// how much can we remove from this piggy bank?
$toRemove = $repository->getCurrentAmount($piggyBank);
- Log::debug(sprintf('Amount is %s, max to remove is %s', $amount, $toRemove));
+ app('log')->debug(sprintf('Amount is %s, max to remove is %s', $amount, $toRemove));
// if $amount is bigger than $toRemove, shrink it.
$amount = -1 === bccomp($amount, $toRemove) ? $amount : $toRemove;
- Log::debug(sprintf('Amount is now %s', $amount));
+ app('log')->debug(sprintf('Amount is now %s', $amount));
// if amount is zero, stop.
if (0 === bccomp('0', $amount)) {
@@ -177,7 +177,7 @@ class UpdatePiggybank implements ActionInterface
return;
}
- Log::debug(sprintf('Will now remove %s from piggy bank.', $amount));
+ app('log')->debug(sprintf('Will now remove %s from piggy bank.', $amount));
$repository->removeAmount($piggyBank, $amount, $journal);
}
@@ -197,14 +197,14 @@ class UpdatePiggybank implements ActionInterface
// how much can we add to the piggy bank?
if (0 !== bccomp($piggyBank->targetamount, '0')) {
$toAdd = bcsub($piggyBank->targetamount, $repository->getCurrentAmount($piggyBank));
- Log::debug(sprintf('Max amount to add to piggy bank is %s, amount is %s', $toAdd, $amount));
+ app('log')->debug(sprintf('Max amount to add to piggy bank is %s, amount is %s', $toAdd, $amount));
// update amount to fit:
$amount = -1 === bccomp($amount, $toAdd) ? $amount : $toAdd;
- Log::debug(sprintf('Amount is now %s', $amount));
+ app('log')->debug(sprintf('Amount is now %s', $amount));
}
if (0 === bccomp($piggyBank->targetamount, '0')) {
- Log::debug('Target amount is zero, can add anything.');
+ app('log')->debug('Target amount is zero, can add anything.');
}
@@ -221,7 +221,7 @@ class UpdatePiggybank implements ActionInterface
return;
}
- Log::debug(sprintf('Will now add %s to piggy bank.', $amount));
+ app('log')->debug(sprintf('Will now add %s to piggy bank.', $amount));
$repository->addAmount($piggyBank, $amount, $journal);
}
diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php
index cb7ffa47b0..97bd7fe076 100644
--- a/app/TransactionRules/Engine/SearchRuleEngine.php
+++ b/app/TransactionRules/Engine/SearchRuleEngine.php
@@ -65,7 +65,7 @@ class SearchRuleEngine implements RuleEngineInterface
*/
public function addOperator(array $operator): void
{
- Log::debug('Add extra operator: ', $operator);
+ app('log')->debug('Add extra operator: ', $operator);
$this->operators[] = $operator;
}
@@ -74,7 +74,7 @@ class SearchRuleEngine implements RuleEngineInterface
*/
public function find(): Collection
{
- Log::debug('SearchRuleEngine::find()');
+ app('log')->debug('SearchRuleEngine::find()');
$collection = new Collection();
foreach ($this->rules as $rule) {
$found = new Collection();
@@ -99,7 +99,7 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function findStrictRule(Rule $rule): Collection
{
- Log::debug(sprintf('Now in findStrictRule(#%d)', $rule->id ?? 0));
+ app('log')->debug(sprintf('Now in findStrictRule(#%d)', $rule->id ?? 0));
$searchArray = [];
$triggers = [];
if ($this->refreshTriggers) {
@@ -118,11 +118,11 @@ class SearchRuleEngine implements RuleEngineInterface
// if needs no context, value is different:
$needsContext = config(sprintf('search.operators.%s.needs_context', $ruleTrigger->trigger_type)) ?? true;
if (false === $needsContext) {
- Log::debug(sprintf('SearchRuleEngine:: add a rule trigger: %s:true', $ruleTrigger->trigger_type));
+ app('log')->debug(sprintf('SearchRuleEngine:: add a rule trigger: %s:true', $ruleTrigger->trigger_type));
$searchArray[$ruleTrigger->trigger_type][] = 'true';
}
if (true === $needsContext) {
- Log::debug(sprintf('SearchRuleEngine:: add a rule trigger: %s:"%s"', $ruleTrigger->trigger_type, $ruleTrigger->trigger_value));
+ app('log')->debug(sprintf('SearchRuleEngine:: add a rule trigger: %s:"%s"', $ruleTrigger->trigger_type, $ruleTrigger->trigger_value));
$searchArray[$ruleTrigger->trigger_type][] = sprintf('"%s"', $ruleTrigger->trigger_value);
}
}
@@ -130,7 +130,7 @@ class SearchRuleEngine implements RuleEngineInterface
// add local operators:
foreach ($this->operators as $operator) {
- Log::debug(sprintf('SearchRuleEngine:: add local added operator: %s:"%s"', $operator['type'], $operator['value']));
+ app('log')->debug(sprintf('SearchRuleEngine:: add local added operator: %s:"%s"', $operator['type'], $operator['value']));
$searchArray[$operator['type']][] = sprintf('"%s"', $operator['value']);
}
$date = today(config('app.timezone'));
@@ -166,21 +166,21 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function hasSpecificJournalTrigger(array $array): bool
{
- Log::debug('Now in hasSpecificJournalTrigger.');
+ app('log')->debug('Now in hasSpecificJournalTrigger.');
$journalTrigger = false;
$dateTrigger = false;
foreach ($array as $triggerName => $values) {
if ('journal_id' === $triggerName && is_array($values) && 1 === count($values)) {
- Log::debug('Found a journal_id trigger with 1 journal, true.');
+ app('log')->debug('Found a journal_id trigger with 1 journal, true.');
$journalTrigger = true;
}
if (in_array($triggerName, ['date_is', 'date', 'on', 'date_before', 'before', 'date_after', 'after'], true)) {
- Log::debug('Found a date related trigger, set to true.');
+ app('log')->debug('Found a date related trigger, set to true.');
$dateTrigger = true;
}
}
$result = $journalTrigger && $dateTrigger;
- Log::debug(sprintf('Result of hasSpecificJournalTrigger is %s.', var_export($result, true)));
+ app('log')->debug(sprintf('Result of hasSpecificJournalTrigger is %s.', var_export($result, true)));
return $result;
}
@@ -192,12 +192,12 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function setDateFromJournalTrigger(array $array): Carbon
{
- Log::debug('Now in setDateFromJournalTrigger()');
+ app('log')->debug('Now in setDateFromJournalTrigger()');
$journalId = 0;
foreach ($array as $triggerName => $values) {
if ('journal_id' === $triggerName && is_array($values) && 1 === count($values)) {
$journalId = (int)trim(($values[0] ?? '"0"'), '"'); // follows format "123".
- Log::debug(sprintf('Found journal ID #%d', $journalId));
+ app('log')->debug(sprintf('Found journal ID #%d', $journalId));
}
}
if (0 !== $journalId) {
@@ -206,12 +206,12 @@ class SearchRuleEngine implements RuleEngineInterface
$journal = $repository->find($journalId);
if (null !== $journal) {
$date = $journal->date;
- Log::debug(sprintf('Found journal #%d with date %s.', $journal->id, $journal->date->format('Y-m-d')));
+ app('log')->debug(sprintf('Found journal #%d with date %s.', $journal->id, $journal->date->format('Y-m-d')));
return $date;
}
}
- Log::debug('Found no journal, return default date.');
+ app('log')->debug('Found no journal, return default date.');
return today(config('app.timezone'));
}
@@ -249,23 +249,23 @@ class SearchRuleEngine implements RuleEngineInterface
continue;
}
if ('user_action' === $ruleTrigger->trigger_type) {
- Log::debug('Skip trigger type.');
+ app('log')->debug('Skip trigger type.');
continue;
}
$searchArray = [];
$needsContext = config(sprintf('search.operators.%s.needs_context', $ruleTrigger->trigger_type)) ?? true;
if (false === $needsContext) {
- Log::debug(sprintf('SearchRuleEngine:: non strict, will search for: %s:true', $ruleTrigger->trigger_type));
+ app('log')->debug(sprintf('SearchRuleEngine:: non strict, will search for: %s:true', $ruleTrigger->trigger_type));
$searchArray[$ruleTrigger->trigger_type] = 'true';
}
if (true === $needsContext) {
- Log::debug(sprintf('SearchRuleEngine:: non strict, will search for: %s:"%s"', $ruleTrigger->trigger_type, $ruleTrigger->trigger_value));
+ app('log')->debug(sprintf('SearchRuleEngine:: non strict, will search for: %s:"%s"', $ruleTrigger->trigger_type, $ruleTrigger->trigger_value));
$searchArray[$ruleTrigger->trigger_type] = sprintf('"%s"', $ruleTrigger->trigger_value);
}
// then, add local operators as well:
foreach ($this->operators as $operator) {
- Log::debug(sprintf('SearchRuleEngine:: add local added operator: %s:"%s"', $operator['type'], $operator['value']));
+ app('log')->debug(sprintf('SearchRuleEngine:: add local added operator: %s:"%s"', $operator['type'], $operator['value']));
$searchArray[$operator['type']] = sprintf('"%s"', $operator['value']);
}
@@ -281,13 +281,13 @@ class SearchRuleEngine implements RuleEngineInterface
$result = $searchEngine->searchTransactions();
$collection = $result->getCollection();
- Log::debug(sprintf('Found in this run, %d transactions', $collection->count()));
+ app('log')->debug(sprintf('Found in this run, %d transactions', $collection->count()));
$total = $total->merge($collection);
- Log::debug(sprintf('Total collection is now %d transactions', $total->count()));
+ app('log')->debug(sprintf('Total collection is now %d transactions', $total->count()));
$count++;
}
- Log::debug(sprintf('Total collection is now %d transactions', $total->count()));
- Log::debug(sprintf('Done running %d trigger(s)', $count));
+ app('log')->debug(sprintf('Total collection is now %d transactions', $total->count()));
+ app('log')->debug(sprintf('Done running %d trigger(s)', $count));
// make collection unique
$unique = $total->unique(
@@ -297,13 +297,13 @@ class SearchRuleEngine implements RuleEngineInterface
$str = sprintf('%s%d', $str, $transaction['transaction_journal_id']);
}
$key = sprintf('%d%s', $group['id'], $str);
- //Log::debug(sprintf('Return key: %s ', $key));
+ //app('log')->debug(sprintf('Return key: %s ', $key));
return $key;
}
);
- Log::debug(sprintf('SearchRuleEngine:: Found %d transactions using search engine.', $unique->count()));
+ app('log')->debug(sprintf('SearchRuleEngine:: Found %d transactions using search engine.', $unique->count()));
return $unique;
}
@@ -315,27 +315,27 @@ class SearchRuleEngine implements RuleEngineInterface
public function fire(): void
{
$this->resultCount = [];
- Log::debug('SearchRuleEngine::fire()!');
+ app('log')->debug('SearchRuleEngine::fire()!');
// if rules and no rule groups, file each rule separately.
if (0 !== $this->rules->count()) {
- Log::debug(sprintf('SearchRuleEngine:: found %d rule(s) to fire.', $this->rules->count()));
+ app('log')->debug(sprintf('SearchRuleEngine:: found %d rule(s) to fire.', $this->rules->count()));
foreach ($this->rules as $rule) {
$this->fireRule($rule);
}
- Log::debug('SearchRuleEngine:: done processing all rules!');
+ app('log')->debug('SearchRuleEngine:: done processing all rules!');
return;
}
if (0 !== $this->groups->count()) {
- Log::debug(sprintf('SearchRuleEngine:: found %d rule group(s) to fire.', $this->groups->count()));
+ app('log')->debug(sprintf('SearchRuleEngine:: found %d rule group(s) to fire.', $this->groups->count()));
// fire each group:
/** @var RuleGroup $group */
foreach ($this->groups as $group) {
$this->fireGroup($group);
}
}
- Log::debug('SearchRuleEngine:: done processing all rules!');
+ app('log')->debug('SearchRuleEngine:: done processing all rules!');
}
/**
@@ -348,18 +348,18 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function fireRule(Rule $rule): bool
{
- Log::debug(sprintf('Now going to fire rule #%d', $rule->id));
+ app('log')->debug(sprintf('Now going to fire rule #%d', $rule->id));
if (false === $rule->active) {
- Log::debug(sprintf('Rule #%d is not active!', $rule->id));
+ app('log')->debug(sprintf('Rule #%d is not active!', $rule->id));
return false;
}
if (true === $rule->strict) {
- Log::debug(sprintf('Rule #%d is a strict rule.', $rule->id));
+ app('log')->debug(sprintf('Rule #%d is a strict rule.', $rule->id));
return $this->fireStrictRule($rule);
}
- Log::debug(sprintf('Rule #%d is not strict rule.', $rule->id));
+ app('log')->debug(sprintf('Rule #%d is not strict rule.', $rule->id));
return $this->fireNonStrictRule($rule);
}
@@ -374,19 +374,19 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function fireStrictRule(Rule $rule): bool
{
- Log::debug(sprintf('SearchRuleEngine::fireStrictRule(%d)!', $rule->id));
+ app('log')->debug(sprintf('SearchRuleEngine::fireStrictRule(%d)!', $rule->id));
$collection = $this->findStrictRule($rule);
$this->processResults($rule, $collection);
- Log::debug(sprintf('SearchRuleEngine:: done processing strict rule #%d', $rule->id));
+ app('log')->debug(sprintf('SearchRuleEngine:: done processing strict rule #%d', $rule->id));
$result = $collection->count() > 0;
if (true === $result) {
- Log::debug(sprintf('SearchRuleEngine:: rule #%d was triggered (on %d transaction(s)).', $rule->id, $collection->count()));
+ app('log')->debug(sprintf('SearchRuleEngine:: rule #%d was triggered (on %d transaction(s)).', $rule->id, $collection->count()));
return true;
}
- Log::debug(sprintf('SearchRuleEngine:: rule #%d was not triggered (on %d transaction(s)).', $rule->id, $collection->count()));
+ app('log')->debug(sprintf('SearchRuleEngine:: rule #%d was not triggered (on %d transaction(s)).', $rule->id, $collection->count()));
return false;
}
@@ -399,7 +399,7 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function processResults(Rule $rule, Collection $collection): void
{
- Log::debug(sprintf('SearchRuleEngine:: Going to process %d results.', $collection->count()));
+ app('log')->debug(sprintf('SearchRuleEngine:: Going to process %d results.', $collection->count()));
/** @var array $group */
foreach ($collection as $group) {
$this->processTransactionGroup($rule, $group);
@@ -414,7 +414,7 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function processTransactionGroup(Rule $rule, array $group): void
{
- Log::debug(sprintf('SearchRuleEngine:: Will now execute actions on transaction group #%d', $group['id']));
+ app('log')->debug(sprintf('SearchRuleEngine:: Will now execute actions on transaction group #%d', $group['id']));
/** @var array $transaction */
foreach ($group['transactions'] as $transaction) {
$this->processTransactionJournal($rule, $transaction);
@@ -429,7 +429,7 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function processTransactionJournal(Rule $rule, array $transaction): void
{
- Log::debug(sprintf('SearchRuleEngine:: Will now execute actions on transaction journal #%d', $transaction['transaction_journal_id']));
+ app('log')->debug(sprintf('SearchRuleEngine:: Will now execute actions on transaction journal #%d', $transaction['transaction_journal_id']));
$actions = $rule->ruleActions()->orderBy('order', 'ASC')->get();
/** @var RuleAction $ruleAction */
foreach ($actions as $ruleAction) {
@@ -452,13 +452,13 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function processRuleAction(RuleAction $ruleAction, array $transaction): bool
{
- Log::debug(sprintf('Executing rule action "%s" with value "%s"', $ruleAction->action_type, $ruleAction->action_value));
+ app('log')->debug(sprintf('Executing rule action "%s" with value "%s"', $ruleAction->action_type, $ruleAction->action_value));
$actionClass = ActionFactory::getAction($ruleAction);
$result = $actionClass->actOnArray($transaction);
$journalId = $transaction['transaction_journal_id'] ?? 0;
if (true === $result) {
$this->resultCount[$journalId] = array_key_exists($journalId, $this->resultCount) ? $this->resultCount[$journalId]++ : 1;
- Log::debug(
+ app('log')->debug(
sprintf(
'Action "%s" on journal #%d was executed, so count a result. Updated transaction journal count is now %d.',
$ruleAction->action_type,
@@ -468,12 +468,12 @@ class SearchRuleEngine implements RuleEngineInterface
);
}
if (false === $result) {
- Log::debug(sprintf('Action "%s" reports NO changes were made.', $ruleAction->action_type));
+ app('log')->debug(sprintf('Action "%s" reports NO changes were made.', $ruleAction->action_type));
}
// pick up from the action if it actually acted or not:
if ($ruleAction->stop_processing) {
- Log::debug(sprintf('Rule action "%s" asks to break, so break!', $ruleAction->action_type));
+ app('log')->debug(sprintf('Rule action "%s" asks to break, so break!', $ruleAction->action_type));
return true;
}
@@ -491,11 +491,11 @@ class SearchRuleEngine implements RuleEngineInterface
*/
private function fireNonStrictRule(Rule $rule): bool
{
- Log::debug(sprintf('SearchRuleEngine::fireNonStrictRule(%d)!', $rule->id));
+ app('log')->debug(sprintf('SearchRuleEngine::fireNonStrictRule(%d)!', $rule->id));
$collection = $this->findNonStrictRule($rule);
$this->processResults($rule, $collection);
- Log::debug(sprintf('SearchRuleEngine:: done processing non-strict rule #%d', $rule->id));
+ app('log')->debug(sprintf('SearchRuleEngine:: done processing non-strict rule #%d', $rule->id));
return $collection->count() > 0;
}
@@ -509,16 +509,16 @@ class SearchRuleEngine implements RuleEngineInterface
private function fireGroup(RuleGroup $group): void
{
$all = false;
- Log::debug(sprintf('Going to fire group #%d with %d rule(s)', $group->id, $group->rules->count()));
+ app('log')->debug(sprintf('Going to fire group #%d with %d rule(s)', $group->id, $group->rules->count()));
/** @var Rule $rule */
foreach ($group->rules as $rule) {
- Log::debug(sprintf('Going to fire rule #%d from group #%d', $rule->id, $group->id));
+ app('log')->debug(sprintf('Going to fire rule #%d from group #%d', $rule->id, $group->id));
$result = $this->fireRule($rule);
if (true === $result) {
$all = true;
}
if (true === $result && true === $rule->stop_processing) {
- Log::debug(sprintf('The rule was triggered and rule->stop_processing = true, so group #%d will stop processing further rules.', $group->id));
+ app('log')->debug(sprintf('The rule was triggered and rule->stop_processing = true, so group #%d will stop processing further rules.', $group->id));
return;
}
@@ -548,10 +548,10 @@ class SearchRuleEngine implements RuleEngineInterface
*/
public function setRuleGroups(Collection $ruleGroups): void
{
- Log::debug(__METHOD__);
+ app('log')->debug(__METHOD__);
foreach ($ruleGroups as $group) {
if ($group instanceof RuleGroup) {
- Log::debug(sprintf('Adding a rule group to the SearchRuleEngine: #%d ("%s")', $group->id, $group->title));
+ app('log')->debug(sprintf('Adding a rule group to the SearchRuleEngine: #%d ("%s")', $group->id, $group->title));
$this->groups->push($group);
}
}
@@ -562,10 +562,10 @@ class SearchRuleEngine implements RuleEngineInterface
*/
public function setRules(Collection $rules): void
{
- Log::debug(__METHOD__);
+ app('log')->debug(__METHOD__);
foreach ($rules as $rule) {
if ($rule instanceof Rule) {
- Log::debug(sprintf('Adding a rule to the SearchRuleEngine: #%d ("%s")', $rule->id, $rule->title));
+ app('log')->debug(sprintf('Adding a rule to the SearchRuleEngine: #%d ("%s")', $rule->id, $rule->title));
$this->rules->push($rule);
}
}
diff --git a/app/TransactionRules/Factory/ActionFactory.php b/app/TransactionRules/Factory/ActionFactory.php
index 0f7275e32e..4d9905ec6a 100644
--- a/app/TransactionRules/Factory/ActionFactory.php
+++ b/app/TransactionRules/Factory/ActionFactory.php
@@ -54,7 +54,7 @@ class ActionFactory
public static function getAction(RuleAction $action): ActionInterface
{
$class = self::getActionClass($action->action_type);
- Log::debug(sprintf('self::getActionClass("%s") = "%s"', $action->action_type, $class));
+ app('log')->debug(sprintf('self::getActionClass("%s") = "%s"', $action->action_type, $class));
return new $class($action);
}
diff --git a/app/Validation/Account/DepositValidation.php b/app/Validation/Account/DepositValidation.php
index 7c70b8e519..9315567aa1 100644
--- a/app/Validation/Account/DepositValidation.php
+++ b/app/Validation/Account/DepositValidation.php
@@ -44,7 +44,7 @@ trait DepositValidation
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
- Log::debug('Now in validateDepositDestination', $array);
+ app('log')->debug('Now in validateDepositDestination', $array);
// source can be any of the following types.
$validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
@@ -57,7 +57,7 @@ trait DepositValidation
}
// if the account can be created anyway we don't need to search.
if (null === $result && true === $this->canCreateTypes($validTypes)) {
- Log::debug('Can create some of these types, so return true.');
+ app('log')->debug('Can create some of these types, so return true.');
$result = true;
}
@@ -65,17 +65,17 @@ trait DepositValidation
// otherwise try to find the account:
$search = $this->findExistingAccount($validTypes, $array);
if (null === $search) {
- Log::debug('findExistingAccount() returned NULL, so the result is false.');
+ app('log')->debug('findExistingAccount() returned NULL, so the result is false.');
$this->destError = (string)trans('validation.deposit_dest_bad_data', ['id' => $accountId, 'name' => $accountName]);
$result = false;
}
if (null !== $search) {
- Log::debug(sprintf('findExistingAccount() returned #%d ("%s"), so the result is true.', $search->id, $search->name));
+ app('log')->debug(sprintf('findExistingAccount() returned #%d ("%s"), so the result is true.', $search->id, $search->name));
$this->setDestination($search);
$result = true;
}
}
- Log::debug(sprintf('validateDepositDestination will return %s', var_export($result, true)));
+ app('log')->debug(sprintf('validateDepositDestination will return %s', var_export($result, true)));
return $result;
}
@@ -106,7 +106,7 @@ trait DepositValidation
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
$accountNumber = array_key_exists('number', $array) ? $array['number'] : null;
- Log::debug('Now in validateDepositSource', $array);
+ app('log')->debug('Now in validateDepositSource', $array);
// null = we found nothing at all or didn't even search
// false = invalid results
@@ -141,11 +141,11 @@ trait DepositValidation
if (null !== $accountId) {
$search = $this->getRepository()->find($accountId);
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
- Log::debug(sprintf('User submitted an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type));
- Log::debug(sprintf('Firefly III accepts ID #%d as valid account data.', $accountId));
+ app('log')->debug(sprintf('User submitted an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type));
+ app('log')->debug(sprintf('Firefly III accepts ID #%d as valid account data.', $accountId));
}
if (null !== $search && in_array($search->accountType->type, $validTypes, true)) {
- Log::debug('ID result is not null and seems valid, save as source account.');
+ app('log')->debug('ID result is not null and seems valid, save as source account.');
$this->setSource($search);
$result = true;
}
@@ -155,11 +155,11 @@ trait DepositValidation
if (null !== $accountIban) {
$search = $this->getRepository()->findByIbanNull($accountIban, $validTypes);
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
- Log::debug(sprintf('User submitted IBAN ("%s"), which is a "%s", so this is not a valid source.', $accountIban, $search->accountType->type));
+ app('log')->debug(sprintf('User submitted IBAN ("%s"), which is a "%s", so this is not a valid source.', $accountIban, $search->accountType->type));
$result = false;
}
if (null !== $search && in_array($search->accountType->type, $validTypes, true)) {
- Log::debug('IBAN result is not null and seems valid, save as source account.');
+ app('log')->debug('IBAN result is not null and seems valid, save as source account.');
$this->setSource($search);
$result = true;
}
@@ -169,13 +169,13 @@ trait DepositValidation
if (null !== $accountNumber && '' !== $accountNumber) {
$search = $this->getRepository()->findByAccountNumber($accountNumber, $validTypes);
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
- Log::debug(
+ app('log')->debug(
sprintf('User submitted number ("%s"), which is a "%s", so this is not a valid source.', $accountNumber, $search->accountType->type)
);
$result = false;
}
if (null !== $search && in_array($search->accountType->type, $validTypes, true)) {
- Log::debug('Number result is not null and seems valid, save as source account.');
+ app('log')->debug('Number result is not null and seems valid, save as source account.');
$this->setSource($search);
$result = true;
}
diff --git a/app/Validation/Account/LiabilityValidation.php b/app/Validation/Account/LiabilityValidation.php
index 2d004f7f76..2f137c21b5 100644
--- a/app/Validation/Account/LiabilityValidation.php
+++ b/app/Validation/Account/LiabilityValidation.php
@@ -40,7 +40,7 @@ trait LiabilityValidation
*/
protected function validateLCDestination(array $array): bool
{
- Log::debug('Now in validateLCDestination', $array);
+ app('log')->debug('Now in validateLCDestination', $array);
$result = null;
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
@@ -62,7 +62,7 @@ trait LiabilityValidation
}
if (null !== $accountName && '' !== $accountName) {
- Log::debug('Destination ID is null, now we can assume the destination is a (new) liability credit account.');
+ app('log')->debug('Destination ID is null, now we can assume the destination is a (new) liability credit account.');
return true;
}
app('log')->error('Destination ID is null, but destination name is also NULL.');
@@ -78,19 +78,19 @@ trait LiabilityValidation
*/
protected function validateLCSource(array $array): bool
{
- Log::debug('Now in validateLCSource', $array);
+ app('log')->debug('Now in validateLCSource', $array);
// if the array has an ID and ID is not null, try to find it and check type.
// this account must be a liability
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
if (null !== $accountId) {
- Log::debug('Source ID is not null, assume were looking for a liability.');
+ app('log')->debug('Source ID is not null, assume were looking for a liability.');
// find liability credit:
$result = $this->findExistingAccount(config('firefly.valid_liabilities'), $array);
if (null === $result) {
app('log')->error('Did not find a liability account, return false.');
return false;
}
- Log::debug(sprintf('Return true, found #%d ("%s")', $result->id, $result->name));
+ app('log')->debug(sprintf('Return true, found #%d ("%s")', $result->id, $result->name));
$this->setSource($result);
return true;
}
diff --git a/app/Validation/Account/OBValidation.php b/app/Validation/Account/OBValidation.php
index 3372a80485..93a58166fd 100644
--- a/app/Validation/Account/OBValidation.php
+++ b/app/Validation/Account/OBValidation.php
@@ -43,7 +43,7 @@ trait OBValidation
$result = null;
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
- Log::debug('Now in validateOBDestination', $array);
+ app('log')->debug('Now in validateOBDestination', $array);
// source can be any of the following types.
$validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
@@ -56,7 +56,7 @@ trait OBValidation
}
// if the account can be created anyway we don't need to search.
if (null === $result && true === $this->canCreateTypes($validTypes)) {
- Log::debug('Can create some of these types, so return true.');
+ app('log')->debug('Can create some of these types, so return true.');
$result = true;
}
@@ -64,17 +64,17 @@ trait OBValidation
// otherwise try to find the account:
$search = $this->findExistingAccount($validTypes, $array);
if (null === $search) {
- Log::debug('findExistingAccount() returned NULL, so the result is false.', $validTypes);
+ app('log')->debug('findExistingAccount() returned NULL, so the result is false.', $validTypes);
$this->destError = (string)trans('validation.ob_dest_bad_data', ['id' => $accountId, 'name' => $accountName]);
$result = false;
}
if (null !== $search) {
- Log::debug(sprintf('findExistingAccount() returned #%d ("%s"), so the result is true.', $search->id, $search->name));
+ app('log')->debug(sprintf('findExistingAccount() returned #%d ("%s"), so the result is true.', $search->id, $search->name));
$this->setDestination($search);
$result = true;
}
}
- Log::debug(sprintf('validateOBDestination(%d, "%s") will return %s', $accountId, $accountName, var_export($result, true)));
+ app('log')->debug(sprintf('validateOBDestination(%d, "%s") will return %s', $accountId, $accountName, var_export($result, true)));
return $result;
}
@@ -98,7 +98,7 @@ trait OBValidation
{
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
- Log::debug('Now in validateOBSource', $array);
+ app('log')->debug('Now in validateOBSource', $array);
$result = null;
// source can be any of the following types.
$validTypes = array_keys($this->combinations[$this->transactionType]);
@@ -114,19 +114,19 @@ trait OBValidation
// if the user submits an ID only but that ID is not of the correct type,
// return false.
if (null !== $accountId && null === $accountName) {
- Log::debug('Source ID is not null, but name is null.');
+ app('log')->debug('Source ID is not null, but name is null.');
$search = $this->getRepository()->find($accountId);
// the source resulted in an account, but it's not of a valid type.
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
$message = sprintf('User submitted only an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type);
- Log::debug($message);
+ app('log')->debug($message);
$this->sourceError = $message;
$result = false;
}
// the source resulted in an account, AND it's of a valid type.
if (null !== $search && in_array($search->accountType->type, $validTypes, true)) {
- Log::debug(sprintf('Found account of correct type: #%d, "%s"', $search->id, $search->name));
+ app('log')->debug(sprintf('Found account of correct type: #%d, "%s"', $search->id, $search->name));
$this->setSource($search);
$result = true;
}
@@ -134,7 +134,7 @@ trait OBValidation
// if the account can be created anyway we don't need to search.
if (null === $result && true === $this->canCreateTypes($validTypes)) {
- Log::debug('Result is still null.');
+ app('log')->debug('Result is still null.');
$result = true;
// set the source to be a (dummy) initial balance account.
diff --git a/app/Validation/Account/ReconciliationValidation.php b/app/Validation/Account/ReconciliationValidation.php
index f3e3e1071a..0609091e6c 100644
--- a/app/Validation/Account/ReconciliationValidation.php
+++ b/app/Validation/Account/ReconciliationValidation.php
@@ -53,7 +53,7 @@ trait ReconciliationValidation
}
// after that, search for it expecting an asset account or a liability.
- Log::debug('Now in validateReconciliationDestination', $array);
+ app('log')->debug('Now in validateReconciliationDestination', $array);
// source can be any of the following types.
$validTypes = array_keys($this->combinations[$this->transactionType]);
@@ -65,7 +65,7 @@ trait ReconciliationValidation
return false;
}
$this->setSource($search);
- Log::debug('Valid source account!');
+ app('log')->debug('Valid source account!');
return true;
}
@@ -85,13 +85,13 @@ trait ReconciliationValidation
// is expected to be "positive", i.e. the money flows from the
// source to the asset account that is the destination.
if (null === $accountId && null === $accountName) {
- Log::debug('The source is valid because ID and name are NULL.');
+ app('log')->debug('The source is valid because ID and name are NULL.');
$this->setSource(new Account());
return true;
}
// after that, search for it expecting an asset account or a liability.
- Log::debug('Now in validateReconciliationSource', $array);
+ app('log')->debug('Now in validateReconciliationSource', $array);
// source can be any of the following types.
$validTypes = array_keys($this->combinations[$this->transactionType]);
@@ -103,7 +103,7 @@ trait ReconciliationValidation
return false;
}
$this->setSource($search);
- Log::debug('Valid source account!');
+ app('log')->debug('Valid source account!');
return true;
}
diff --git a/app/Validation/Account/TransferValidation.php b/app/Validation/Account/TransferValidation.php
index eaa0f8323f..60def45252 100644
--- a/app/Validation/Account/TransferValidation.php
+++ b/app/Validation/Account/TransferValidation.php
@@ -41,7 +41,7 @@ trait TransferValidation
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
- Log::debug('Now in validateTransferDestination', $array);
+ app('log')->debug('Now in validateTransferDestination', $array);
// source can be any of the following types.
$validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
if (null === $accountId && null === $accountName && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
@@ -99,7 +99,7 @@ trait TransferValidation
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
$accountNumber = array_key_exists('number', $array) ? $array['number'] : null;
- Log::debug('Now in validateTransferSource', $array);
+ app('log')->debug('Now in validateTransferSource', $array);
// source can be any of the following types.
$validTypes = array_keys($this->combinations[$this->transactionType]);
if (null === $accountId && null === $accountName
@@ -122,7 +122,7 @@ trait TransferValidation
return false;
}
$this->setSource($search);
- Log::debug('Valid source!');
+ app('log')->debug('Valid source!');
return true;
}
diff --git a/app/Validation/Account/WithdrawalValidation.php b/app/Validation/Account/WithdrawalValidation.php
index e7ad03e8e5..1e5adbf5fc 100644
--- a/app/Validation/Account/WithdrawalValidation.php
+++ b/app/Validation/Account/WithdrawalValidation.php
@@ -42,7 +42,7 @@ trait WithdrawalValidation
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
- Log::debug('Now in validateGenericSource', $array);
+ app('log')->debug('Now in validateGenericSource', $array);
// source can be any of the following types.
$validTypes = [AccountType::ASSET, AccountType::REVENUE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
if (null === $accountId && null === $accountName && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
@@ -63,7 +63,7 @@ trait WithdrawalValidation
return false;
}
$this->setSource($search);
- Log::debug('Valid source account!');
+ app('log')->debug('Valid source account!');
return true;
}
@@ -94,7 +94,7 @@ trait WithdrawalValidation
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
$accountNumber = array_key_exists('number', $array) ? $array['number'] : null;
- Log::debug('Now in validateWithdrawalDestination()', $array);
+ app('log')->debug('Now in validateWithdrawalDestination()', $array);
// source can be any of the following types.
$validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
app('log')->debug('Source type can be: ', $validTypes);
@@ -149,7 +149,7 @@ trait WithdrawalValidation
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
$accountNumber = array_key_exists('number', $array) ? $array['number'] : null;
- Log::debug('Now in validateWithdrawalSource', $array);
+ app('log')->debug('Now in validateWithdrawalSource', $array);
// source can be any of the following types.
$validTypes = array_keys($this->combinations[$this->transactionType]);
if (null === $accountId && null === $accountName && null === $accountNumber && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
@@ -170,7 +170,7 @@ trait WithdrawalValidation
return false;
}
$this->setSource($search);
- Log::debug('Valid source account!');
+ app('log')->debug('Valid source account!');
return true;
}
diff --git a/app/Validation/AccountValidator.php b/app/Validation/AccountValidator.php
index 5cc615a652..82dfa4cd49 100644
--- a/app/Validation/AccountValidator.php
+++ b/app/Validation/AccountValidator.php
@@ -92,10 +92,10 @@ class AccountValidator
public function setSource(?Account $account): void
{
if (null === $account) {
- Log::debug('AccountValidator source is set to NULL');
+ app('log')->debug('AccountValidator source is set to NULL');
}
if (null !== $account) {
- Log::debug(sprintf('AccountValidator source is set to #%d: "%s" (%s)', $account->id, $account->name, $account->accountType->type));
+ app('log')->debug(sprintf('AccountValidator source is set to #%d: "%s" (%s)', $account->id, $account->name, $account->accountType->type));
}
$this->source = $account;
}
@@ -106,10 +106,10 @@ class AccountValidator
public function setDestination(?Account $account): void
{
if (null === $account) {
- Log::debug('AccountValidator destination is set to NULL');
+ app('log')->debug('AccountValidator destination is set to NULL');
}
if (null !== $account) {
- Log::debug(sprintf('AccountValidator destination is set to #%d: "%s" (%s)', $account->id, $account->name, $account->accountType->type));
+ app('log')->debug(sprintf('AccountValidator destination is set to #%d: "%s" (%s)', $account->id, $account->name, $account->accountType->type));
}
$this->destination = $account;
}
@@ -119,7 +119,7 @@ class AccountValidator
*/
public function setTransactionType(string $transactionType): void
{
- Log::debug(sprintf('Transaction type for validator is now "%s".', ucfirst($transactionType)));
+ app('log')->debug(sprintf('Transaction type for validator is now "%s".', ucfirst($transactionType)));
$this->transactionType = ucfirst($transactionType);
}
@@ -152,7 +152,7 @@ class AccountValidator
*/
public function validateDestination(array $array): bool
{
- Log::debug('Now in AccountValidator::validateDestination()', $array);
+ app('log')->debug('Now in AccountValidator::validateDestination()', $array);
if (null === $this->source) {
app('log')->error('Source is NULL, always FALSE.');
$this->destError = 'No source account validation has taken place yet. Please do this first or overrule the object.';
@@ -197,7 +197,7 @@ class AccountValidator
*/
public function validateSource(array $array): bool
{
- Log::debug('Now in AccountValidator::validateSource()', $array);
+ app('log')->debug('Now in AccountValidator::validateSource()', $array);
switch ($this->transactionType) {
default:
app('log')->error(sprintf('AccountValidator::validateSource cannot handle "%s", so it will do a generic check.', $this->transactionType));
@@ -220,7 +220,7 @@ class AccountValidator
break;
case TransactionType::RECONCILIATION:
- Log::debug('Calling validateReconciliationSource');
+ app('log')->debug('Calling validateReconciliationSource');
$result = $this->validateReconciliationSource($array);
break;
}
@@ -235,16 +235,16 @@ class AccountValidator
*/
protected function canCreateTypes(array $accountTypes): bool
{
- Log::debug('Can we create any of these types?', $accountTypes);
+ app('log')->debug('Can we create any of these types?', $accountTypes);
/** @var string $accountType */
foreach ($accountTypes as $accountType) {
if ($this->canCreateType($accountType)) {
- Log::debug(sprintf('YES, we can create a %s', $accountType));
+ app('log')->debug(sprintf('YES, we can create a %s', $accountType));
return true;
}
}
- Log::debug('NO, we cant create any of those.');
+ app('log')->debug('NO, we cant create any of those.');
return false;
}
@@ -273,7 +273,7 @@ class AccountValidator
*/
protected function findExistingAccount(array $validTypes, array $data, bool $inverse = false): ?Account
{
- Log::debug('Now in findExistingAccount', $data);
+ app('log')->debug('Now in findExistingAccount', $data);
app('log')->debug('The search will be reversed!');
$accountId = array_key_exists('id', $data) ? $data['id'] : null;
$accountIban = array_key_exists('iban', $data) ? $data['iban'] : null;
diff --git a/app/Validation/Administration/ValidatesAdministrationAccess.php b/app/Validation/Administration/ValidatesAdministrationAccess.php
index 2c6e66f56b..52ce30faf8 100644
--- a/app/Validation/Administration/ValidatesAdministrationAccess.php
+++ b/app/Validation/Administration/ValidatesAdministrationAccess.php
@@ -51,7 +51,7 @@ trait ValidatesAdministrationAccess
protected function validateAdministration(Validator $validator, array $allowedRoles): void
{
throw new FireflyException('deprecated method, must be done through user.');
- Log::debug('Now in validateAdministration()');
+ app('log')->debug('Now in validateAdministration()');
if (!auth()->check()) {
app('log')->error('User is not authenticated.');
throw new AuthenticationException('No access to validateAdministration() method.');
@@ -78,11 +78,11 @@ trait ValidatesAdministrationAccess
return;
}
if (in_array(UserRoleEnum::OWNER->value, $array, true)) {
- Log::debug('User is owner of this administration.');
+ app('log')->debug('User is owner of this administration.');
return;
}
if (in_array(UserRoleEnum::OWNER->value, $array, true)) {
- Log::debug('User has full access to this administration.');
+ app('log')->debug('User has full access to this administration.');
return;
}
$access = true;
diff --git a/app/Validation/CurrencyValidation.php b/app/Validation/CurrencyValidation.php
index ea963a6ff8..18849707d9 100644
--- a/app/Validation/CurrencyValidation.php
+++ b/app/Validation/CurrencyValidation.php
@@ -46,7 +46,7 @@ trait CurrencyValidation
if ($validator->errors()->count() > 0) {
return;
}
- Log::debug('Now in validateForeignCurrencyInformation()');
+ app('log')->debug('Now in validateForeignCurrencyInformation()');
$transactions = $this->getTransactionsArray($validator);
foreach ($transactions as $index => $transaction) {
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 4efc416f2a..7959141d28 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -474,33 +474,33 @@ class FireflyValidator extends Validator
{
// because a user does not have to be logged in (tests and what-not).
if (!auth()->check()) {
- Log::debug('validateUniqueAccountForUser::anon');
+ app('log')->debug('validateUniqueAccountForUser::anon');
return $this->validateAccountAnonymously();
}
if (array_key_exists('objectType', $this->data)) {
- Log::debug('validateUniqueAccountForUser::typeString');
+ app('log')->debug('validateUniqueAccountForUser::typeString');
return $this->validateByAccountTypeString($value, $parameters, $this->data['objectType']);
}
if (array_key_exists('type', $this->data)) {
- Log::debug('validateUniqueAccountForUser::typeString');
+ app('log')->debug('validateUniqueAccountForUser::typeString');
return $this->validateByAccountTypeString($value, $parameters, (string)$this->data['type']);
}
if (array_key_exists('account_type_id', $this->data)) {
- Log::debug('validateUniqueAccountForUser::typeId');
+ app('log')->debug('validateUniqueAccountForUser::typeId');
return $this->validateByAccountTypeId($value, $parameters);
}
$parameterId = $parameters[0] ?? null;
if (null !== $parameterId) {
- Log::debug('validateUniqueAccountForUser::paramId');
+ app('log')->debug('validateUniqueAccountForUser::paramId');
return $this->validateByParameterId((int)$parameterId, $value);
}
if (array_key_exists('id', $this->data)) {
- Log::debug('validateUniqueAccountForUser::accountId');
+ app('log')->debug('validateUniqueAccountForUser::accountId');
return $this->validateByAccountId($value);
}
// without type, just try to validate the name.
- Log::debug('validateUniqueAccountForUser::accountName');
+ app('log')->debug('validateUniqueAccountForUser::accountName');
return $this->validateByAccountName($value);
}
@@ -657,17 +657,17 @@ class FireflyValidator extends Validator
app('log')->warning(sprintf('Account number "%s" is not unique and account type "%s" cannot share its account number.', $value, $type));
return false;
}
- Log::debug(sprintf('Account number "%s" is not unique but account type "%s" may share its account number.', $value, $type));
+ app('log')->debug(sprintf('Account number "%s" is not unique but account type "%s" may share its account number.', $value, $type));
// one other account with this account number.
/** @var AccountMeta $entry */
foreach ($set as $entry) {
$otherAccount = $entry->account;
$otherType = (string)config(sprintf('firefly.shortNamesByFullName.%s', $otherAccount->accountType->type));
if (('expense' === $otherType || 'revenue' === $otherType) && $otherType !== $type) {
- Log::debug(sprintf('The other account with this account number is a "%s" so return true.', $otherType));
+ app('log')->debug(sprintf('The other account with this account number is a "%s" so return true.', $otherType));
return true;
}
- Log::debug(sprintf('The other account with this account number is a "%s" so return false.', $otherType));
+ app('log')->debug(sprintf('The other account with this account number is a "%s" so return false.', $otherType));
}
return false;
}
diff --git a/app/Validation/GroupValidation.php b/app/Validation/GroupValidation.php
index 29fb2511f3..5ff8512750 100644
--- a/app/Validation/GroupValidation.php
+++ b/app/Validation/GroupValidation.php
@@ -142,7 +142,7 @@ trait GroupValidation
if ($validator->errors()->count() > 0) {
return;
}
- Log::debug('Now in GroupValidation::validateDescriptions()');
+ app('log')->debug('Now in GroupValidation::validateDescriptions()');
$transactions = $this->getTransactionsArray($validator);
$validDescriptions = 0;
foreach ($transactions as $transaction) {
@@ -168,7 +168,7 @@ trait GroupValidation
if ($validator->errors()->count() > 0) {
return;
}
- Log::debug('Now in validateGroupDescription()');
+ app('log')->debug('Now in validateGroupDescription()');
$data = $validator->getData();
$transactions = $this->getTransactionsArray($validator);
@@ -188,12 +188,12 @@ trait GroupValidation
*/
protected function validateJournalIds(Validator $validator, TransactionGroup $transactionGroup): void
{
- Log::debug(sprintf('Now in GroupValidation::validateJournalIds(%d)', $transactionGroup->id));
+ app('log')->debug(sprintf('Now in GroupValidation::validateJournalIds(%d)', $transactionGroup->id));
$transactions = $this->getTransactionsArray($validator);
if (count($transactions) < 2) {
// no need for validation.
- Log::debug(sprintf('%d transaction(s) in submission, can skip this check.', count($transactions)));
+ app('log')->debug(sprintf('%d transaction(s) in submission, can skip this check.', count($transactions)));
return;
}
@@ -222,9 +222,9 @@ trait GroupValidation
if (array_key_exists('transaction_journal_id', $transaction)) {
$journalId = $transaction['transaction_journal_id'];
}
- Log::debug(sprintf('Now in validateJournalId(%d, %d)', $index, $journalId));
+ app('log')->debug(sprintf('Now in validateJournalId(%d, %d)', $index, $journalId));
if (0 === $journalId || '' === $journalId || '0' === $journalId) {
- Log::debug('Submitted 0, will accept to be used in a new transaction.');
+ app('log')->debug('Submitted 0, will accept to be used in a new transaction.');
return;
}
diff --git a/app/Validation/RecurrenceValidation.php b/app/Validation/RecurrenceValidation.php
index d87a7656be..251436c00a 100644
--- a/app/Validation/RecurrenceValidation.php
+++ b/app/Validation/RecurrenceValidation.php
@@ -53,17 +53,17 @@ trait RecurrenceValidation
// grab model from parameter and try to set the transaction type from it
if ('invalid' === $transactionType) {
- Log::debug('Type is invalid but we will search for it.');
+ app('log')->debug('Type is invalid but we will search for it.');
/** @var Recurrence $recurrence */
$recurrence = $this->route()->parameter('recurrence');
if (null !== $recurrence) {
- Log::debug('There is a recurrence in the route.');
+ app('log')->debug('There is a recurrence in the route.');
// ok so we have a recurrence should be able to extract type somehow.
/** @var RecurrenceTransaction|null $first */
$first = $recurrence->recurrenceTransactions()->first();
if (null !== $first) {
$transactionType = $first->transactionType ? $first->transactionType->type : 'withdrawal';
- Log::debug(sprintf('Determined type to be %s.', $transactionType));
+ app('log')->debug(sprintf('Determined type to be %s.', $transactionType));
}
if (null === $first) {
app('log')->warning('Just going to assume type is a withdrawal.');
@@ -77,7 +77,7 @@ trait RecurrenceValidation
/** @var AccountValidator $accountValidator */
$accountValidator = app(AccountValidator::class);
- Log::debug(sprintf('Going to loop %d transaction(s)', count($transactions)));
+ app('log')->debug(sprintf('Going to loop %d transaction(s)', count($transactions)));
foreach ($transactions as $index => $transaction) {
$transactionType = $transaction['type'] ?? $transactionType;
$accountValidator->setTransactionType($transactionType);
@@ -321,7 +321,7 @@ trait RecurrenceValidation
try {
Carbon::createFromFormat('Y-m-d', $moment);
} catch (InvalidArgumentException $e) {
- Log::debug(sprintf('Invalid argument for Carbon: %s', $e->getMessage()));
+ app('log')->debug(sprintf('Invalid argument for Carbon: %s', $e->getMessage()));
$validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment'));
}
}
@@ -334,7 +334,7 @@ trait RecurrenceValidation
*/
protected function validateTransactionId(Recurrence $recurrence, Validator $validator): void
{
- Log::debug('Now in validateTransactionId');
+ app('log')->debug('Now in validateTransactionId');
$transactions = $this->getTransactionData();
$submittedTrCount = count($transactions);
@@ -353,28 +353,28 @@ trait RecurrenceValidation
if (1 === $submittedTrCount && 1 === $originalTrCount) {
$first = $transactions[0]; // can safely assume index 0.
if (!array_key_exists('id', $first)) {
- Log::debug('Single count and no ID, done.');
+ app('log')->debug('Single count and no ID, done.');
return; // home safe!
}
$id = $first['id'];
if ('' === (string)$id) {
- Log::debug('Single count and empty ID, done.');
+ app('log')->debug('Single count and empty ID, done.');
return; // home safe!
}
$integer = (int)$id;
$secondCount = $recurrence->recurrenceTransactions()->where('recurrences_transactions.id', $integer)->count();
- Log::debug(sprintf('Result of ID count: %d', $secondCount));
+ app('log')->debug(sprintf('Result of ID count: %d', $secondCount));
if (0 === $secondCount) {
$validator->errors()->add('transactions.0.id', (string)trans('validation.id_does_not_match', ['id' => $integer]));
}
- Log::debug('Single ID validation done.');
+ app('log')->debug('Single ID validation done.');
return;
}
- Log::debug('Multi ID validation.');
+ app('log')->debug('Multi ID validation.');
$idsMandatory = false;
if ($submittedTrCount < $originalTrCount) {
- Log::debug(sprintf('User submits %d transaction, recurrence has %d transactions. All entries must have ID.', $submittedTrCount, $originalTrCount));
+ app('log')->debug(sprintf('User submits %d transaction, recurrence has %d transactions. All entries must have ID.', $submittedTrCount, $originalTrCount));
$idsMandatory = true;
}
/**
@@ -391,7 +391,7 @@ trait RecurrenceValidation
$unmatchedIds = 0;
foreach ($transactions as $index => $transaction) {
- Log::debug(sprintf('Now at %d/%d', $index + 1, $submittedTrCount));
+ app('log')->debug(sprintf('Now at %d/%d', $index + 1, $submittedTrCount));
if (!is_array($transaction)) {
app('log')->warning('Not an array. Give error.');
$validator->errors()->add(sprintf('transactions.%d.id', $index), (string)trans('validation.at_least_one_transaction'));
@@ -403,26 +403,26 @@ trait RecurrenceValidation
return;
}
if (array_key_exists('id', $transaction)) { // don't matter if $idsMandatory
- Log::debug('Array has ID.');
+ app('log')->debug('Array has ID.');
$idCount = $recurrence->recurrenceTransactions()->where('recurrences_transactions.id', (int)$transaction['id'])->count();
if (0 === $idCount) {
- Log::debug('ID does not exist or no match. Count another unmatched ID.');
+ app('log')->debug('ID does not exist or no match. Count another unmatched ID.');
$unmatchedIds++;
}
}
if (!array_key_exists('id', $transaction) && !$idsMandatory) {
- Log::debug('Array has no ID but was not mandatory at this point.');
+ app('log')->debug('Array has no ID but was not mandatory at this point.');
$unmatchedIds++;
}
}
// if too many don't match, but you haven't submitted more than already present:
$maxUnmatched = max(1, $submittedTrCount - $originalTrCount);
- Log::debug(sprintf('Submitted: %d. Original: %d. User can submit %d unmatched transactions.', $submittedTrCount, $originalTrCount, $maxUnmatched));
+ app('log')->debug(sprintf('Submitted: %d. Original: %d. User can submit %d unmatched transactions.', $submittedTrCount, $originalTrCount, $maxUnmatched));
if ($unmatchedIds > $maxUnmatched) {
app('log')->warning(sprintf('Too many unmatched transactions (%d).', $unmatchedIds));
$validator->errors()->add('transactions.0.id', (string)trans('validation.too_many_unmatched'));
return;
}
- Log::debug('Done with ID validation.');
+ app('log')->debug('Done with ID validation.');
}
}
diff --git a/app/Validation/TransactionValidation.php b/app/Validation/TransactionValidation.php
index 5e8fde3ade..8cf115085b 100644
--- a/app/Validation/TransactionValidation.php
+++ b/app/Validation/TransactionValidation.php
@@ -55,12 +55,12 @@ trait TransactionValidation
if ($validator->errors()->count() > 0) {
return;
}
- Log::debug('Now in validateAccountInformation (TransactionValidation) ()');
+ app('log')->debug('Now in validateAccountInformation (TransactionValidation) ()');
$transactions = $this->getTransactionsArray($validator);
$data = $validator->getData();
$transactionType = $data['type'] ?? 'invalid';
- Log::debug(sprintf('Going to loop %d transaction(s)', count($transactions)));
+ app('log')->debug(sprintf('Going to loop %d transaction(s)', count($transactions)));
/**
* @var int $index
* @var array $transaction
@@ -82,22 +82,22 @@ trait TransactionValidation
*/
protected function getTransactionsArray(Validator $validator): array
{
- Log::debug('Now in getTransactionsArray');
+ app('log')->debug('Now in getTransactionsArray');
$data = $validator->getData();
$transactions = [];
if (is_array($data) && array_key_exists('transactions', $data) && is_array($data['transactions'])) {
- Log::debug('Transactions key exists and is array.');
+ app('log')->debug('Transactions key exists and is array.');
$transactions = $data['transactions'];
}
if (is_array($data) && array_key_exists('transactions', $data) && !is_array($data['transactions'])) {
- Log::debug(sprintf('Transactions key exists but is NOT array, its a %s', gettype($data['transactions'])));
+ app('log')->debug(sprintf('Transactions key exists but is NOT array, its a %s', gettype($data['transactions'])));
}
// should be impossible to hit this:
if (!is_countable($transactions)) {
app('log')->error(sprintf('Transactions array is not countable, because its a %s', gettype($transactions)));
return [];
}
- //Log::debug('Returning transactions.', $transactions);
+ //app('log')->debug('Returning transactions.', $transactions);
return $transactions;
}
@@ -179,11 +179,11 @@ trait TransactionValidation
*/
protected function sanityCheckReconciliation(Validator $validator, string $transactionType, int $index, array $source, array $destination): void
{
- Log::debug('Now in sanityCheckReconciliation');
+ app('log')->debug('Now in sanityCheckReconciliation');
if (TransactionType::RECONCILIATION === ucfirst($transactionType) &&
null === $source['id'] && null === $source['name'] && null === $destination['id'] && null === $destination['name']
) {
- Log::debug('Both are NULL, error!');
+ app('log')->debug('Both are NULL, error!');
$validator->errors()->add(sprintf('transactions.%d.source_id', $index), trans('validation.reconciliation_either_account'));
$validator->errors()->add(sprintf('transactions.%d.source_name', $index), trans('validation.reconciliation_either_account'));
$validator->errors()->add(sprintf('transactions.%d.destination_id', $index), trans('validation.reconciliation_either_account'));
@@ -193,7 +193,7 @@ trait TransactionValidation
if (TransactionType::RECONCILIATION === $transactionType &&
(null !== $source['id'] || null !== $source['name']) &&
(null !== $destination['id'] || null !== $destination['name'])) {
- Log::debug('Both are not NULL, error!');
+ app('log')->debug('Both are not NULL, error!');
$validator->errors()->add(sprintf('transactions.%d.source_id', $index), trans('validation.reconciliation_either_account'));
$validator->errors()->add(sprintf('transactions.%d.source_name', $index), trans('validation.reconciliation_either_account'));
$validator->errors()->add(sprintf('transactions.%d.destination_id', $index), trans('validation.reconciliation_either_account'));
@@ -219,27 +219,27 @@ trait TransactionValidation
string $transactionType,
int $index
): void {
- Log::debug('Now in sanityCheckForeignCurrency()');
+ app('log')->debug('Now in sanityCheckForeignCurrency()');
if (0 !== $validator->errors()->count()) {
- Log::debug('Already have errors, return');
+ app('log')->debug('Already have errors, return');
return;
}
if (null === $accountValidator->source) {
- Log::debug('No source, return');
+ app('log')->debug('No source, return');
return;
}
if (null === $accountValidator->destination) {
- Log::debug('No destination, return');
+ app('log')->debug('No destination, return');
return;
}
$source = $accountValidator->source;
$destination = $accountValidator->destination;
- Log::debug(sprintf('Source: #%d "%s (%s)"', $source->id, $source->name, $source->accountType->type));
- Log::debug(sprintf('Destination: #%d "%s" (%s)', $destination->id, $destination->name, $source->accountType->type));
+ app('log')->debug(sprintf('Source: #%d "%s (%s)"', $source->id, $source->name, $source->accountType->type));
+ app('log')->debug(sprintf('Destination: #%d "%s" (%s)', $destination->id, $destination->name, $source->accountType->type));
if (!$this->isLiabilityOrAsset($source) || !$this->isLiabilityOrAsset($destination)) {
- Log::debug('Any account must be liability or asset account to continue.');
+ app('log')->debug('Any account must be liability or asset account to continue.');
return;
}
@@ -251,16 +251,16 @@ trait TransactionValidation
$destinationCurrency = $accountRepository->getAccountCurrency($destination) ?? $defaultCurrency;
// if both accounts have the same currency, continue.
if ($sourceCurrency->code === $destinationCurrency->code) {
- Log::debug('Both accounts have the same currency, continue.');
+ app('log')->debug('Both accounts have the same currency, continue.');
return;
}
- Log::debug(sprintf('Source account expects %s', $sourceCurrency->code));
- Log::debug(sprintf('Destination account expects %s', $destinationCurrency->code));
+ app('log')->debug(sprintf('Source account expects %s', $sourceCurrency->code));
+ app('log')->debug(sprintf('Destination account expects %s', $destinationCurrency->code));
- Log::debug(sprintf('Amount is %s', $transaction['amount']));
+ app('log')->debug(sprintf('Amount is %s', $transaction['amount']));
if (TransactionType::DEPOSIT === ucfirst($transactionType)) {
- Log::debug(sprintf('Processing as a "%s"', $transactionType));
+ app('log')->debug(sprintf('Processing as a "%s"', $transactionType));
// use case: deposit from liability account to an asset account
// the foreign amount must be in the currency of the source
// the amount must be in the currency of the destination
@@ -274,14 +274,14 @@ trait TransactionValidation
// wrong currency information is present
$foreignCurrencyCode = $transaction['foreign_currency_code'] ?? false;
$foreignCurrencyId = (int)($transaction['foreign_currency_id'] ?? 0);
- Log::debug(sprintf('Foreign currency code seems to be #%d "%s"', $foreignCurrencyId, $foreignCurrencyCode), $transaction);
+ app('log')->debug(sprintf('Foreign currency code seems to be #%d "%s"', $foreignCurrencyId, $foreignCurrencyCode), $transaction);
if ($foreignCurrencyCode !== $sourceCurrency->code && $foreignCurrencyId !== (int)$sourceCurrency->id) {
$validator->errors()->add(sprintf('transactions.%d.foreign_currency_code', $index), (string)trans('validation.require_foreign_src'));
return;
}
}
if (TransactionType::TRANSFER === ucfirst($transactionType) || TransactionType::WITHDRAWAL === ucfirst($transactionType)) {
- Log::debug(sprintf('Processing as a "%s"', $transactionType));
+ app('log')->debug(sprintf('Processing as a "%s"', $transactionType));
// use case: withdrawal from asset account to a liability account.
// the foreign amount must be in the currency of the destination
// the amount must be in the currency of the source
@@ -299,10 +299,10 @@ trait TransactionValidation
// wrong currency information is present
$foreignCurrencyCode = $transaction['foreign_currency_code'] ?? false;
$foreignCurrencyId = (int)($transaction['foreign_currency_id'] ?? 0);
- Log::debug(sprintf('Foreign currency code seems to be #%d "%s"', $foreignCurrencyId, $foreignCurrencyCode), $transaction);
+ app('log')->debug(sprintf('Foreign currency code seems to be #%d "%s"', $foreignCurrencyId, $foreignCurrencyCode), $transaction);
if ($foreignCurrencyCode !== $destinationCurrency->code && $foreignCurrencyId !== (int)$destinationCurrency->id) {
- Log::debug(sprintf('No match on code, "%s" vs "%s"', $foreignCurrencyCode, $destinationCurrency->code));
- Log::debug(sprintf('No match on ID, #%d vs #%d', $foreignCurrencyId, $destinationCurrency->id));
+ app('log')->debug(sprintf('No match on code, "%s" vs "%s"', $foreignCurrencyCode, $destinationCurrency->code));
+ app('log')->debug(sprintf('No match on ID, #%d vs #%d', $foreignCurrencyId, $destinationCurrency->id));
$validator->errors()->add(sprintf('transactions.%d.foreign_amount', $index), (string)trans('validation.require_foreign_dest'));
}
}
@@ -375,9 +375,9 @@ trait TransactionValidation
*/
public function validateAccountInformationUpdate(Validator $validator, TransactionGroup $transactionGroup): void
{
- Log::debug('Now in validateAccountInformationUpdate()');
+ app('log')->debug('Now in validateAccountInformationUpdate()');
if ($validator->errors()->count() > 0) {
- Log::debug('Validator already has errors, so return.');
+ app('log')->debug('Validator already has errors, so return.');
return;
}
@@ -403,7 +403,7 @@ trait TransactionValidation
*/
protected function validateSingleUpdate(Validator $validator, int $index, array $transaction, TransactionGroup $transactionGroup): void
{
- Log::debug('Now validating single account update in validateSingleUpdate()');
+ app('log')->debug('Now validating single account update in validateSingleUpdate()');
// if no account types are given, just skip the check.
if (
@@ -411,7 +411,7 @@ trait TransactionValidation
&& !array_key_exists('source_name', $transaction)
&& !array_key_exists('destination_id', $transaction)
&& !array_key_exists('destination_name', $transaction)) {
- Log::debug('No account data has been submitted so will not validating account info.');
+ app('log')->debug('No account data has been submitted so will not validating account info.');
return;
}
@@ -429,7 +429,7 @@ trait TransactionValidation
array_key_exists('source_iban', $transaction) ||
array_key_exists('source_number', $transaction)
) {
- Log::debug('Will try to validate source account information.');
+ app('log')->debug('Will try to validate source account information.');
$sourceId = (int)($transaction['source_id'] ?? 0);
$sourceName = $transaction['source_name'] ?? null;
$sourceIban = $transaction['source_iban'] ?? null;
@@ -448,7 +448,7 @@ trait TransactionValidation
return;
}
- Log::debug('Source account info is valid.');
+ app('log')->debug('Source account info is valid.');
}
if (
@@ -458,15 +458,15 @@ trait TransactionValidation
array_key_exists('destination_number', $transaction)
) {
- Log::debug('Will try to validate destination account information.');
+ app('log')->debug('Will try to validate destination account information.');
// at this point the validator may not have a source account, because it was never submitted for validation.
// must add it ourselves or the validator can never check if the destination is correct.
// the $transaction array must have a journal id or it's just one, this was validated before.
if (null === $accountValidator->source) {
- Log::debug('Account validator has no source account, must find it.');
+ app('log')->debug('Account validator has no source account, must find it.');
$source = $this->getOriginalSource($transaction, $transactionGroup);
if (null !== $source) {
- Log::debug('Found a source!');
+ app('log')->debug('Found a source!');
$accountValidator->source = $source;
}
}
@@ -482,9 +482,9 @@ trait TransactionValidation
$validator->errors()->add(sprintf('transactions.%d.destination_id', $index), $accountValidator->destError);
$validator->errors()->add(sprintf('transactions.%d.destination_name', $index), $accountValidator->destError);
}
- Log::debug('Destination account info is valid.');
+ app('log')->debug('Destination account info is valid.');
}
- Log::debug('Done with validateSingleUpdate().');
+ app('log')->debug('Done with validateSingleUpdate().');
}
/**
@@ -529,7 +529,7 @@ trait TransactionValidation
*/
public function validateOneRecurrenceTransaction(Validator $validator): void
{
- Log::debug('Now in validateOneRecurrenceTransaction()');
+ app('log')->debug('Now in validateOneRecurrenceTransaction()');
$transactions = $this->getTransactionsArray($validator);
// need at least one transaction
@@ -545,20 +545,20 @@ trait TransactionValidation
*/
public function validateOneTransaction(Validator $validator): void
{
- Log::debug('Now in validateOneTransaction');
+ app('log')->debug('Now in validateOneTransaction');
if ($validator->errors()->count() > 0) {
- Log::debug('Validator already has errors, so return.');
+ app('log')->debug('Validator already has errors, so return.');
return;
}
$transactions = $this->getTransactionsArray($validator);
// need at least one transaction
if (0 === count($transactions)) {
$validator->errors()->add('transactions.0.description', (string)trans('validation.at_least_one_transaction'));
- Log::debug('Added error: at_least_one_transaction.');
+ app('log')->debug('Added error: at_least_one_transaction.');
return;
}
- Log::debug('Added NO errors.');
+ app('log')->debug('Added NO errors.');
}
/**
@@ -573,7 +573,7 @@ trait TransactionValidation
foreach ($transactions as $key => $value) {
if (!is_int($key)) {
$validator->errors()->add('transactions.0.description', (string)trans('validation.at_least_one_transaction'));
- Log::debug('Added error: at_least_one_transaction.');
+ app('log')->debug('Added error: at_least_one_transaction.');
return;
}
@@ -590,7 +590,7 @@ trait TransactionValidation
if ($validator->errors()->count() > 0) {
return;
}
- Log::debug('Now in validateTransactionTypes()');
+ app('log')->debug('Now in validateTransactionTypes()');
$transactions = $this->getTransactionsArray($validator);
$types = [];
@@ -616,7 +616,7 @@ trait TransactionValidation
*/
public function validateTransactionTypesForUpdate(Validator $validator): void
{
- Log::debug('Now in validateTransactionTypesForUpdate()');
+ app('log')->debug('Now in validateTransactionTypesForUpdate()');
$transactions = $this->getTransactionsArray($validator);
$types = [];
foreach ($transactions as $transaction) {
@@ -631,7 +631,7 @@ trait TransactionValidation
return;
}
- Log::debug('No errors in validateTransactionTypesForUpdate()');
+ app('log')->debug('No errors in validateTransactionTypesForUpdate()');
}
/**
@@ -661,7 +661,7 @@ trait TransactionValidation
if ($validator->errors()->count() > 0) {
return;
}
- Log::debug('Now in validateEqualAccounts()');
+ app('log')->debug('Now in validateEqualAccounts()');
$transactions = $this->getTransactionsArray($validator);
// needs to be split
@@ -705,15 +705,15 @@ trait TransactionValidation
private function validateEqualAccountsForUpdate(Validator $validator, TransactionGroup $transactionGroup): void
{
if ($validator->errors()->count() > 0) {
- Log::debug('Validator already has errors, so return.');
+ app('log')->debug('Validator already has errors, so return.');
return;
}
- Log::debug('Now in validateEqualAccountsForUpdate()');
+ app('log')->debug('Now in validateEqualAccountsForUpdate()');
$transactions = $this->getTransactionsArray($validator);
if (2 !== count($transactions)) {
- Log::debug('Less than 2 transactions, do nothing.');
+ app('log')->debug('Less than 2 transactions, do nothing.');
return;
}
@@ -741,7 +741,7 @@ trait TransactionValidation
return;
}
- Log::debug('No errors found in validateEqualAccountsForUpdate');
+ app('log')->debug('No errors found in validateEqualAccountsForUpdate');
}
/**