Skip to content

Firefly III: a personal finances manager

Remove static references

James Cole075d459b7c76
diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php
index 1e2b2b45d7..65e06d6eb4 100644
--- a/app/Api/V1/Controllers/Controller.php
+++ b/app/Api/V1/Controllers/Controller.php
@@ -100,9 +100,9 @@ abstract class Controller extends BaseController
try {
$date = request()->query->get($field);
} catch (BadRequestException $e) {
- Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $field));
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $field));
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$value = null;
}
$obj = null;
@@ -129,9 +129,9 @@ abstract class Controller extends BaseController
try {
$value = request()->query->get($integer);
} catch (BadRequestException $e) {
- Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $integer));
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $integer));
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$value = null;
}
if (null !== $value) {
@@ -159,9 +159,9 @@ abstract class Controller extends BaseController
try {
$param = (string)request()->query->get('sort');
} catch (BadRequestException $e) {
- Log::error('Request field "sort" contains a non-scalar value. Value set to NULL.');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error('Request field "sort" contains a non-scalar value. Value set to NULL.');
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$param = '';
}
if ('' === $param) {
diff --git a/app/Api/V1/Controllers/Models/Attachment/StoreController.php b/app/Api/V1/Controllers/Models/Attachment/StoreController.php
index 6eeb9160c6..646d5d606e 100644
--- a/app/Api/V1/Controllers/Models/Attachment/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Attachment/StoreController.php
@@ -107,7 +107,7 @@ class StoreController extends Controller
$helper = app(AttachmentHelperInterface::class);
$body = $request->getContent();
if ('' === $body) {
- Log::error('Body of attachment is empty.');
+ app('log')->error('Body of attachment is empty.');
return response()->json([], 422);
}
diff --git a/app/Api/V1/Controllers/Models/Transaction/StoreController.php b/app/Api/V1/Controllers/Models/Transaction/StoreController.php
index 29c4a262e8..b6a9054d4a 100644
--- a/app/Api/V1/Controllers/Models/Transaction/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Transaction/StoreController.php
@@ -101,7 +101,7 @@ class StoreController extends Controller
throw new ValidationException($validator, 0, $e);
} catch (FireflyException $e) {
app('log')->warning('Caught an exception. Return error message.');
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
$message = sprintf('Internal exception: %s', $e->getMessage());
$validator = Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
throw new ValidationException($validator, 0, $e);
diff --git a/app/Api/V1/Controllers/System/ConfigurationController.php b/app/Api/V1/Controllers/System/ConfigurationController.php
index b91efd9360..e658293b1d 100644
--- a/app/Api/V1/Controllers/System/ConfigurationController.php
+++ b/app/Api/V1/Controllers/System/ConfigurationController.php
@@ -70,8 +70,8 @@ class ConfigurationController extends Controller
try {
$dynamicData = $this->getDynamicConfiguration();
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException('200030: Could not load config variables.', 0, $e);
}
$staticData = $this->getStaticConfiguration();
diff --git a/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php b/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php
index 07b29a7a60..df04dd975a 100644
--- a/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php
+++ b/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php
@@ -55,7 +55,7 @@ class TransactionRequest extends FormRequest
];
} catch (JsonException $e) {
// dont really care. the validation should catch invalid json.
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
}
return $data;
diff --git a/app/Api/V2/Controllers/Controller.php b/app/Api/V2/Controllers/Controller.php
index 6783b2e812..da20bea523 100644
--- a/app/Api/V2/Controllers/Controller.php
+++ b/app/Api/V2/Controllers/Controller.php
@@ -103,9 +103,9 @@ class Controller extends BaseController
try {
$date = request()->query->get($field);
} catch (BadRequestException $e) {
- Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $field));
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $field));
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
if (null !== $date) {
try {
@@ -128,8 +128,8 @@ class Controller extends BaseController
try {
$value = request()->query->get($integer);
} catch (BadRequestException $e) {
- Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $integer));
- Log::error($e->getMessage());
+ app('log')->error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $integer));
+ app('log')->error($e->getMessage());
$value = null;
}
if (null !== $value) {
diff --git a/app/Console/Commands/Correction/DeleteEmptyJournals.php b/app/Console/Commands/Correction/DeleteEmptyJournals.php
index 6adb592f83..8b0ad12e5f 100644
--- a/app/Console/Commands/Correction/DeleteEmptyJournals.php
+++ b/app/Console/Commands/Correction/DeleteEmptyJournals.php
@@ -82,7 +82,7 @@ class DeleteEmptyJournals extends Command
TransactionJournal::find((int)$row->transaction_journal_id)->delete();
} catch (QueryException $e) {
app('log')->info(sprintf('Could not delete journal: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
}
@@ -114,7 +114,7 @@ class DeleteEmptyJournals extends Command
TransactionJournal::find($entry->id)->delete();
} catch (QueryException $e) {
app('log')->info(sprintf('Could not delete entry: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
}
diff --git a/app/Console/Commands/Export/ExportData.php b/app/Console/Commands/Export/ExportData.php
index 8f0a03c9ef..fad7bd6581 100644
--- a/app/Console/Commands/Export/ExportData.php
+++ b/app/Console/Commands/Export/ExportData.php
@@ -203,7 +203,7 @@ class ExportData extends Command
try {
$date = Carbon::createFromFormat('!Y-m-d', $this->option($field));
} catch (InvalidArgumentException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
$this->friendlyError(sprintf('%s date "%s" must be formatted YYYY-MM-DD. Field will be ignored.', $field, $this->option('start')));
$error = true;
}
diff --git a/app/Console/Commands/System/ScanAttachments.php b/app/Console/Commands/System/ScanAttachments.php
index 7e2ab68231..d37721fa90 100644
--- a/app/Console/Commands/System/ScanAttachments.php
+++ b/app/Console/Commands/System/ScanAttachments.php
@@ -66,13 +66,13 @@ class ScanAttachments extends Command
$fileName = $attachment->fileName();
$encryptedContent = $disk->get($fileName);
if (null === $encryptedContent) {
- Log::error(sprintf('No content for attachment #%d under filename "%s"', $attachment->id, $fileName));
+ app('log')->error(sprintf('No content for attachment #%d under filename "%s"', $attachment->id, $fileName));
continue;
}
try {
$decryptedContent = Crypt::decrypt($encryptedContent); // verified
} catch (DecryptException $e) {
- Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
+ app('log')->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
$decryptedContent = $encryptedContent;
}
$tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII');
diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php
index bf9d13ada0..627624e3d3 100644
--- a/app/Console/Commands/Tools/Cron.php
+++ b/app/Console/Commands/Tools/Cron.php
@@ -84,8 +84,8 @@ class Cron extends Command
try {
$this->exchangeRatesCronJob($force, $date);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$this->friendlyError($e->getMessage());
}
}
@@ -96,8 +96,8 @@ class Cron extends Command
try {
$this->recurringCronJob($force, $date);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$this->friendlyError($e->getMessage());
}
@@ -107,8 +107,8 @@ class Cron extends Command
try {
$this->autoBudgetCronJob($force, $date);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$this->friendlyError($e->getMessage());
}
@@ -118,8 +118,8 @@ class Cron extends Command
try {
$this->billWarningCronJob($force, $date);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$this->friendlyError($e->getMessage());
}
diff --git a/app/Console/Commands/Upgrade/DecryptDatabase.php b/app/Console/Commands/Upgrade/DecryptDatabase.php
index 0f584f9296..0c4ca0be8e 100644
--- a/app/Console/Commands/Upgrade/DecryptDatabase.php
+++ b/app/Console/Commands/Upgrade/DecryptDatabase.php
@@ -116,7 +116,7 @@ class DecryptDatabase extends Command
try {
$configVar = app('fireflyconfig')->get($configName, false);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
}
if (null !== $configVar) {
return (bool)$configVar->data;
@@ -157,8 +157,8 @@ class DecryptDatabase extends Command
} catch (FireflyException $e) {
$message = sprintf('Could not decrypt field "%s" in row #%d of table "%s": %s', $field, $id, $table, $e->getMessage());
$this->friendlyError($message);
- Log::error($message);
- Log::error($e->getTraceAsString());
+ app('log')->error($message);
+ app('log')->error($e->getTraceAsString());
}
// A separate routine for preferences table:
diff --git a/app/Console/Commands/Upgrade/TransactionIdentifier.php b/app/Console/Commands/Upgrade/TransactionIdentifier.php
index 4f27a372ca..6a2f926cfd 100644
--- a/app/Console/Commands/Upgrade/TransactionIdentifier.php
+++ b/app/Console/Commands/Upgrade/TransactionIdentifier.php
@@ -171,7 +171,7 @@ class TransactionIdentifier extends Command
->whereNotIn('id', $exclude)
->first();
} catch (QueryException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
$this->friendlyError('Firefly III could not find the "identifier" field in the "transactions" table.');
$this->friendlyError(sprintf('This field is required for Firefly III version %s to run.', config('firefly.version')));
$this->friendlyError('Please run "php artisan migrate" to add this field to the table.');
diff --git a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php
index 556994f292..596230a2a1 100644
--- a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php
+++ b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php
@@ -319,7 +319,7 @@ class TransferCurrenciesCorrections extends Command
// source account must have a currency preference.
if (null === $this->sourceCurrency) {
$message = sprintf('Account #%d ("%s") must have currency preference but has none.', $this->sourceAccount->id, $this->sourceAccount->name);
- Log::error($message);
+ app('log')->error($message);
$this->friendlyError($message);
return true;
@@ -332,7 +332,7 @@ class TransferCurrenciesCorrections extends Command
$this->destinationAccount->id,
$this->destinationAccount->name
);
- Log::error($message);
+ app('log')->error($message);
$this->friendlyError($message);
return true;
diff --git a/app/Console/Commands/VerifiesAccessToken.php b/app/Console/Commands/VerifiesAccessToken.php
index d6c45610c3..020d6c8b83 100644
--- a/app/Console/Commands/VerifiesAccessToken.php
+++ b/app/Console/Commands/VerifiesAccessToken.php
@@ -78,19 +78,19 @@ trait VerifiesAccessToken
$user = $repository->find($userId);
if (null === $user) {
- Log::error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));
+ app('log')->error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));
return false;
}
$accessToken = app('preferences')->getForUser($user, 'access_token');
if (null === $accessToken) {
- Log::error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));
+ app('log')->error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));
return false;
}
if ($accessToken->data !== $token) {
- Log::error(sprintf('Invalid access token for user #%d.', $userId));
- Log::error(sprintf('Token given is "%s", expected something else.', $token));
+ app('log')->error(sprintf('Invalid access token for user #%d.', $userId));
+ app('log')->error(sprintf('Token given is "%s", expected something else.', $token));
return false;
}
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 3282712a95..810ee7c53b 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -54,7 +54,7 @@ class Kernel extends ConsoleKernel
{
$schedule->call(
static function () {
- Log::error(
+ app('log')->error(
'Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions at https://docs.firefly-iii.org/'
);
echo "\n";
diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php
index 94ba81ec38..2187ede071 100644
--- a/app/Exceptions/GracefulNotFoundHandler.php
+++ b/app/Exceptions/GracefulNotFoundHandler.php
@@ -157,7 +157,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
/** @var Account|null $account */
$account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);
if (null === $account) {
- Log::error(sprintf('Could not find account %d, so give big fat error.', $accountId));
+ app('log')->error(sprintf('Could not find account %d, so give big fat error.', $accountId));
return parent::render($request, $exception);
}
@@ -186,14 +186,14 @@ class GracefulNotFoundHandler extends ExceptionHandler
/** @var TransactionGroup|null $group */
$group = $user->transactionGroups()->withTrashed()->find($groupId);
if (null === $group) {
- Log::error(sprintf('Could not find group %d, so give big fat error.', $groupId));
+ app('log')->error(sprintf('Could not find group %d, so give big fat error.', $groupId));
return parent::render($request, $exception);
}
/** @var TransactionJournal|null $journal */
$journal = $group->transactionJournals()->withTrashed()->first();
if (null === $journal) {
- Log::error(sprintf('Could not find journal for group %d, so give big fat error.', $groupId));
+ app('log')->error(sprintf('Could not find journal for group %d, so give big fat error.', $groupId));
return parent::render($request, $exception);
}
@@ -224,7 +224,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
/** @var Attachment|null $attachment */
$attachment = $user->attachments()->withTrashed()->find($attachmentId);
if (null === $attachment) {
- Log::error(sprintf('Could not find attachment %d, so give big fat error.', $attachmentId));
+ app('log')->error(sprintf('Could not find attachment %d, so give big fat error.', $attachmentId));
return parent::render($request, $exception);
}
@@ -246,7 +246,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
}
}
- Log::error(sprintf('Could not redirect attachment %d, its linked to a %s.', $attachmentId, $attachment->attachable_type));
+ app('log')->error(sprintf('Could not redirect attachment %d, its linked to a %s.', $attachmentId, $attachment->attachable_type));
return parent::render($request, $exception);
}
diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php
index 080da2d31b..ad8ed0944a 100644
--- a/app/Factory/AccountFactory.php
+++ b/app/Factory/AccountFactory.php
@@ -228,16 +228,16 @@ class AccountFactory
try {
$this->storeOpeningBalance($account, $data);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
// create credit liability data (only liabilities)
try {
$this->storeCreditLiability($account, $data);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
// create notes
diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php
index 3e456c3e2a..265aa1b77c 100644
--- a/app/Factory/BillFactory.php
+++ b/app/Factory/BillFactory.php
@@ -80,8 +80,8 @@ class BillFactory
]
);
} catch (QueryException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException('400000: Could not store bill.', 0, $e);
}
diff --git a/app/Factory/CategoryFactory.php b/app/Factory/CategoryFactory.php
index e94ad3f50e..b3097be29c 100644
--- a/app/Factory/CategoryFactory.php
+++ b/app/Factory/CategoryFactory.php
@@ -76,8 +76,8 @@ class CategoryFactory
]
);
} catch (QueryException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException('400003: Could not store new category.', 0, $e);
}
}
diff --git a/app/Factory/PiggyBankEventFactory.php b/app/Factory/PiggyBankEventFactory.php
index 3489ef96ec..55dcdff4fe 100644
--- a/app/Factory/PiggyBankEventFactory.php
+++ b/app/Factory/PiggyBankEventFactory.php
@@ -54,7 +54,7 @@ class PiggyBankEventFactory
$repetition = $piggyRepos->getRepetition($piggyBank);
if (null === $repetition) {
- Log::error(sprintf('No piggy bank repetition on %s!', $journal->date->format('Y-m-d')));
+ app('log')->error(sprintf('No piggy bank repetition on %s!', $journal->date->format('Y-m-d')));
return;
}
diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.php
index a826b06a66..31d0bae80c 100644
--- a/app/Factory/RecurrenceFactory.php
+++ b/app/Factory/RecurrenceFactory.php
@@ -67,8 +67,8 @@ class RecurrenceFactory
$type = $this->findTransactionType(ucfirst($data['recurrence']['type']));
} catch (FireflyException $e) {
$message = sprintf('Cannot make a recurring transaction of type "%s"', $data['recurrence']['type']);
- Log::error($message);
- Log::error($e->getTraceAsString());
+ app('log')->error($message);
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($message, 0, $e);
}
@@ -129,8 +129,8 @@ class RecurrenceFactory
try {
$this->createTransactions($recurrence, $data['transactions'] ?? []);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$recurrence->forceDelete();
$message = sprintf('Could not create recurring transaction: %s', $e->getMessage());
$this->errors->add('store', $message);
diff --git a/app/Factory/TagFactory.php b/app/Factory/TagFactory.php
index dcfd9b8741..9261ac0de8 100644
--- a/app/Factory/TagFactory.php
+++ b/app/Factory/TagFactory.php
@@ -63,7 +63,7 @@ class TagFactory
]
);
if (null === $newTag) {
- Log::error(sprintf('TagFactory::findOrCreate("%s") but tag is unexpectedly NULL!', $tag));
+ app('log')->error(sprintf('TagFactory::findOrCreate("%s") but tag is unexpectedly NULL!', $tag));
return null;
}
diff --git a/app/Factory/TransactionCurrencyFactory.php b/app/Factory/TransactionCurrencyFactory.php
index 32bccaa0a4..28b2d9e2e5 100644
--- a/app/Factory/TransactionCurrencyFactory.php
+++ b/app/Factory/TransactionCurrencyFactory.php
@@ -67,8 +67,8 @@ class TransactionCurrencyFactory
);
} catch (QueryException $e) {
$result = null;
- Log::error(sprintf('Could not create new currency: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not create new currency: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
throw new FireflyException('400004: Could not store new currency.', 0, $e);
}
diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.php
index cc63aa1fc0..ca22f9dc39 100644
--- a/app/Factory/TransactionFactory.php
+++ b/app/Factory/TransactionFactory.php
@@ -107,9 +107,9 @@ class TransactionFactory
/** @var Transaction|null $result */
$result = Transaction::create($data);
} catch (QueryException $e) {
- Log::error(sprintf('Could not create transaction: %s', $e->getMessage()), $data);
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not create transaction: %s', $e->getMessage()), $data);
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Query exception when creating transaction: %s', $e->getMessage()), 0, $e);
}
if (null === $result) {
diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php
index 3ddda25d0f..5d0cd72159 100644
--- a/app/Factory/TransactionJournalFactory.php
+++ b/app/Factory/TransactionJournalFactory.php
@@ -110,7 +110,7 @@ class TransactionJournalFactory
$collection = new Collection();
$transactions = $dataObject['transactions'] ?? [];
if (0 === count($transactions)) {
- Log::error('There are no transactions in the array, the TransactionJournalFactory cannot continue.');
+ app('log')->error('There are no transactions in the array, the TransactionJournalFactory cannot continue.');
return new Collection();
}
@@ -123,19 +123,19 @@ class TransactionJournalFactory
$collection->push($journal);
}
if (null === $journal) {
- Log::error('The createJournal() method returned NULL. This may indicate an error.');
+ app('log')->error('The createJournal() method returned NULL. This may indicate an error.');
}
}
} catch (DuplicateTransactionException $e) {
app('log')->warning('TransactionJournalFactory::create() caught a duplicate journal in createJournal()');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$this->forceDeleteOnError($collection);
throw new DuplicateTransactionException($e->getMessage(), 0, $e);
} catch (FireflyException $e) {
app('log')->warning('TransactionJournalFactory::create() caught an exception.');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$this->forceDeleteOnError($collection);
throw new FireflyException($e->getMessage(), 0, $e);
}
@@ -174,8 +174,8 @@ class TransactionJournalFactory
// validate source and destination using a new Validator.
$this->validateAccounts($row);
} catch (FireflyException $e) {
- Log::error('Could not validate source or destination.');
- Log::error($e->getMessage());
+ app('log')->error('Could not validate source or destination.');
+ app('log')->error($e->getMessage());
return null;
}
@@ -250,9 +250,9 @@ class TransactionJournalFactory
try {
$negative = $transactionFactory->createNegative((string)$row['amount'], (string)$row['foreign_amount']);
} catch (FireflyException $e) {
- Log::error('Exception creating negative transaction.');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error('Exception creating negative transaction.');
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$this->forceDeleteOnError(new Collection([$journal]));
throw new FireflyException($e->getMessage(), 0, $e);
}
@@ -270,9 +270,9 @@ class TransactionJournalFactory
try {
$transactionFactory->createPositive((string)$row['amount'], (string)$row['foreign_amount']);
} catch (FireflyException $e) {
- Log::error('Exception creating positive transaction.');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error('Exception creating positive transaction.');
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
app('log')->warning('Delete negative transaction.');
$this->forceTrDelete($negative);
$this->forceDeleteOnError(new Collection([$journal]));
diff --git a/app/Generator/Report/Account/MonthReportGenerator.php b/app/Generator/Report/Account/MonthReportGenerator.php
index 8275835d8c..359c06583f 100644
--- a/app/Generator/Report/Account/MonthReportGenerator.php
+++ b/app/Generator/Report/Account/MonthReportGenerator.php
@@ -60,8 +60,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
->with('doubles', $this->expense)
->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.double.report: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render reports.double.report: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = sprintf('Could not render report view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php
index 4be0eb5313..4a19dccccc 100644
--- a/app/Generator/Report/Audit/MonthReportGenerator.php
+++ b/app/Generator/Report/Audit/MonthReportGenerator.php
@@ -98,8 +98,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.audit.report: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render reports.audit.report: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = sprintf('Could not render report view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php
index 477c2e1f68..f6357e4566 100644
--- a/app/Generator/Report/Budget/MonthReportGenerator.php
+++ b/app/Generator/Report/Budget/MonthReportGenerator.php
@@ -74,8 +74,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
->with('accounts', $this->accounts)
->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = sprintf('Could not render report view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php
index b7ed3cd4e5..ec43ddcb29 100644
--- a/app/Generator/Report/Category/MonthReportGenerator.php
+++ b/app/Generator/Report/Category/MonthReportGenerator.php
@@ -76,8 +76,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
->with('accounts', $this->accounts)
->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.category.month: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render reports.category.month: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = sprintf('Could not render report view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Generator/Report/Standard/MonthReportGenerator.php b/app/Generator/Report/Standard/MonthReportGenerator.php
index a79956d9b1..9d10247423 100644
--- a/app/Generator/Report/Standard/MonthReportGenerator.php
+++ b/app/Generator/Report/Standard/MonthReportGenerator.php
@@ -58,8 +58,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
try {
return view('reports.default.month', compact('accountIds', 'reportType'))->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render report view.';
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Generator/Report/Standard/MultiYearReportGenerator.php b/app/Generator/Report/Standard/MultiYearReportGenerator.php
index 9647dfd555..065f48c460 100644
--- a/app/Generator/Report/Standard/MultiYearReportGenerator.php
+++ b/app/Generator/Report/Standard/MultiYearReportGenerator.php
@@ -62,8 +62,8 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
compact('accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.default.multi-year: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render reports.default.multi-year: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = sprintf('Could not render report view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Generator/Report/Standard/YearReportGenerator.php b/app/Generator/Report/Standard/YearReportGenerator.php
index 8cd9c768eb..94b8010227 100644
--- a/app/Generator/Report/Standard/YearReportGenerator.php
+++ b/app/Generator/Report/Standard/YearReportGenerator.php
@@ -62,8 +62,8 @@ class YearReportGenerator implements ReportGeneratorInterface
compact('accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render report view.';
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.php
index 29ffb4ce91..8fe3bf5dd3 100644
--- a/app/Generator/Report/Tag/MonthReportGenerator.php
+++ b/app/Generator/Report/Tag/MonthReportGenerator.php
@@ -70,8 +70,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
compact('accountIds', 'reportType', 'tagIds')
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.tag.month: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render reports.tag.month: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = sprintf('Could not render report view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Generator/Webhook/StandardMessageGenerator.php b/app/Generator/Webhook/StandardMessageGenerator.php
index d4fdbd8788..418f9dca4c 100644
--- a/app/Generator/Webhook/StandardMessageGenerator.php
+++ b/app/Generator/Webhook/StandardMessageGenerator.php
@@ -144,7 +144,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
switch ($class) {
default:
// Line is ignored because all of Firefly III's Models have an id property.
- Log::error(
+ app('log')->error(
sprintf('Webhook #%d was given %s#%d to deal with but can\'t extract user ID from it.', $webhook->id, $class, $model->id)
);
@@ -158,7 +158,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
// then depends on the response what to put in the message:
switch ($webhook->response) {
default:
- Log::error(
+ app('log')->error(
sprintf('The response code for webhook #%d is "%d" and the message generator cant handle it. Soft fail.', $webhook->id, $webhook->response)
);
@@ -171,10 +171,10 @@ class StandardMessageGenerator implements MessageGeneratorInterface
try {
$basicMessage['content'] = $transformer->transformObject($model);
} catch (FireflyException $e) {
- Log::error(
+ app('log')->error(
sprintf('The transformer could not include the requested transaction group for webhook #%d: %s', $webhook->id, $e->getMessage())
);
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
return;
}
diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.php
index 2938bdc1f5..d29eca035f 100644
--- a/app/Handlers/Events/APIEventHandler.php
+++ b/app/Handlers/Events/APIEventHandler.php
@@ -61,8 +61,8 @@ class APIEventHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
}
diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php
index 0bcb9b264a..900a04c6f0 100644
--- a/app/Handlers/Events/AdminEventHandler.php
+++ b/app/Handlers/Events/AdminEventHandler.php
@@ -69,8 +69,8 @@ class AdminEventHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
}
@@ -107,8 +107,8 @@ class AdminEventHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
}
@@ -141,8 +141,8 @@ class AdminEventHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
}
diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.php
index 4b761f92a7..f67f3fec0e 100644
--- a/app/Handlers/Events/AutomationHandler.php
+++ b/app/Handlers/Events/AutomationHandler.php
@@ -85,8 +85,8 @@ class AutomationHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
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 d3e5f99017..c209fc09ef 100644
--- a/app/Handlers/Events/BillEventHandler.php
+++ b/app/Handlers/Events/BillEventHandler.php
@@ -63,8 +63,8 @@ class BillEventHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
if (false === $preference) {
diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php
index b3166c37ef..158ac44faa 100644
--- a/app/Handlers/Events/UserEventHandler.php
+++ b/app/Handlers/Events/UserEventHandler.php
@@ -99,7 +99,7 @@ class UserEventHandler
if (null === $role) {
// create role, does not exist. Very strange situation so let's raise a big fuss about it.
$role = $repository->createRole('owner', 'Site Owner', 'User runs this instance of FF3');
- Log::error('Could not find role "owner". This is weird.');
+ app('log')->error('Could not find role "owner". This is weird.');
}
app('log')->info(sprintf('Gave user #%d role #%d ("%s")', $user->id, $role->id, $role->name));
@@ -214,8 +214,8 @@ class UserEventHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
$list[$index]['notified'] = true;
@@ -248,8 +248,8 @@ class UserEventHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
}
@@ -275,8 +275,8 @@ class UserEventHandler
try {
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $url));
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($e->getMessage(), 0, $e);
}
}
@@ -300,8 +300,8 @@ class UserEventHandler
try {
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $url));
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($e->getMessage(), 0, $e);
}
}
@@ -325,8 +325,8 @@ class UserEventHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
@@ -344,8 +344,8 @@ class UserEventHandler
try {
Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url));
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($e->getMessage(), 0, $e);
}
}
@@ -373,8 +373,8 @@ class UserEventHandler
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
}
@@ -399,7 +399,7 @@ class UserEventHandler
$preference = app('preferences')->getForUser($user, 'login_ip_history', [])->data;
} catch (FireflyException $e) {
// don't care.
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
return;
}
diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php
index 8c9c038992..84f65ffb36 100644
--- a/app/Helpers/Attachments/AttachmentHelper.php
+++ b/app/Helpers/Attachments/AttachmentHelper.php
@@ -80,7 +80,7 @@ class AttachmentHelper implements AttachmentHelperInterface
try {
$unencryptedData = Crypt::decrypt($encryptedData); // verified
} catch (DecryptException $e) {
- Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
+ app('log')->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
$unencryptedData = $encryptedData;
}
@@ -141,13 +141,13 @@ class AttachmentHelper implements AttachmentHelperInterface
{
$resource = tmpfile();
if (false === $resource) {
- Log::error('Cannot create temp-file for file upload.');
+ app('log')->error('Cannot create temp-file for file upload.');
return false;
}
if ('' === $content) {
- Log::error('Cannot upload empty file.');
+ app('log')->error('Cannot upload empty file.');
return false;
}
@@ -158,7 +158,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$mime = finfo_file($finfo, $path);
$allowedMime = config('firefly.allowedMimes');
if (!in_array($mime, $allowedMime, true)) {
- Log::error(sprintf('Mime type %s is not allowed for API file upload.', $mime));
+ app('log')->error(sprintf('Mime type %s is not allowed for API file upload.', $mime));
fclose($resource);
return false;
@@ -284,7 +284,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$result = false;
}
if (0 === $file->getSize()) {
- Log::error('Cannot upload empty file.');
+ app('log')->error('Cannot upload empty file.');
$result = false;
}
@@ -320,7 +320,7 @@ class AttachmentHelper implements AttachmentHelperInterface
if (!in_array($mime, $this->allowedMimes, true)) {
$msg = (string)trans('validation.file_invalid_mime', ['name' => $name, 'mime' => $mime]);
$this->errors->add('attachments', $msg);
- Log::error($msg);
+ app('log')->error($msg);
$result = false;
}
@@ -344,7 +344,7 @@ class AttachmentHelper implements AttachmentHelperInterface
if ($size > $this->maxUploadSize) {
$msg = (string)trans('validation.file_too_large', ['name' => $name]);
$this->errors->add('attachments', $msg);
- Log::error($msg);
+ app('log')->error($msg);
$result = false;
}
@@ -377,7 +377,7 @@ class AttachmentHelper implements AttachmentHelperInterface
if ($count > 0) {
$msg = (string)trans('validation.file_already_attached', ['name' => $name]);
$this->errors->add('attachments', $msg);
- Log::error($msg);
+ app('log')->error($msg);
$result = true;
}
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index eee489d612..535455773f 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -627,7 +627,7 @@ class GroupCollector implements GroupCollectorInterface
$result['created_at']->setTimezone(config('app.timezone'));
$result['updated_at']->setTimezone(config('app.timezone'));
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException($e->getMessage(), 0, $e);
}
diff --git a/app/Helpers/Webhook/Sha3SignatureGenerator.php b/app/Helpers/Webhook/Sha3SignatureGenerator.php
index c51edf0a4f..90a18a8c28 100644
--- a/app/Helpers/Webhook/Sha3SignatureGenerator.php
+++ b/app/Helpers/Webhook/Sha3SignatureGenerator.php
@@ -50,10 +50,10 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface
try {
$json = json_encode($message->message, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
- Log::error('Could not generate hash.');
- Log::error(sprintf('JSON value: %s', $json));
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error('Could not generate hash.');
+ app('log')->error(sprintf('JSON value: %s', $json));
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException('Could not generate JSON for SHA3 hash.', 0, $e);
}
diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php
index ab3354b0e4..28b9dc41d3 100644
--- a/app/Http/Controllers/Auth/ForgotPasswordController.php
+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php
@@ -71,7 +71,7 @@ class ForgotPasswordController extends Controller
app('log')->info('Start of sendResetLinkEmail()');
if ('web' !== config('firefly.authentication_guard')) {
$message = sprintf('Cannot reset password when authenticating over "%s".', config('firefly.authentication_guard'));
- Log::error($message);
+ app('log')->error($message);
return view('error', compact('message'));
}
@@ -92,7 +92,7 @@ class ForgotPasswordController extends Controller
// need to show to the user. Finally, we'll send out a proper response.
$result = $this->broker()->sendResetLink($request->only('email'));
if ('passwords.throttled' === $result) {
- Log::error(sprintf('Cowardly refuse to send a password reset message to user #%d because the reset button has been throttled.', $user->id));
+ app('log')->error(sprintf('Cowardly refuse to send a password reset message to user #%d because the reset button has been throttled.', $user->id));
}
// always send the same response to the user:
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index c06b0af31d..e62b6d22e5 100644
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -98,7 +98,7 @@ class LoginController extends Controller
// the IP address of the client making these requests into this application.
if (method_exists($this, 'hasTooManyLoginAttempts') && $this->hasTooManyLoginAttempts($request)) {
Log::channel('audit')->info(sprintf('Login for user "%s" was locked out.', $request->get($this->username())));
- Log::error(sprintf('Login for user "%s" was locked out.', $request->get($this->username())));
+ app('log')->error(sprintf('Login for user "%s" was locked out.', $request->get($this->username())));
$this->fireLockoutEvent($request);
$this->sendLockoutResponse($request);
diff --git a/app/Http/Controllers/Bill/CreateController.php b/app/Http/Controllers/Bill/CreateController.php
index 8dfdde0f48..f6d78b89a7 100644
--- a/app/Http/Controllers/Bill/CreateController.php
+++ b/app/Http/Controllers/Bill/CreateController.php
@@ -107,7 +107,7 @@ class CreateController extends Controller
try {
$bill = $this->repository->store($billData);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
$request->session()->flash('error', (string)trans('firefly.bill_store_error'));
return redirect(route('bills.create'))->withInput();
diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php
index 775bae91fd..40325d3410 100644
--- a/app/Http/Controllers/DebugController.php
+++ b/app/Http/Controllers/DebugController.php
@@ -73,7 +73,7 @@ class DebugController extends Controller
app('log')->info('This is a test message at the INFO level.');
Log::notice('This is a test message at the NOTICE level.');
app('log')->warning('This is a test message at the WARNING level.');
- Log::error('This is a test message at the ERROR level.');
+ app('log')->error('This is a test message at the ERROR level.');
Log::critical('This is a test message at the CRITICAL level.');
Log::alert('This is a test message at the ALERT level.');
Log::emergency('This is a test message at the EMERGENCY level.');
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 69a2d2d2aa..f9ef75ac2b 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -71,14 +71,14 @@ class HomeController extends Controller
$stringStart = e((string)$request->get('start'));
$start = Carbon::createFromFormat('Y-m-d', $stringStart);
} catch (InvalidFormatException $e) {
- Log::error(sprintf('Start: could not parse date string "%s" so ignore it.', $stringStart));
+ app('log')->error(sprintf('Start: could not parse date string "%s" so ignore it.', $stringStart));
$start = Carbon::now()->startOfMonth();
}
try {
$stringEnd = e((string)$request->get('end'));
$end = Carbon::createFromFormat('Y-m-d', $stringEnd);
} catch (InvalidFormatException $e) {
- Log::error(sprintf('End could not parse date string "%s" so ignore it.', $stringEnd));
+ app('log')->error(sprintf('End could not parse date string "%s" so ignore it.', $stringEnd));
$end = Carbon::now()->endOfMonth();
}
$label = $request->get('label');
diff --git a/app/Http/Controllers/Json/FrontpageController.php b/app/Http/Controllers/Json/FrontpageController.php
index 3ae35b987e..eabfd49f86 100644
--- a/app/Http/Controllers/Json/FrontpageController.php
+++ b/app/Http/Controllers/Json/FrontpageController.php
@@ -74,8 +74,8 @@ class FrontpageController extends Controller
try {
$html = view('json.piggy-banks', compact('info'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$html = 'Could not render view.';
throw new FireflyException($html, 0, $e);
}
diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php
index d9d2bc1136..ac89ca131d 100644
--- a/app/Http/Controllers/Json/ReconcileController.php
+++ b/app/Http/Controllers/Json/ReconcileController.php
@@ -157,7 +157,7 @@ class ReconcileController extends Controller
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('View error: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
$view = sprintf('Could not render accounts.reconcile.overview: %s', $e->getMessage());
throw new FireflyException($view, 0, $e);
}
@@ -259,7 +259,7 @@ class ReconcileController extends Controller
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ 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/RuleController.php b/app/Http/Controllers/Json/RuleController.php
index 9a2a9d6d1f..e3cf36e10d 100644
--- a/app/Http/Controllers/Json/RuleController.php
+++ b/app/Http/Controllers/Json/RuleController.php
@@ -54,8 +54,8 @@ class RuleController extends Controller
try {
$view = view('rules.partials.action', compact('actions', 'count'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$view = 'Could not render view.';
throw new FireflyException($view, 0, $e);
}
@@ -86,8 +86,8 @@ class RuleController extends Controller
try {
$view = view('rules.partials.trigger', compact('triggers', 'count'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$view = 'Could not render view.';
throw new FireflyException($view, 0, $e);
}
diff --git a/app/Http/Controllers/PiggyBank/AmountController.php b/app/Http/Controllers/PiggyBank/AmountController.php
index ec59780b2e..69a241eaf3 100644
--- a/app/Http/Controllers/PiggyBank/AmountController.php
+++ b/app/Http/Controllers/PiggyBank/AmountController.php
@@ -140,7 +140,7 @@ class AmountController extends Controller
return redirect(route('piggy-banks.index'));
}
- Log::error('Cannot add ' . $amount . ' because canAddAmount returned false.');
+ app('log')->error('Cannot add ' . $amount . ' because canAddAmount returned false.');
session()->flash(
'error',
(string)trans(
diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php
index aec2828524..4e721b7038 100644
--- a/app/Http/Controllers/PreferencesController.php
+++ b/app/Http/Controllers/PreferencesController.php
@@ -124,7 +124,7 @@ class PreferencesController extends Controller
try {
$locales = json_decode(file_get_contents(resource_path(sprintf('lang/%s/locales.json', $language))), true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
$locales = [];
}
$locales = ['equal' => (string)trans('firefly.equal_to_language')] + $locales;
diff --git a/app/Http/Controllers/Report/AccountController.php b/app/Http/Controllers/Report/AccountController.php
index 323f289fa7..7f536e5a30 100644
--- a/app/Http/Controllers/Report/AccountController.php
+++ b/app/Http/Controllers/Report/AccountController.php
@@ -65,8 +65,8 @@ class AccountController extends Controller
try {
$result = view('reports.partials.accounts', compact('accountReport'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.accounts: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not render reports.partials.accounts: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Http/Controllers/Report/BalanceController.php b/app/Http/Controllers/Report/BalanceController.php
index b5f17b782c..4a4b51f0e3 100644
--- a/app/Http/Controllers/Report/BalanceController.php
+++ b/app/Http/Controllers/Report/BalanceController.php
@@ -141,8 +141,8 @@ class BalanceController extends Controller
try {
$result = view('reports.partials.balance', compact('report'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.balance: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not render reports.partials.balance: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Http/Controllers/Report/BillController.php b/app/Http/Controllers/Report/BillController.php
index bc143c05ff..9dfd858100 100644
--- a/app/Http/Controllers/Report/BillController.php
+++ b/app/Http/Controllers/Report/BillController.php
@@ -61,8 +61,8 @@ class BillController extends Controller
try {
$result = view('reports.partials.bills', compact('report'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budgets: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not render reports.partials.budgets: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.php
index e4d3dea46d..5a1e4b7b01 100644
--- a/app/Http/Controllers/Report/BudgetController.php
+++ b/app/Http/Controllers/Report/BudgetController.php
@@ -195,9 +195,9 @@ class BudgetController extends Controller
try {
$result = view('reports.budget.partials.avg-expenses', compact('result'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($result, 0, $e);
}
@@ -354,8 +354,8 @@ class BudgetController extends Controller
try {
$result = view('reports.partials.budget-period', compact('report', 'periods'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
@@ -408,7 +408,7 @@ class BudgetController extends Controller
try {
$result = view('reports.budget.partials.top-expenses', compact('result'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->error(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/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php
index bced1f2231..0603f0aebf 100644
--- a/app/Http/Controllers/Report/CategoryController.php
+++ b/app/Http/Controllers/Report/CategoryController.php
@@ -315,7 +315,7 @@ class CategoryController extends Controller
try {
$result = view('reports.category.partials.avg-expenses', compact('result'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->error(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);
}
@@ -368,7 +368,7 @@ class CategoryController extends Controller
try {
$result = view('reports.category.partials.avg-income', compact('result'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->error(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);
}
@@ -553,7 +553,7 @@ class CategoryController extends Controller
try {
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
@@ -632,7 +632,7 @@ class CategoryController extends Controller
try {
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
@@ -678,7 +678,7 @@ class CategoryController extends Controller
$result = (string)view('reports.partials.categories', compact('report'))->render();
$cache->store($result);
} catch (Throwable $e) {
- Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Http/Controllers/Report/DoubleController.php b/app/Http/Controllers/Report/DoubleController.php
index c72eb63732..668a223f82 100644
--- a/app/Http/Controllers/Report/DoubleController.php
+++ b/app/Http/Controllers/Report/DoubleController.php
@@ -115,7 +115,7 @@ class DoubleController extends Controller
try {
$result = view('reports.double.partials.avg-expenses', compact('result'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->error(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);
}
@@ -168,7 +168,7 @@ class DoubleController extends Controller
try {
$result = view('reports.double.partials.avg-income', compact('result'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->error(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);
}
@@ -463,7 +463,7 @@ class DoubleController extends Controller
try {
$result = view('reports.double.partials.top-expenses', compact('result'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->error(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);
}
@@ -514,7 +514,7 @@ class DoubleController extends Controller
try {
$result = view('reports.double.partials.top-income', compact('result'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
+ app('log')->error(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/OperationsController.php b/app/Http/Controllers/Report/OperationsController.php
index 9eb7d89b40..8b9712bd14 100644
--- a/app/Http/Controllers/Report/OperationsController.php
+++ b/app/Http/Controllers/Report/OperationsController.php
@@ -85,8 +85,8 @@ class OperationsController extends Controller
try {
$result = view('reports.partials.income-expenses', compact('report', 'type'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.income-expense: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not render reports.partials.income-expense: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
@@ -122,8 +122,8 @@ class OperationsController extends Controller
try {
$result = view('reports.partials.income-expenses', compact('report', 'type'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.income-expenses: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not render reports.partials.income-expenses: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
@@ -179,8 +179,8 @@ class OperationsController extends Controller
try {
$result = view('reports.partials.operations', compact('sums'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render reports.partials.operations: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not render reports.partials.operations: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Http/Controllers/Rule/EditController.php b/app/Http/Controllers/Rule/EditController.php
index de93bb2839..0c8dec18ec 100644
--- a/app/Http/Controllers/Rule/EditController.php
+++ b/app/Http/Controllers/Rule/EditController.php
@@ -174,7 +174,7 @@ class EditController extends Controller
} catch (Throwable $e) {
$message = sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage());
Log::debug($message);
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($message, 0, $e);
}
$index++;
diff --git a/app/Http/Controllers/Rule/SelectController.php b/app/Http/Controllers/Rule/SelectController.php
index 89a3317702..d0eb595357 100644
--- a/app/Http/Controllers/Rule/SelectController.php
+++ b/app/Http/Controllers/Rule/SelectController.php
@@ -183,8 +183,8 @@ class SelectController extends Controller
try {
$view = view('list.journals-array-tiny', ['groups' => $collection])->render();
} catch (Throwable $exception) {
- Log::error(sprintf('Could not render view in testTriggers(): %s', $exception->getMessage()));
- Log::error($exception->getTraceAsString());
+ app('log')->error(sprintf('Could not render view in testTriggers(): %s', $exception->getMessage()));
+ app('log')->error($exception->getTraceAsString());
$view = sprintf('Could not render list.journals-tiny: %s', $exception->getMessage());
throw new FireflyException($view, 0, $exception);
}
@@ -227,8 +227,8 @@ class SelectController extends Controller
$view = view('list.journals-array-tiny', ['groups' => $collection])->render();
} catch (Throwable $exception) {
$message = sprintf('Could not render view in testTriggersByRule(): %s', $exception->getMessage());
- Log::error($message);
- Log::error($exception->getTraceAsString());
+ app('log')->error($message);
+ app('log')->error($exception->getTraceAsString());
throw new FireflyException($message, 0, $exception);
}
diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php
index 5963f8eb5e..181c094157 100644
--- a/app/Http/Controllers/SearchController.php
+++ b/app/Http/Controllers/SearchController.php
@@ -127,8 +127,8 @@ class SearchController extends Controller
try {
$html = view('search.search', compact('groups', 'hasPages', 'searchTime'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render search.search: %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Cannot render search.search: %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$html = 'Could not render view.';
throw new FireflyException($html, 0, $e);
}
diff --git a/app/Http/Controllers/System/CronController.php b/app/Http/Controllers/System/CronController.php
index 1e9c80f9dd..3152be4563 100644
--- a/app/Http/Controllers/System/CronController.php
+++ b/app/Http/Controllers/System/CronController.php
@@ -38,7 +38,7 @@ class CronController
*/
public function cron()
{
- Log::error('The cron endpoint has moved to GET /api/v1/cron/[token]');
+ app('log')->error('The cron endpoint has moved to GET /api/v1/cron/[token]');
return response('The cron endpoint has moved to GET /api/v1/cron/[token]', 500);
}
diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php
index f9b30a0464..03c87ace86 100644
--- a/app/Http/Controllers/System/InstallController.php
+++ b/app/Http/Controllers/System/InstallController.php
@@ -116,8 +116,8 @@ class InstallController extends Controller
try {
$result = $this->executeCommand($command, $parameters);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
if (strpos($e->getMessage(), 'open_basedir restriction in effect')) {
$this->lastError = self::BASEDIR_ERROR;
}
diff --git a/app/Http/Controllers/TransactionCurrency/CreateController.php b/app/Http/Controllers/TransactionCurrency/CreateController.php
index c3be3b01f2..7f1967ec8d 100644
--- a/app/Http/Controllers/TransactionCurrency/CreateController.php
+++ b/app/Http/Controllers/TransactionCurrency/CreateController.php
@@ -111,7 +111,7 @@ class CreateController extends Controller
$user = auth()->user();
$data = $request->getCurrencyData();
if (!$this->userRepository->hasRole($user, 'owner')) {
- Log::error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.');
+ app('log')->error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.');
Log::channel('audit')->info('Tried to create (POST) currency without admin rights.', $data);
return redirect($this->getPreviousUrl('currencies.create.url'))->withInput();
@@ -121,7 +121,7 @@ class CreateController extends Controller
try {
$currency = $this->repository->store($data);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
Log::channel('audit')->info('Could not store (POST) currency without admin rights.', $data);
$request->session()->flash('error', (string)trans('firefly.could_not_store_currency'));
$currency = null;
diff --git a/app/Http/Middleware/Installer.php b/app/Http/Middleware/Installer.php
index bcea75b6d5..9979ca63d7 100644
--- a/app/Http/Middleware/Installer.php
+++ b/app/Http/Middleware/Installer.php
@@ -92,7 +92,7 @@ class Installer
DB::table('users')->count();
} catch (QueryException $e) {
$message = $e->getMessage();
- Log::error(sprintf('Error message trying to access users-table: %s', $message));
+ app('log')->error(sprintf('Error message trying to access users-table: %s', $message));
if ($this->isAccessDenied($message)) {
throw new FireflyException(
'It seems your database configuration is not correct. Please verify the username and password in your .env file.',
diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php
index 997dcd218a..5e6456d6b7 100644
--- a/app/Http/Middleware/Range.php
+++ b/app/Http/Middleware/Range.php
@@ -108,7 +108,7 @@ class Range
// send error to view, if could not set money format
if (false === $moneyResult) {
- Log::error('Could not set locale. The following array doesnt work: ', $localeArray);
+ app('log')->error('Could not set locale. The following array doesnt work: ', $localeArray);
app('view')->share('invalidMonetaryLocale', true);
}
diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php
index 94e6f83f64..d562a4474f 100644
--- a/app/Http/Requests/ReportFormRequest.php
+++ b/app/Http/Requests/ReportFormRequest.php
@@ -157,14 +157,14 @@ class ReportFormRequest extends FormRequest
$date = new Carbon($parts[1]);
} catch (Exception $e) { // intentional generic exception
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
- Log::error($error);
- Log::error($e->getTraceAsString());
+ app('log')->error($error);
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($error, 0, $e);
}
return $date;
}
$error = sprintf('"%s" is not a valid date range: %s', $range, 'invalid format :(');
- Log::error($error);
+ app('log')->error($error);
throw new FireflyException($error, 0);
}
return $date;
@@ -192,14 +192,14 @@ class ReportFormRequest extends FormRequest
$date = new Carbon($parts[0]);
} catch (Exception $e) { // intentional generic exception
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
- Log::error($error);
- Log::error($e->getTraceAsString());
+ app('log')->error($error);
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($error, 0, $e);
}
return $date;
}
$error = sprintf('"%s" is not a valid date range: %s', $range, 'invalid format :(');
- Log::error($error);
+ app('log')->error($error);
throw new FireflyException($error, 0);
}
@@ -221,7 +221,7 @@ class ReportFormRequest extends FormRequest
Log::debug('Set is:', $set);
}
if (!is_array($set)) {
- Log::error(sprintf('Set is not an array! "%s"', $set));
+ app('log')->error(sprintf('Set is not an array! "%s"', $set));
return $collection;
}
foreach ($set as $tagTag) {
diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.php
index 7ae831b0cc..d5791e956e 100644
--- a/app/Jobs/CreateRecurringTransactions.php
+++ b/app/Jobs/CreateRecurringTransactions.php
@@ -417,7 +417,7 @@ class CreateRecurringTransactions implements ShouldQueue
$groupTitle = $first->description;
}
if (0 === $count) {
- Log::error('No transactions to be created in this recurrence. Cannot continue.');
+ app('log')->error('No transactions to be created in this recurrence. Cannot continue.');
return null;
}
diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php
index 4f235ea29e..f307929abc 100644
--- a/app/Jobs/MailError.php
+++ b/app/Jobs/MailError.php
@@ -65,7 +65,7 @@ class MailError extends Job implements ShouldQueue
$debug = $exceptionData;
unset($debug['stackTrace']);
unset($debug['headers']);
- Log::error(sprintf('Exception is: %s', json_encode($debug)));
+ app('log')->error(sprintf('Exception is: %s', json_encode($debug)));
}
/**
@@ -102,8 +102,8 @@ class MailError extends Job implements ShouldQueue
app('log')->warning('[RFC] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');
return;
}
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
}
}
}
diff --git a/app/Mail/NewIPAddressWarningMail.php b/app/Mail/NewIPAddressWarningMail.php
index bddb54d960..8e49bd48d7 100644
--- a/app/Mail/NewIPAddressWarningMail.php
+++ b/app/Mail/NewIPAddressWarningMail.php
@@ -64,7 +64,7 @@ class NewIPAddressWarningMail extends Mailable
try {
$hostName = app('steam')->getHostName($this->ipAddress);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
$hostName = $this->ipAddress;
}
if ($hostName !== $this->ipAddress) {
diff --git a/app/Notifications/User/UserLogin.php b/app/Notifications/User/UserLogin.php
index b93436c782..f625485427 100644
--- a/app/Notifications/User/UserLogin.php
+++ b/app/Notifications/User/UserLogin.php
@@ -80,7 +80,7 @@ class UserLogin extends Notification
try {
$hostName = app('steam')->getHostName($this->ip);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
$hostName = $this->ip;
}
if ($hostName !== $this->ip) {
@@ -105,7 +105,7 @@ class UserLogin extends Notification
try {
$hostName = app('steam')->getHostName($this->ip);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
$hostName = $this->ip;
}
if ($hostName !== $this->ip) {
diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php
index 3b65837c20..069789a518 100644
--- a/app/Repositories/Attachment/AttachmentRepository.php
+++ b/app/Repositories/Attachment/AttachmentRepository.php
@@ -207,7 +207,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
try {
$dbNote->delete();
} catch (LogicException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
}
}
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index 069a204e4d..59942cc536 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -807,8 +807,8 @@ class BudgetRepository implements BudgetRepositoryInterface
]
);
} catch (QueryException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException('400002: Could not store budget.', 0, $e);
}
diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
index 216d666d49..67a06736cf 100644
--- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
+++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
@@ -252,7 +252,7 @@ trait ModifiesPiggyBanks
/** @var PiggyBank $piggyBank */
$piggyBank = PiggyBank::create($piggyData);
} catch (QueryException $e) {
- Log::error(sprintf('Could not store piggy bank: %s', $e->getMessage()), $piggyData);
+ app('log')->error(sprintf('Could not store piggy bank: %s', $e->getMessage()), $piggyData);
throw new FireflyException('400005: Could not store new piggy bank.', 0, $e);
}
diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
index aeb9411303..30b43efa98 100644
--- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php
+++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
@@ -480,8 +480,8 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
throw new DuplicateTransactionException($e->getMessage(), 0, $e);
} catch (FireflyException $e) {
app('log')->warning('Group repository caught group factory with an exception!');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($e->getMessage(), 0, $e);
}
}
diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php
index e35d99f13a..c54ccdb561 100644
--- a/app/Repositories/User/UserRepository.php
+++ b/app/Repositories/User/UserRepository.php
@@ -385,7 +385,7 @@ class UserRepository implements UserRepositoryInterface
{
$roleObject = Role::where('name', $role)->first();
if (null === $roleObject) {
- Log::error(sprintf('Could not find role "%s" in attachRole()', $role));
+ app('log')->error(sprintf('Could not find role "%s" in attachRole()', $role));
return false;
}
@@ -394,7 +394,7 @@ class UserRepository implements UserRepositoryInterface
$user->roles()->attach($roleObject);
} catch (QueryException $e) {
// don't care
- Log::error(sprintf('Query exception when giving user a role: %s', $e->getMessage()));
+ app('log')->error(sprintf('Query exception when giving user a role: %s', $e->getMessage()));
}
return true;
diff --git a/app/Rules/IsDateOrTime.php b/app/Rules/IsDateOrTime.php
index 8a6132ae58..258b2bb993 100644
--- a/app/Rules/IsDateOrTime.php
+++ b/app/Rules/IsDateOrTime.php
@@ -64,11 +64,11 @@ class IsDateOrTime implements Rule
try {
Carbon::createFromFormat('Y-m-d', $value);
} catch (InvalidDateException $e) {
- Log::error(sprintf('"%s" is not a valid date: %s', $value, $e->getMessage()));
+ app('log')->error(sprintf('"%s" is not a valid date: %s', $value, $e->getMessage()));
return false;
} catch (InvalidFormatException $e) {
- Log::error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
+ app('log')->error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
return false;
}
@@ -79,11 +79,11 @@ class IsDateOrTime implements Rule
try {
Carbon::parse($value);
} catch (InvalidDateException $e) {
- Log::error(sprintf('"%s" is not a valid date or time: %s', $value, $e->getMessage()));
+ app('log')->error(sprintf('"%s" is not a valid date or time: %s', $value, $e->getMessage()));
return false;
} catch (InvalidFormatException $e) {
- Log::error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
+ app('log')->error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
return false;
}
diff --git a/app/Rules/IsValidAttachmentModel.php b/app/Rules/IsValidAttachmentModel.php
index fa21c25991..bf9d4e2bb9 100644
--- a/app/Rules/IsValidAttachmentModel.php
+++ b/app/Rules/IsValidAttachmentModel.php
@@ -110,7 +110,7 @@ class IsValidAttachmentModel implements Rule
TransactionJournal::class => 'validateJournal',
];
if (!array_key_exists($this->model, $methods)) {
- Log::error(sprintf('Cannot validate model "%s" in %s.', substr($this->model, 0, 20), __METHOD__));
+ app('log')->error(sprintf('Cannot validate model "%s" in %s.', substr($this->model, 0, 20), __METHOD__));
return false;
}
diff --git a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php
index f50408c2d3..62cb0b4ac9 100644
--- a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php
+++ b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php
@@ -52,8 +52,8 @@ class UpdateRequest implements UpdateRequestInterface
// try get array from update server:
$updateInfo = $this->contactServer($channel);
if ('error' === $updateInfo['level']) {
- Log::error('Update information contains an error.');
- Log::error($updateInfo['message']);
+ app('log')->error('Update information contains an error.');
+ app('log')->error($updateInfo['message']);
$information['message'] = $updateInfo['message'];
return $information;
@@ -91,17 +91,17 @@ class UpdateRequest implements UpdateRequestInterface
];
$res = $client->request('GET', $url, $options);
} catch (GuzzleException $e) {
- Log::error('Ran into Guzzle error.');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error('Ran into Guzzle error.');
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$return['message'] = sprintf('Guzzle: %s', strip_tags($e->getMessage()));
return $return;
}
if (200 !== $res->getStatusCode()) {
- Log::error(sprintf('Response status from server is %d.', $res->getStatusCode()));
- Log::error((string)$res->getBody());
+ app('log')->error(sprintf('Response status from server is %d.', $res->getStatusCode()));
+ app('log')->error((string)$res->getBody());
$return['message'] = sprintf('Error: %d', $res->getStatusCode());
return $return;
@@ -110,16 +110,16 @@ class UpdateRequest implements UpdateRequestInterface
try {
$json = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
- Log::error('Body is not valid JSON');
- Log::error($body);
+ app('log')->error('Body is not valid JSON');
+ app('log')->error($body);
$return['message'] = 'Invalid JSON :(';
return $return;
}
if (!array_key_exists($channel, $json['firefly_iii'])) {
- Log::error(sprintf('No valid update channel "%s"', $channel));
- Log::error($body);
+ app('log')->error(sprintf('No valid update channel "%s"', $channel));
+ app('log')->error($body);
$return['message'] = sprintf('Unknown update channel "%s" :(', $channel);
}
diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php
index ae5149b479..c6a6866dfe 100644
--- a/app/Services/Internal/Support/AccountServiceTrait.php
+++ b/app/Services/Internal/Support/AccountServiceTrait.php
@@ -298,8 +298,8 @@ trait AccountServiceTrait
try {
$group = $factory->create($submission);
} catch (DuplicateTransactionException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($e->getMessage(), 0, $e);
}
@@ -543,8 +543,8 @@ trait AccountServiceTrait
try {
$group = $factory->create($submission);
} catch (DuplicateTransactionException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($e->getMessage(), 0, $e);
}
@@ -758,8 +758,8 @@ trait AccountServiceTrait
try {
$group = $factory->create($submission);
} catch (DuplicateTransactionException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException($e->getMessage(), 0, $e);
}
diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.php
index 58f81795e2..30e6483320 100644
--- a/app/Services/Internal/Support/CreditRecalculateService.php
+++ b/app/Services/Internal/Support/CreditRecalculateService.php
@@ -85,8 +85,8 @@ class CreditRecalculateService
try {
$this->findByJournal($journal);
} catch (FireflyException $e) {
- Log::error($e->getTraceAsString());
- Log::error(sprintf('Could not find work account for transaction group #%d.', $this->group->id));
+ app('log')->error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not find work account for transaction group #%d.', $this->group->id));
}
}
}
diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php
index 324764f1b4..32adb88029 100644
--- a/app/Services/Internal/Support/RecurringTransactionTrait.php
+++ b/app/Services/Internal/Support/RecurringTransactionTrait.php
@@ -222,7 +222,7 @@ trait RecurringTransactionTrait
try {
$result = $factory->findOrCreate($accountName, $expectedType);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
}
}
}
diff --git a/app/Services/Internal/Support/TransactionTypeTrait.php b/app/Services/Internal/Support/TransactionTypeTrait.php
index d06f93af88..eee9f8d0c1 100644
--- a/app/Services/Internal/Support/TransactionTypeTrait.php
+++ b/app/Services/Internal/Support/TransactionTypeTrait.php
@@ -48,7 +48,7 @@ trait TransactionTypeTrait
$factory = app(TransactionTypeFactory::class);
$transactionType = $factory->find($type);
if (null === $transactionType) {
- Log::error(sprintf('Could not find transaction type for "%s"', $type));
+ app('log')->error(sprintf('Could not find transaction type for "%s"', $type));
throw new FireflyException(sprintf('Could not find transaction type for "%s"', $type));
}
diff --git a/app/Services/Internal/Update/GroupUpdateService.php b/app/Services/Internal/Update/GroupUpdateService.php
index 3fc5e45876..a6638acee7 100644
--- a/app/Services/Internal/Update/GroupUpdateService.php
+++ b/app/Services/Internal/Update/GroupUpdateService.php
@@ -99,7 +99,7 @@ class GroupUpdateService
Log::debug('Array of updated IDs: ', $updated);
if (0 === count($updated)) {
- Log::error('There were no transactions updated or created. Will not delete anything.');
+ app('log')->error('There were no transactions updated or created. Will not delete anything.');
$transactionGroup->refresh();
app('preferences')->mark();
@@ -197,7 +197,7 @@ class GroupUpdateService
$updated[] = $newJournal->id;
}
if (null === $newJournal) {
- Log::error('createTransactionJournal returned NULL, indicating something went wrong.');
+ app('log')->error('createTransactionJournal returned NULL, indicating something went wrong.');
}
}
if (null !== $journal) {
@@ -234,8 +234,8 @@ class GroupUpdateService
try {
$collection = $factory->create($submission);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException(
sprintf('Could not create new transaction journal: %s', $e->getMessage()),
0,
diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php
index e37770cb7f..6d7e446786 100644
--- a/app/Services/Internal/Update/JournalUpdateService.php
+++ b/app/Services/Internal/Update/JournalUpdateService.php
@@ -384,7 +384,7 @@ class JournalUpdateService
try {
$result = $this->getAccount($expectedType, 'source', $sourceInfo);
} catch (FireflyException $e) {
- Log::error(sprintf('Cant get the valid source account: %s', $e->getMessage()));
+ app('log')->error(sprintf('Cant get the valid source account: %s', $e->getMessage()));
$result = $this->getOriginalSourceAccount();
}
@@ -404,7 +404,7 @@ class JournalUpdateService
// cowardly refuse to update if both accounts are the same.
if ($source->id === $destination->id) {
- Log::error(sprintf('Source + dest accounts are equal (%d, "%s")', $source->id, $source->name));
+ app('log')->error(sprintf('Source + dest accounts are equal (%d, "%s")', $source->id, $source->name));
return;
}
@@ -451,7 +451,7 @@ class JournalUpdateService
try {
$result = $this->getAccount($expectedType, 'destination', $destInfo);
} catch (FireflyException $e) {
- Log::error(sprintf('getValidDestinationAccount() threw unexpected error: %s', $e->getMessage()));
+ app('log')->error(sprintf('getValidDestinationAccount() threw unexpected error: %s', $e->getMessage()));
$result = $this->getOriginalDestinationAccount();
}
@@ -766,7 +766,7 @@ class JournalUpdateService
// not the same as normal currency
if (null !== $foreignCurrency && $foreignCurrency->id === $this->transactionJournal->transaction_currency_id) {
- Log::error(sprintf('Foreign currency is equal to normal currency (%s)', $foreignCurrency->code));
+ app('log')->error(sprintf('Foreign currency is equal to normal currency (%s)', $foreignCurrency->code));
return;
}
diff --git a/app/Services/Password/PwndVerifierV2.php b/app/Services/Password/PwndVerifierV2.php
index 76d7bf1a2f..ddd6b16fab 100644
--- a/app/Services/Password/PwndVerifierV2.php
+++ b/app/Services/Password/PwndVerifierV2.php
@@ -64,7 +64,7 @@ class PwndVerifierV2 implements Verifier
$client = new Client();
$res = $client->request('GET', $url, $opt);
} catch (GuzzleException | RequestException $e) {
- Log::error(sprintf('Could not verify password security: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not verify password security: %s', $e->getMessage()));
return true;
}
diff --git a/app/Services/Webhook/StandardWebhookSender.php b/app/Services/Webhook/StandardWebhookSender.php
index 0d4bff7069..16a6b165e7 100644
--- a/app/Services/Webhook/StandardWebhookSender.php
+++ b/app/Services/Webhook/StandardWebhookSender.php
@@ -62,9 +62,9 @@ class StandardWebhookSender implements WebhookSenderInterface
try {
$signature = $signatureGenerator->generate($this->message);
} catch (FireflyException $e) {
- Log::error('Did not send message because of a Firefly III Exception.');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error('Did not send message because of a Firefly III Exception.');
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$attempt = new WebhookAttempt();
$attempt->webhookMessage()->associate($this->message);
$attempt->status_code = 0;
@@ -82,9 +82,9 @@ class StandardWebhookSender implements WebhookSenderInterface
try {
$json = json_encode($this->message->message, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
- Log::error('Did not send message because of a JSON error.');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error('Did not send message because of a JSON error.');
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$attempt = new WebhookAttempt();
$attempt->webhookMessage()->associate($this->message);
$attempt->status_code = 0;
@@ -111,9 +111,9 @@ class StandardWebhookSender implements WebhookSenderInterface
try {
$res = $client->request('POST', $this->message->webhook->url, $options);
} catch (RequestException | ConnectException $e) {
- Log::error('The webhook could NOT be submitted but Firefly III caught the error below.');
- Log::error($e->getMessage());
- Log::error($e->getTraceAsString());
+ app('log')->error('The webhook could NOT be submitted but Firefly III caught the error below.');
+ app('log')->error($e->getMessage());
+ app('log')->error($e->getTraceAsString());
$logs = sprintf("%s\n%s", $e->getMessage(), $e->getTraceAsString());
@@ -127,9 +127,9 @@ class StandardWebhookSender implements WebhookSenderInterface
$attempt->status_code = 0;
if (method_exists($e, 'hasResponse') && method_exists($e, 'getResponse')) {
$attempt->status_code = $e->hasResponse() ? $e->getResponse()->getStatusCode() : 0;
- Log::error(sprintf('The status code of the error response is: %d', $attempt->status_code));
+ app('log')->error(sprintf('The status code of the error response is: %d', $attempt->status_code));
$body = (string)($e->hasResponse() ? $e->getResponse()->getBody() : '');
- Log::error(sprintf('The body of the error response is: %s', $body));
+ app('log')->error(sprintf('The body of the error response is: %s', $body));
}
$attempt->logs = $logs;
$attempt->save();
diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php
index c5ae8198d1..98d891a7c2 100644
--- a/app/Support/Authentication/RemoteUserGuard.php
+++ b/app/Support/Authentication/RemoteUserGuard.php
@@ -84,7 +84,7 @@ class RemoteUserGuard implements Guard
}
if (null === $userID || '' === $userID) {
- Log::error(sprintf('No user in header "%s".', $header));
+ app('log')->error(sprintf('No user in header "%s".', $header));
throw new FireflyException('The guard header was unexpectedly empty. See the logs.');
}
diff --git a/app/Support/Binder/AccountList.php b/app/Support/Binder/AccountList.php
index 728f77f402..ee5eb3cb28 100644
--- a/app/Support/Binder/AccountList.php
+++ b/app/Support/Binder/AccountList.php
@@ -69,7 +69,7 @@ class AccountList implements BinderInterface
return $collection;
}
}
- Log::error(sprintf('Trying to show account list (%s), but user is not logged in or list is empty.', $route->uri));
+ app('log')->error(sprintf('Trying to show account list (%s), but user is not logged in or list is empty.', $route->uri));
throw new NotFoundHttpException();
}
}
diff --git a/app/Support/Binder/CLIToken.php b/app/Support/Binder/CLIToken.php
index f66b5005d4..4587b4c715 100644
--- a/app/Support/Binder/CLIToken.php
+++ b/app/Support/Binder/CLIToken.php
@@ -60,7 +60,7 @@ class CLIToken implements BinderInterface
return $value;
}
}
- Log::error(sprintf('Recognized no users by access token "%s"', $value));
+ app('log')->error(sprintf('Recognized no users by access token "%s"', $value));
throw new NotFoundHttpException();
}
}
diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php
index 8ba226fbb5..05179903f8 100644
--- a/app/Support/Binder/Date.php
+++ b/app/Support/Binder/Date.php
@@ -74,7 +74,7 @@ class Date implements BinderInterface
$result = new Carbon($value);
} catch (InvalidDateException $e) {
$message = sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage());
- Log::error($message);
+ app('log')->error($message);
throw new NotFoundHttpException($message, $e);
}
diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.php
index 4d1e92904e..5d895aa306 100644
--- a/app/Support/Binder/TagList.php
+++ b/app/Support/Binder/TagList.php
@@ -54,7 +54,7 @@ class TagList implements BinderInterface
Log::debug('List of tags is', $list);
if (0 === count($list)) {
- Log::error('Tag list is empty.');
+ app('log')->error('Tag list is empty.');
throw new NotFoundHttpException();
}
@@ -81,7 +81,7 @@ class TagList implements BinderInterface
return $collection;
}
}
- Log::error('TagList: user is not logged in.');
+ app('log')->error('TagList: user is not logged in.');
throw new NotFoundHttpException();
}
}
diff --git a/app/Support/Binder/TagOrId.php b/app/Support/Binder/TagOrId.php
index 8c79ec13a2..20b5a23b81 100644
--- a/app/Support/Binder/TagOrId.php
+++ b/app/Support/Binder/TagOrId.php
@@ -54,10 +54,10 @@ class TagOrId implements BinderInterface
if (null !== $result) {
return $result;
}
- Log::error('TagOrId: tag not found.');
+ app('log')->error('TagOrId: tag not found.');
throw new NotFoundHttpException();
}
- Log::error('TagOrId: user is not logged in.');
+ app('log')->error('TagOrId: user is not logged in.');
throw new NotFoundHttpException();
}
}
diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php
index fc78951bea..35b9672e0e 100644
--- a/app/Support/ExpandedForm.php
+++ b/app/Support/ExpandedForm.php
@@ -65,7 +65,7 @@ class ExpandedForm
try {
$html = view('form.amount-no-currency', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render amountNoCurrency(): %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render amountNoCurrency(): %s', $e->getMessage()));
$html = 'Could not render amountNoCurrency.';
throw new FireflyException($html, 0, $e);
}
diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php
index 393ec30f08..b00433ae30 100644
--- a/app/Support/Export/ExportDataGenerator.php
+++ b/app/Support/Export/ExportDataGenerator.php
@@ -212,7 +212,7 @@ class ExportDataGenerator
try {
$string = $csv->toString();
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
}
@@ -289,7 +289,7 @@ class ExportDataGenerator
try {
$string = $csv->toString();
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
}
@@ -356,7 +356,7 @@ class ExportDataGenerator
try {
$string = $csv->toString();
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
}
@@ -407,7 +407,7 @@ class ExportDataGenerator
try {
$string = $csv->toString();
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
}
@@ -487,7 +487,7 @@ class ExportDataGenerator
try {
$string = $csv->toString();
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
}
@@ -651,7 +651,7 @@ class ExportDataGenerator
try {
$string = $csv->toString();
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
}
@@ -782,7 +782,7 @@ class ExportDataGenerator
try {
$string = $csv->toString();
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
}
@@ -837,7 +837,7 @@ class ExportDataGenerator
try {
$string = $csv->toString();
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
}
@@ -990,7 +990,7 @@ class ExportDataGenerator
try {
$string = $csv->toString();
} catch (Exception $e) { // intentional generic exception
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
}
diff --git a/app/Support/FireflyConfig.php b/app/Support/FireflyConfig.php
index 86dcd29dbf..5c9cf89793 100644
--- a/app/Support/FireflyConfig.php
+++ b/app/Support/FireflyConfig.php
@@ -104,7 +104,7 @@ class FireflyConfig
try {
$config = Configuration::whereName($name)->whereNull('deleted_at')->first();
} catch (QueryException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
$item = new Configuration();
$item->name = $name;
$item->data = $value;
diff --git a/app/Support/Form/FormSupport.php b/app/Support/Form/FormSupport.php
index ebb78e43aa..e37ef14d38 100644
--- a/app/Support/Form/FormSupport.php
+++ b/app/Support/Form/FormSupport.php
@@ -158,7 +158,7 @@ trait FormSupport
try {
$date = today(config('app.timezone'));
} catch (InvalidDateException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
}
return $date;
diff --git a/app/Support/Http/Controllers/ModelInformation.php b/app/Support/Http/Controllers/ModelInformation.php
index 7d3d42e7ce..f354287207 100644
--- a/app/Support/Http/Controllers/ModelInformation.php
+++ b/app/Support/Http/Controllers/ModelInformation.php
@@ -60,8 +60,8 @@ trait ModelInformation
]
)->render();
} catch (Throwable $e) {
- Log::error(sprintf('Throwable was thrown in getActionsForBill(): %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Throwable was thrown in getActionsForBill(): %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
$result = 'Could not render view. See log files.';
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php
index c68c358255..3d82ce0d70 100644
--- a/app/Support/Http/Controllers/RenderPartialViews.php
+++ b/app/Support/Http/Controllers/RenderPartialViews.php
@@ -70,7 +70,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.balance-amount', compact('journals', 'budget', 'account'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
@@ -93,7 +93,7 @@ trait RenderPartialViews
try {
$result = view('reports.options.budget', compact('budgets'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
+ app('log')->error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
@@ -126,7 +126,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.budget-spent-amount', compact('journals', 'budget'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
@@ -155,7 +155,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.category-entry', compact('journals', 'category'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
@@ -178,7 +178,7 @@ trait RenderPartialViews
try {
$result = view('reports.options.category', compact('categories'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.options.category: %s', $e->getMessage()));
+ app('log')->error(sprintf('Cannot render reports.options.category: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
@@ -221,7 +221,7 @@ trait RenderPartialViews
try {
$result = view('reports.options.double', compact('set'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
+ app('log')->error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
@@ -256,7 +256,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.expense-entry', compact('journals', 'account'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
@@ -293,7 +293,7 @@ trait RenderPartialViews
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Could not render: %s', $e->getMessage()), 0, $e);
}
@@ -348,7 +348,7 @@ trait RenderPartialViews
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Could not render: %s', $e->getMessage()), 0, $e);
}
@@ -385,7 +385,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Could not render: %s', $e->getMessage()));
+ app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
@@ -404,7 +404,7 @@ trait RenderPartialViews
try {
$result = view('reports.options.no-options')->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.options.no-options: %s', $e->getMessage()));
+ app('log')->error(sprintf('Cannot render reports.options.no-options: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
@@ -428,7 +428,7 @@ trait RenderPartialViews
try {
$result = view('reports.options.tag', compact('tags'))->render();
} catch (Throwable $e) {
- Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
+ app('log')->error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
diff --git a/app/Support/Http/Controllers/RuleManagement.php b/app/Support/Http/Controllers/RuleManagement.php
index 874829cc6d..5742a45cec 100644
--- a/app/Support/Http/Controllers/RuleManagement.php
+++ b/app/Support/Http/Controllers/RuleManagement.php
@@ -60,8 +60,8 @@ trait RuleManagement
]
)->render();
} catch (Throwable $e) {
- Log::error(sprintf('Throwable was thrown in getPreviousActions(): %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Throwable was thrown in getPreviousActions(): %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Could not render: %s', $e->getMessage()), 0, $e);
}
$index++;
@@ -108,7 +108,7 @@ trait RuleManagement
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Could not render: %s', $e->getMessage()), 0, $e);
}
$index++;
@@ -153,7 +153,7 @@ trait RuleManagement
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Could not render: %s', $e->getMessage()), 0, $e);
}
$index++;
diff --git a/app/Support/Http/Controllers/UserNavigation.php b/app/Support/Http/Controllers/UserNavigation.php
index 6fffe00a08..1345f81471 100644
--- a/app/Support/Http/Controllers/UserNavigation.php
+++ b/app/Support/Http/Controllers/UserNavigation.php
@@ -107,7 +107,7 @@ trait UserNavigation
/** @var Transaction|null $transaction */
$transaction = $account->transactions()->first();
if (null === $transaction) {
- Log::error(sprintf('Account #%d has no transactions. Dont know where it belongs.', $account->id));
+ app('log')->error(sprintf('Account #%d has no transactions. Dont know where it belongs.', $account->id));
session()->flash('error', trans('firefly.cant_find_redirect_account'));
return redirect(route('index'));
@@ -116,7 +116,7 @@ trait UserNavigation
/** @var Transaction|null $other */
$other = $journal->transactions()->where('id', '!=', $transaction->id)->first();
if (null === $other) {
- Log::error(sprintf('Account #%d has no valid journals. Dont know where it belongs.', $account->id));
+ app('log')->error(sprintf('Account #%d has no valid journals. Dont know where it belongs.', $account->id));
session()->flash('error', trans('firefly.cant_find_redirect_account'));
return redirect(route('index'));
@@ -138,7 +138,7 @@ trait UserNavigation
/** @var TransactionJournal|null $journal */
$journal = $group->transactionJournals()->first();
if (null === $journal) {
- Log::error(sprintf('No journals in group #%d', $group->id));
+ app('log')->error(sprintf('No journals in group #%d', $group->id));
return redirect(route('index'));
}
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index 77b451691f..c71fd96d7c 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -88,7 +88,7 @@ class Navigation
];
if (!array_key_exists($repeatFreq, $functionMap)) {
- Log::error(sprintf(
+ app('log')->error(sprintf(
'The periodicity %s is unknown. Choose one of available periodicity: %s',
$repeatFreq,
join(', ', array_keys($functionMap))
@@ -113,7 +113,7 @@ class Navigation
} catch (IntervalException $exception) {
app('log')->warning($exception->getMessage(), ['exception' => $exception]);
} catch (Throwable $exception) {
- Log::error($exception->getMessage(), ['exception' => $exception]);
+ app('log')->error($exception->getMessage(), ['exception' => $exception]);
}
Log::debug(
@@ -242,7 +242,7 @@ class Navigation
if ('custom' === $repeatFreq) {
return $date; // the date is already at the start.
}
- Log::error(sprintf('Cannot do startOfPeriod for $repeat_freq "%s"', $repeatFreq));
+ app('log')->error(sprintf('Cannot do startOfPeriod for $repeat_freq "%s"', $repeatFreq));
return $theDate;
}
@@ -318,7 +318,7 @@ class Navigation
if (!array_key_exists($repeatFreq, $functionMap)) {
- Log::error(sprintf('Cannot do endOfPeriod for $repeat_freq "%s"', $repeatFreq));
+ app('log')->error(sprintf('Cannot do endOfPeriod for $repeat_freq "%s"', $repeatFreq));
return $end;
}
@@ -571,7 +571,7 @@ class Navigation
}
// special formatter for quarter of year
- Log::error(sprintf('No date formats for frequency "%s"!', $repeatFrequency));
+ app('log')->error(sprintf('No date formats for frequency "%s"!', $repeatFrequency));
return $date->format('Y-m-d');
}
diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php
index 1e30b47bb3..aff5fb58e5 100644
--- a/app/Support/ParseDateString.php
+++ b/app/Support/ParseDateString.php
@@ -190,14 +190,14 @@ class ParseDateString
$pattern = '/[+-]\d+[wqmdy]/';
$res = preg_match($pattern, $part);
if (0 === $res || false === $res) {
- Log::error(sprintf('Part "%s" does not match regular expression. Will be skipped.', $part));
+ app('log')->error(sprintf('Part "%s" does not match regular expression. Will be skipped.', $part));
continue;
}
$direction = str_starts_with($part, '+') ? 1 : 0;
$period = $part[strlen($part) - 1];
$number = (int)substr($part, 1, -1);
if (!array_key_exists($period, $functions[$direction])) {
- Log::error(sprintf('No method for direction %d and period "%s".', $direction, $period));
+ app('log')->error(sprintf('No method for direction %d and period "%s".', $direction, $period));
continue;
}
$func = $functions[$direction][$period];
diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php
index 89c7d4b70c..3b60baecad 100644
--- a/app/Support/Request/ConvertsDataTypes.php
+++ b/app/Support/Request/ConvertsDataTypes.php
@@ -268,10 +268,10 @@ trait ConvertsDataTypes
try {
$carbon = Carbon::createFromFormat('Y-m-d', $value);
} catch (InvalidDateException $e) {
- Log::error(sprintf('[1] "%s" is not a valid date: %s', $value, $e->getMessage()));
+ app('log')->error(sprintf('[1] "%s" is not a valid date: %s', $value, $e->getMessage()));
return null;
} catch (InvalidFormatException $e) {
- Log::error(sprintf('[2] "%s" is of an invalid format: %s', $value, $e->getMessage()));
+ app('log')->error(sprintf('[2] "%s" is of an invalid format: %s', $value, $e->getMessage()));
return null;
}
@@ -281,11 +281,11 @@ trait ConvertsDataTypes
try {
$carbon = Carbon::parse($value);
} catch (InvalidDateException $e) {
- Log::error(sprintf('[3] "%s" is not a valid date or time: %s', $value, $e->getMessage()));
+ app('log')->error(sprintf('[3] "%s" is not a valid date or time: %s', $value, $e->getMessage()));
return null;
} catch (InvalidFormatException $e) {
- Log::error(sprintf('[4] "%s" is of an invalid format: %s', $value, $e->getMessage()));
+ app('log')->error(sprintf('[4] "%s" is of an invalid format: %s', $value, $e->getMessage()));
return null;
}
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index a7c7a1018c..25a9ca79ea 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -156,8 +156,8 @@ class OperatorQuerySearch implements SearchInterface
try {
$query1 = $parser->parse($query);
} catch (TypeError | LogicException $e) {
- Log::error($e->getMessage());
- Log::error(sprintf('Could not parse search: "%s".', $query));
+ app('log')->error($e->getMessage());
+ app('log')->error(sprintf('Could not parse search: "%s".', $query));
throw new FireflyException(sprintf('Invalid search value "%s". See the logs.', e($query)), 0, $e);
}
@@ -181,7 +181,7 @@ class OperatorQuerySearch implements SearchInterface
Log::debug(sprintf('Now in handleSearchNode(%s)', $class));
switch ($class) {
default:
- Log::error(sprintf('Cannot handle node %s', $class));
+ app('log')->error(sprintf('Cannot handle node %s', $class));
throw new FireflyException(sprintf('Firefly III search cant handle "%s"-nodes', $class));
case Subquery::class:
// loop all notes in subquery:
@@ -257,7 +257,7 @@ class OperatorQuerySearch implements SearchInterface
switch ($operator) {
default:
- Log::error(sprintf('No such operator: %s', $operator));
+ app('log')->error(sprintf('No such operator: %s', $operator));
throw new FireflyException(sprintf('Unsupported search operator: "%s"', $operator));
// some search operators are ignored, basically:
case 'user_action':
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index d40999afa2..59b9ae7d83 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -956,8 +956,8 @@ class Steam
$amount = bcmul($amount, '-1');
}
} catch (ValueError $e) {
- Log::error(sprintf('ValueError in Steam::positive("%s"): %s', $amount, $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('ValueError in Steam::positive("%s"): %s', $amount, $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
return '0';
}
diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.php
index 8a59ebf739..dc9260126c 100644
--- a/app/Support/System/OAuthKeys.php
+++ b/app/Support/System/OAuthKeys.php
@@ -75,8 +75,8 @@ class OAuthKeys
$privateKey = (string)app('fireflyconfig')->get(self::PRIVATE_KEY)?->data;
$publicKey = (string)app('fireflyconfig')->get(self::PUBLIC_KEY)?->data;
} catch (ContainerExceptionInterface | NotFoundExceptionInterface | FireflyException $e) {
- Log::error(sprintf('Could not validate keysInDatabase(): %s', $e->getMessage()));
- Log::error($e->getTraceAsString());
+ app('log')->error(sprintf('Could not validate keysInDatabase(): %s', $e->getMessage()));
+ app('log')->error($e->getTraceAsString());
}
}
if ('' !== $privateKey && '' !== $publicKey) {
@@ -131,8 +131,8 @@ class OAuthKeys
$privateContent = Crypt::decrypt($privateKey);
$publicContent = Crypt::decrypt($publicKey);
} catch (DecryptException $e) {
- Log::error('Could not decrypt pub/private keypair.');
- Log::error($e->getMessage());
+ app('log')->error('Could not decrypt pub/private keypair.');
+ app('log')->error($e->getMessage());
// delete config vars from DB:
app('fireflyconfig')->delete(self::PRIVATE_KEY);
diff --git a/app/TransactionRules/Actions/AppendDescriptionToNotes.php b/app/TransactionRules/Actions/AppendDescriptionToNotes.php
index a10e442140..c80d5b3fa1 100644
--- a/app/TransactionRules/Actions/AppendDescriptionToNotes.php
+++ b/app/TransactionRules/Actions/AppendDescriptionToNotes.php
@@ -56,7 +56,7 @@ class AppendDescriptionToNotes implements ActionInterface
/** @var TransactionJournal $journal */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
- Log::error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
+ app('log')->error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_other_user')));
return false;
}
diff --git a/app/TransactionRules/Actions/AppendNotesToDescription.php b/app/TransactionRules/Actions/AppendNotesToDescription.php
index 93469788a8..64626015eb 100644
--- a/app/TransactionRules/Actions/AppendNotesToDescription.php
+++ b/app/TransactionRules/Actions/AppendNotesToDescription.php
@@ -60,7 +60,7 @@ class AppendNotesToDescription implements ActionInterface
/** @var TransactionJournal $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
- Log::error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
+ app('log')->error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_other_user')));
return false;
}
diff --git a/app/TransactionRules/Actions/ConvertToDeposit.php b/app/TransactionRules/Actions/ConvertToDeposit.php
index 36091f7905..0c272de728 100644
--- a/app/TransactionRules/Actions/ConvertToDeposit.php
+++ b/app/TransactionRules/Actions/ConvertToDeposit.php
@@ -65,13 +65,13 @@ class ConvertToDeposit implements ActionInterface
/** @var TransactionJournal|null $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
- Log::error(sprintf('Cannot find journal #%d, cannot convert to deposit.', $journal['transaction_journal_id']));
+ app('log')->error(sprintf('Cannot find journal #%d, cannot convert to deposit.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_not_found')));
return false;
}
$groupCount = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
if ($groupCount > 1) {
- Log::error(sprintf('Group #%d has more than one transaction in it, cannot convert to deposit.', $journal['transaction_group_id']));
+ app('log')->error(sprintf('Group #%d has more than one transaction in it, cannot convert to deposit.', $journal['transaction_group_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.split_group')));
return false;
}
@@ -79,7 +79,7 @@ class ConvertToDeposit implements ActionInterface
Log::debug(sprintf('Convert journal #%d to deposit.', $journal['transaction_journal_id']));
$type = $object->transactionType->type;
if (TransactionType::DEPOSIT === $type) {
- Log::error(sprintf('Journal #%d is already a deposit (rule #%d).', $journal['transaction_journal_id'], $this->action->rule_id));
+ app('log')->error(sprintf('Journal #%d is already a deposit (rule #%d).', $journal['transaction_journal_id'], $this->action->rule_id));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.is_already_deposit')));
return false;
}
@@ -91,7 +91,7 @@ class ConvertToDeposit implements ActionInterface
$res = $this->convertWithdrawalArray($object);
} catch (JsonException | FireflyException $e) {
Log::debug('Could not convert withdrawal to deposit.');
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
}
@@ -107,7 +107,7 @@ class ConvertToDeposit implements ActionInterface
$res = $this->convertTransferArray($object);
} catch (JsonException | FireflyException $e) {
Log::debug('Could not convert transfer to deposit.');
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
}
diff --git a/app/TransactionRules/Actions/ConvertToTransfer.php b/app/TransactionRules/Actions/ConvertToTransfer.php
index 14fe267fc7..a57a8b65ab 100644
--- a/app/TransactionRules/Actions/ConvertToTransfer.php
+++ b/app/TransactionRules/Actions/ConvertToTransfer.php
@@ -63,13 +63,13 @@ class ConvertToTransfer implements ActionInterface
/** @var TransactionJournal|null $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
- Log::error(sprintf('Cannot find journal #%d, cannot convert to transfer.', $journal['transaction_journal_id']));
+ app('log')->error(sprintf('Cannot find journal #%d, cannot convert to transfer.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_not_found')));
return false;
}
$groupCount = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
if ($groupCount > 1) {
- Log::error(sprintf('Group #%d has more than one transaction in it, cannot convert to transfer.', $journal['transaction_group_id']));
+ app('log')->error(sprintf('Group #%d has more than one transaction in it, cannot convert to transfer.', $journal['transaction_group_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.split_group')));
return false;
}
@@ -78,7 +78,7 @@ class ConvertToTransfer implements ActionInterface
$user = $object->user;
$journalId = (int)$object->id;
if (TransactionType::TRANSFER === $type) {
- Log::error(
+ app('log')->error(
sprintf('Journal #%d is already a transfer so cannot be converted (rule #%d).', $object->id, $this->action->rule_id)
);
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.is_already_transfer')));
@@ -106,7 +106,7 @@ class ConvertToTransfer implements ActionInterface
$opposing = $repository->findByName($this->action->action_value, [$expectedType]);
if (null === $opposing) {
- Log::error(
+ app('log')->error(
sprintf(
'Journal #%d cannot be converted because no valid %s account with name "%s" exists (rule #%d).',
$expectedType,
@@ -126,7 +126,7 @@ class ConvertToTransfer implements ActionInterface
$res = $this->convertWithdrawalArray($object, $opposing);
} catch (FireflyException $e) {
Log::debug('Could not convert withdrawal to transfer.');
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
}
@@ -141,7 +141,7 @@ class ConvertToTransfer implements ActionInterface
$res = $this->convertDepositArray($object, $opposing);
} catch (FireflyException $e) {
Log::debug('Could not convert deposit to transfer.');
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
}
@@ -164,7 +164,7 @@ class ConvertToTransfer implements ActionInterface
/** @var TransactionJournal $journal */
$journal = TransactionJournal::find($journalId);
if (null === $journal) {
- Log::error(sprintf('Journal #%d does not exist. Cannot convert to transfer.', $journalId));
+ app('log')->error(sprintf('Journal #%d does not exist. Cannot convert to transfer.', $journalId));
return '';
}
return (string)$journal->transactions()->where('amount', '<', 0)->first()?->account?->accountType?->type;
@@ -180,7 +180,7 @@ class ConvertToTransfer implements ActionInterface
/** @var TransactionJournal $journal */
$journal = TransactionJournal::find($journalId);
if (null === $journal) {
- Log::error(sprintf('Journal #%d does not exist. Cannot convert to transfer.', $journalId));
+ app('log')->error(sprintf('Journal #%d does not exist. Cannot convert to transfer.', $journalId));
return '';
}
return (string)$journal->transactions()->where('amount', '>', 0)->first()?->account?->accountType?->type;
@@ -201,7 +201,7 @@ class ConvertToTransfer implements ActionInterface
{
$sourceAccount = $this->getSourceAccount($journal);
if ((int)$sourceAccount->id === (int)$opposing->id) {
- Log::error(
+ app('log')->error(
vsprintf(
'Journal #%d has already has "%s" as a source asset. ConvertToTransfer failed. (rule #%d).',
[$journal->id, $opposing->name, $this->action->rule_id]
@@ -260,7 +260,7 @@ class ConvertToTransfer implements ActionInterface
{
$destAccount = $this->getDestinationAccount($journal);
if ((int)$destAccount->id === (int)$opposing->id) {
- Log::error(
+ app('log')->error(
vsprintf(
'Journal #%d has already has "%s" as a destination asset. ConvertToTransfer failed. (rule #%d).',
[$journal->id, $opposing->name, $this->action->rule_id]
diff --git a/app/TransactionRules/Actions/ConvertToWithdrawal.php b/app/TransactionRules/Actions/ConvertToWithdrawal.php
index f844e213a0..1b9f07fe3f 100644
--- a/app/TransactionRules/Actions/ConvertToWithdrawal.php
+++ b/app/TransactionRules/Actions/ConvertToWithdrawal.php
@@ -65,20 +65,20 @@ class ConvertToWithdrawal implements ActionInterface
/** @var TransactionJournal|null $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
- Log::error(sprintf('Cannot find journal #%d, cannot convert to withdrawal.', $journal['transaction_journal_id']));
+ app('log')->error(sprintf('Cannot find journal #%d, cannot convert to withdrawal.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_not_found')));
return false;
}
$groupCount = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
if ($groupCount > 1) {
- Log::error(sprintf('Group #%d has more than one transaction in it, cannot convert to withdrawal.', $journal['transaction_group_id']));
+ app('log')->error(sprintf('Group #%d has more than one transaction in it, cannot convert to withdrawal.', $journal['transaction_group_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.split_group')));
return false;
}
$type = $object->transactionType->type;
if (TransactionType::WITHDRAWAL === $type) {
- Log::error(sprintf('Journal #%d is already a withdrawal (rule #%d).', $journal['transaction_journal_id'], $this->action->rule_id));
+ app('log')->error(sprintf('Journal #%d is already a withdrawal (rule #%d).', $journal['transaction_journal_id'], $this->action->rule_id));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.is_already_withdrawal')));
return false;
}
@@ -92,7 +92,7 @@ class ConvertToWithdrawal implements ActionInterface
$res = $this->convertDepositArray($object);
} catch (JsonException | FireflyException $e) {
Log::debug('Could not convert transfer to deposit.');
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
}
@@ -107,7 +107,7 @@ class ConvertToWithdrawal implements ActionInterface
$res = $this->convertTransferArray($object);
} catch (JsonException | FireflyException $e) {
Log::debug('Could not convert transfer to deposit.');
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
return false;
}
diff --git a/app/TransactionRules/Actions/LinkToBill.php b/app/TransactionRules/Actions/LinkToBill.php
index 74de2eeb41..6511528789 100644
--- a/app/TransactionRules/Actions/LinkToBill.php
+++ b/app/TransactionRules/Actions/LinkToBill.php
@@ -67,7 +67,7 @@ class LinkToBill implements ActionInterface
$count = DB::table('transaction_journals')->where('id', '=', $journal['transaction_journal_id'])
->where('bill_id', $bill->id)->count();
if (0 !== $count) {
- Log::error(
+ app('log')->error(
sprintf(
'RuleAction LinkToBill could not set the bill of journal #%d to bill "%s": already set.',
$journal['transaction_journal_id'],
@@ -92,7 +92,7 @@ class LinkToBill implements ActionInterface
return true;
}
- Log::error(
+ app('log')->error(
sprintf(
'RuleAction LinkToBill could not set the bill of journal #%d to bill "%s": no such bill found or not a withdrawal.',
$journal['transaction_journal_id'],
diff --git a/app/TransactionRules/Actions/MoveDescriptionToNotes.php b/app/TransactionRules/Actions/MoveDescriptionToNotes.php
index 9d17dd8ae2..46999df2b0 100644
--- a/app/TransactionRules/Actions/MoveDescriptionToNotes.php
+++ b/app/TransactionRules/Actions/MoveDescriptionToNotes.php
@@ -57,7 +57,7 @@ class MoveDescriptionToNotes implements ActionInterface
/** @var TransactionJournal $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
- Log::error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
+ app('log')->error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_other_user')));
return false;
}
diff --git a/app/TransactionRules/Actions/MoveNotesToDescription.php b/app/TransactionRules/Actions/MoveNotesToDescription.php
index 8ce108aa02..1da1042a68 100644
--- a/app/TransactionRules/Actions/MoveNotesToDescription.php
+++ b/app/TransactionRules/Actions/MoveNotesToDescription.php
@@ -63,7 +63,7 @@ class MoveNotesToDescription implements ActionInterface
/** @var TransactionJournal $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
- Log::error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
+ app('log')->error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_other_user')));
return false;
}
diff --git a/app/TransactionRules/Actions/SetCategory.php b/app/TransactionRules/Actions/SetCategory.php
index 30608a3f11..dfc4c0dfbd 100644
--- a/app/TransactionRules/Actions/SetCategory.php
+++ b/app/TransactionRules/Actions/SetCategory.php
@@ -57,7 +57,7 @@ class SetCategory implements ActionInterface
$user = User::find($journal['user_id']);
$search = $this->action->action_value;
if (null === $user) {
- Log::error(sprintf('Journal has no valid user ID so action SetCategory("%s") cannot be applied', $search), $journal);
+ app('log')->error(sprintf('Journal has no valid user ID so action SetCategory("%s") cannot be applied', $search), $journal);
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_such_journal')));
return false;
}
diff --git a/app/TransactionRules/Actions/SetDestinationAccount.php b/app/TransactionRules/Actions/SetDestinationAccount.php
index 1daa030c64..74acdf9d55 100644
--- a/app/TransactionRules/Actions/SetDestinationAccount.php
+++ b/app/TransactionRules/Actions/SetDestinationAccount.php
@@ -65,7 +65,7 @@ class SetDestinationAccount implements ActionInterface
$this->repository = app(AccountRepositoryInterface::class);
if (null === $object) {
- Log::error('Could not find journal.');
+ app('log')->error('Could not find journal.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_such_journal')));
return false;
}
@@ -75,7 +75,7 @@ class SetDestinationAccount implements ActionInterface
// if this is a transfer or a deposit, the new destination account must be an asset account or a default account, and it MUST exist:
$newAccount = $this->findAssetAccount($type);
if ((TransactionType::DEPOSIT === $type || TransactionType::TRANSFER === $type) && null === $newAccount) {
- Log::error(
+ app('log')->error(
sprintf(
'Cant change destination account of journal #%d because no asset account with name "%s" exists.',
$object->id,
@@ -90,18 +90,18 @@ class SetDestinationAccount implements ActionInterface
/** @var Transaction|null $source */
$source = $object->transactions()->where('amount', '<', 0)->first();
if (null === $source) {
- Log::error('Could not find source transaction.');
+ app('log')->error('Could not find source transaction.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_source_transaction')));
return false;
}
// account must not be deleted (in the meantime):
if (null === $source->account) {
- Log::error('Could not find source transaction account.');
+ app('log')->error('Could not find source transaction account.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_source_transaction_account')));
return false;
}
if (null !== $newAccount && (int)$newAccount->id === (int)$source->account_id) {
- Log::error(
+ app('log')->error(
sprintf(
'New destination account ID #%d and current source account ID #%d are the same. Do nothing.',
$newAccount->id,
diff --git a/app/TransactionRules/Actions/SetSourceAccount.php b/app/TransactionRules/Actions/SetSourceAccount.php
index 724b47b986..d60b9d399c 100644
--- a/app/TransactionRules/Actions/SetSourceAccount.php
+++ b/app/TransactionRules/Actions/SetSourceAccount.php
@@ -64,7 +64,7 @@ class SetSourceAccount implements ActionInterface
$object = $user->transactionJournals()->find((int)$journal['transaction_journal_id']);
$this->repository = app(AccountRepositoryInterface::class);
if (null === $object) {
- Log::error('Could not find journal.');
+ app('log')->error('Could not find journal.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_such_journal')));
return false;
}
@@ -74,7 +74,7 @@ class SetSourceAccount implements ActionInterface
// if this is a transfer or a withdrawal, the new source account must be an asset account or a default account, and it MUST exist:
$newAccount = $this->findAssetAccount($type);
if ((TransactionType::WITHDRAWAL === $type || TransactionType::TRANSFER === $type) && null === $newAccount) {
- Log::error(
+ app('log')->error(
sprintf('Cant change source account of journal #%d because no asset account with name "%s" exists.', $object->id, $this->action->action_value)
);
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_asset', ['name' => $this->action->action_value])));
@@ -85,18 +85,18 @@ class SetSourceAccount implements ActionInterface
/** @var Transaction|null $destination */
$destination = $object->transactions()->where('amount', '>', 0)->first();
if (null === $destination) {
- Log::error('Could not find destination transaction.');
+ app('log')->error('Could not find destination transaction.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_destination_transaction')));
return false;
}
// account must not be deleted (in the meantime):
if (null === $destination->account) {
- Log::error('Could not find destination transaction account.');
+ app('log')->error('Could not find destination transaction account.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_destination_transaction_account')));
return false;
}
if (null !== $newAccount && (int)$newAccount->id === (int)$destination->account_id) {
- Log::error(
+ app('log')->error(
sprintf(
'New source account ID #%d and current destination account ID #%d are the same. Do nothing.',
$newAccount->id,
diff --git a/app/TransactionRules/Actions/SwitchAccounts.php b/app/TransactionRules/Actions/SwitchAccounts.php
index 0839dcf5ae..306f954c66 100644
--- a/app/TransactionRules/Actions/SwitchAccounts.php
+++ b/app/TransactionRules/Actions/SwitchAccounts.php
@@ -58,20 +58,20 @@ class SwitchAccounts implements ActionInterface
/** @var TransactionJournal|null $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
- Log::error(sprintf('Cannot find journal #%d, cannot switch accounts.', $journal['transaction_journal_id']));
+ app('log')->error(sprintf('Cannot find journal #%d, cannot switch accounts.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_such_journal')));
return false;
}
$groupCount = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
if ($groupCount > 1) {
- Log::error(sprintf('Group #%d has more than one transaction in it, cannot switch accounts.', $journal['transaction_group_id']));
+ app('log')->error(sprintf('Group #%d has more than one transaction in it, cannot switch accounts.', $journal['transaction_group_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.split_group')));
return false;
}
$type = $object->transactionType->type;
if (TransactionType::TRANSFER !== $type) {
- Log::error(sprintf('Journal #%d is NOT a transfer (rule #%d), cannot switch accounts.', $journal['transaction_journal_id'], $this->action->rule_id));
+ app('log')->error(sprintf('Journal #%d is NOT a transfer (rule #%d), cannot switch accounts.', $journal['transaction_journal_id'], $this->action->rule_id));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.is_not_transfer')));
return false;
}
@@ -81,7 +81,7 @@ class SwitchAccounts implements ActionInterface
/** @var Transaction $destTransaction */
$destTransaction = $object->transactions()->where('amount', '>', 0)->first();
if (null === $sourceTransaction || null === $destTransaction) {
- Log::error(sprintf('Journal #%d has no source or destination transaction (rule #%d), cannot switch accounts.', $journal['transaction_journal_id'], $this->action->rule_id));
+ app('log')->error(sprintf('Journal #%d has no source or destination transaction (rule #%d), cannot switch accounts.', $journal['transaction_journal_id'], $this->action->rule_id));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_accounts')));
return false;
}
diff --git a/app/Validation/Account/DepositValidation.php b/app/Validation/Account/DepositValidation.php
index 4e306e18f5..7c70b8e519 100644
--- a/app/Validation/Account/DepositValidation.php
+++ b/app/Validation/Account/DepositValidation.php
@@ -52,7 +52,7 @@ trait DepositValidation
// if both values are NULL we return false,
// because the destination of a deposit can't be created.
$this->destError = (string)trans('validation.deposit_dest_need_data');
- Log::error('Both values are NULL, cant create deposit destination.');
+ app('log')->error('Both values are NULL, cant create deposit destination.');
$result = false;
}
// if the account can be created anyway we don't need to search.
diff --git a/app/Validation/Account/LiabilityValidation.php b/app/Validation/Account/LiabilityValidation.php
index b9a94d3dce..2d004f7f76 100644
--- a/app/Validation/Account/LiabilityValidation.php
+++ b/app/Validation/Account/LiabilityValidation.php
@@ -50,12 +50,12 @@ trait LiabilityValidation
// the ID of the destination must belong to a liability.
if (null !== $accountId) {
if (AccountType::LIABILITY_CREDIT !== $this?->source?->accountType?->type) {
- Log::error('Source account is not a liability.');
+ app('log')->error('Source account is not a liability.');
return false;
}
$result = $this->findExistingAccount($validTypes, $array);
if (null === $result) {
- Log::error('Destination account is not a liability.');
+ app('log')->error('Destination account is not a liability.');
return false;
}
return true;
@@ -65,7 +65,7 @@ trait LiabilityValidation
Log::debug('Destination ID is null, now we can assume the destination is a (new) liability credit account.');
return true;
}
- Log::error('Destination ID is null, but destination name is also NULL.');
+ app('log')->error('Destination ID is null, but destination name is also NULL.');
return false;
}
@@ -87,7 +87,7 @@ trait LiabilityValidation
// find liability credit:
$result = $this->findExistingAccount(config('firefly.valid_liabilities'), $array);
if (null === $result) {
- Log::error('Did not find a liability account, return false.');
+ 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));
@@ -100,11 +100,11 @@ trait LiabilityValidation
$result = true;
if ('' === $accountName || null === $accountName) {
- Log::error('Array must have a name, is not the case, return false.');
+ app('log')->error('Array must have a name, is not the case, return false.');
$result = false;
}
if (true === $result) {
- Log::error('Array has a name, return true.');
+ app('log')->error('Array has a name, return true.');
// set the source to be a (dummy) revenue account.
$account = new Account();
$accountType = AccountType::whereType(AccountType::LIABILITY_CREDIT)->first();
diff --git a/app/Validation/Account/OBValidation.php b/app/Validation/Account/OBValidation.php
index c77d65d4da..3372a80485 100644
--- a/app/Validation/Account/OBValidation.php
+++ b/app/Validation/Account/OBValidation.php
@@ -51,7 +51,7 @@ trait OBValidation
// if both values are NULL we return false,
// because the destination of a deposit can't be created.
$this->destError = (string)trans('validation.ob_dest_need_data');
- Log::error('Both values are NULL, cant create OB destination.');
+ app('log')->error('Both values are NULL, cant create OB destination.');
$result = false;
}
// if the account can be created anyway we don't need to search.
diff --git a/app/Validation/Account/TransferValidation.php b/app/Validation/Account/TransferValidation.php
index b7227d6db0..eaa0f8323f 100644
--- a/app/Validation/Account/TransferValidation.php
+++ b/app/Validation/Account/TransferValidation.php
@@ -48,7 +48,7 @@ trait TransferValidation
// if both values are NULL we return false,
// because the destination of a transfer can't be created.
$this->destError = (string)trans('validation.transfer_dest_need_data');
- Log::error('Both values are NULL, cant create transfer destination.');
+ app('log')->error('Both values are NULL, cant create transfer destination.');
return false;
}
diff --git a/app/Validation/AccountValidator.php b/app/Validation/AccountValidator.php
index 080665e403..5cc615a652 100644
--- a/app/Validation/AccountValidator.php
+++ b/app/Validation/AccountValidator.php
@@ -154,7 +154,7 @@ class AccountValidator
{
Log::debug('Now in AccountValidator::validateDestination()', $array);
if (null === $this->source) {
- Log::error('Source is NULL, always FALSE.');
+ 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.';
return false;
@@ -162,7 +162,7 @@ class AccountValidator
switch ($this->transactionType) {
default:
$this->destError = sprintf('AccountValidator::validateDestination cannot handle "%s", so it will always return false.', $this->transactionType);
- Log::error(sprintf('AccountValidator::validateDestination cannot handle "%s", so it will always return false.', $this->transactionType));
+ app('log')->error(sprintf('AccountValidator::validateDestination cannot handle "%s", so it will always return false.', $this->transactionType));
$result = false;
break;
@@ -200,7 +200,7 @@ class AccountValidator
Log::debug('Now in AccountValidator::validateSource()', $array);
switch ($this->transactionType) {
default:
- Log::error(sprintf('AccountValidator::validateSource cannot handle "%s", so it will do a generic check.', $this->transactionType));
+ app('log')->error(sprintf('AccountValidator::validateSource cannot handle "%s", so it will do a generic check.', $this->transactionType));
$result = $this->validateGenericSource($array);
break;
case TransactionType::WITHDRAWAL:
diff --git a/app/Validation/Administration/ValidatesAdministrationAccess.php b/app/Validation/Administration/ValidatesAdministrationAccess.php
index ecd88233ec..2c6e66f56b 100644
--- a/app/Validation/Administration/ValidatesAdministrationAccess.php
+++ b/app/Validation/Administration/ValidatesAdministrationAccess.php
@@ -53,7 +53,7 @@ trait ValidatesAdministrationAccess
throw new FireflyException('deprecated method, must be done through user.');
Log::debug('Now in validateAdministration()');
if (!auth()->check()) {
- Log::error('User is not authenticated.');
+ app('log')->error('User is not authenticated.');
throw new AuthenticationException('No access to validateAdministration() method.');
}
/** @var User $user */
@@ -64,7 +64,7 @@ trait ValidatesAdministrationAccess
$administrationId = (int)($data['administration_id'] ?? $user->getAdministrationId());
// safety catch:
if (0 === $administrationId) {
- Log::error('validateAdministration ran into empty administration ID.');
+ app('log')->error('validateAdministration ran into empty administration ID.');
throw new AuthenticationException('Cannot validate administration.');
}
// grab the group:
@@ -73,7 +73,7 @@ trait ValidatesAdministrationAccess
// collect the user's roles in this group:
$array = $repository->getRolesInGroup($user, $administrationId);
if (0 === count($array)) {
- Log::error(sprintf('User #%d ("%s") has no membership in group #%d.', $user->id, $user->email, $administrationId));
+ app('log')->error(sprintf('User #%d ("%s") has no membership in group #%d.', $user->id, $user->email, $administrationId));
$validator->errors()->add('administration', (string)trans('validation.no_access_user_group'));
return;
}
@@ -92,7 +92,7 @@ trait ValidatesAdministrationAccess
}
}
if (false === $access) {
- Log::error(
+ app('log')->error(
sprintf(
'User #%d has memberships [%s] to group #%d but needs [%s].',
$user->id,
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 02e6b4ef5f..4efc416f2a 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -71,7 +71,7 @@ class FireflyValidator extends Validator
}
$user = auth()->user();
if (null === $user) {
- Log::error('No user during validate2faCode');
+ app('log')->error('No user during validate2faCode');
return false;
}
$secretPreference = Preferences::get('temp-mfa-secret');
@@ -230,8 +230,8 @@ class FireflyValidator extends Validator
$checksum = bcmod($iban, '97');
} catch (ValueError $e) {
$message = sprintf('Could not validate IBAN check value "%s" (IBAN "%s")', $iban, $value);
- Log::error($message);
- Log::error($e->getTraceAsString());
+ app('log')->error($message);
+ app('log')->error($e->getTraceAsString());
return false;
}
@@ -432,7 +432,7 @@ class FireflyValidator extends Validator
try {
$parser->parseDate($value);
} catch (FireflyException $e) {
- Log::error($e->getMessage());
+ app('log')->error($e->getMessage());
return false;
}
diff --git a/app/Validation/TransactionValidation.php b/app/Validation/TransactionValidation.php
index aa7283de10..5e8fde3ade 100644
--- a/app/Validation/TransactionValidation.php
+++ b/app/Validation/TransactionValidation.php
@@ -94,7 +94,7 @@ trait TransactionValidation
}
// should be impossible to hit this:
if (!is_countable($transactions)) {
- Log::error(sprintf('Transactions array is not countable, because its a %s', gettype($transactions)));
+ app('log')->error(sprintf('Transactions array is not countable, because its a %s', gettype($transactions)));
return [];
}
//Log::debug('Returning transactions.', $transactions);